Browse Source

Merge pull request #133 from lidongdai/dev-20190415

add monitor
pull/2/head
easyscheduler 6 years ago committed by GitHub
parent
commit
46dda9589d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      escheduler-server/src/main/java/cn/escheduler/server/ResInfo.java

22
escheduler-server/src/main/java/cn/escheduler/server/ResInfo.java

@ -35,6 +35,11 @@ public class ResInfo {
*/
private double memoryUsage;
/**
* loadAverage
*/
private double loadAverage;
public ResInfo(){}
public ResInfo(double cpuUsage , double memoryUsage){
@ -42,6 +47,12 @@ public class ResInfo {
this.memoryUsage = memoryUsage;
}
public ResInfo(double cpuUsage, double memoryUsage, double loadAverage) {
this.cpuUsage = cpuUsage;
this.memoryUsage = memoryUsage;
this.loadAverage = loadAverage;
}
public double getCpuUsage() {
return cpuUsage;
}
@ -58,12 +69,21 @@ public class ResInfo {
this.memoryUsage = memoryUsage;
}
public double getLoadAverage() {
return loadAverage;
}
public void setLoadAverage(double loadAverage) {
this.loadAverage = loadAverage;
}
/**
* get CPU and memory usage
* add cpu load average by lidong for service monitor
* @return
*/
public static String getResInfoJson(){
ResInfo resInfo = new ResInfo(OSUtils.cpuUsage(), OSUtils.memoryUsage());
ResInfo resInfo = new ResInfo(OSUtils.cpuUsage(), OSUtils.memoryUsage(),OSUtils.loadAverage());
return JSONUtils.toJson(resInfo);
}

Loading…
Cancel
Save