mirror of
https://gitee.com/dolphinscheduler/DolphinScheduler.git
synced 2024-12-05 05:38:30 +08:00
add monitor by lidong
This commit is contained in:
parent
d2fe0b10f1
commit
4b930ade92
@ -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…
Reference in New Issue
Block a user