更新健康检查内容
This commit is contained in:
@@ -36,12 +36,15 @@ public class HealthAction extends AdminAction {
|
|||||||
public boolean action(Request request, Response response) {
|
public boolean action(Request request, Response response) {
|
||||||
if (request.getNettyRequest() instanceof FullHttpRequest) {
|
if (request.getNettyRequest() instanceof FullHttpRequest) {
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
|
||||||
JSONObject cpuObject = new JSONObject();
|
JSONObject cpuObject = new JSONObject();
|
||||||
jsonObject.put("cpu", cpuObject);
|
jsonObject.put("cpu", cpuObject);
|
||||||
|
|
||||||
JSONObject memoryObject = new JSONObject();
|
JSONObject memoryObject = new JSONObject();
|
||||||
jsonObject.put("memory", memoryObject);
|
jsonObject.put("memory", memoryObject);
|
||||||
|
|
||||||
|
JSONObject fileObject = new JSONObject();
|
||||||
|
jsonObject.put("disk", fileObject);
|
||||||
|
|
||||||
if (getOperatingSystemMXBean() instanceof OperatingSystemMXBean) {
|
if (getOperatingSystemMXBean() instanceof OperatingSystemMXBean) {
|
||||||
double load = getOperatingSystemMXBean().getSystemLoadAverage();
|
double load = getOperatingSystemMXBean().getSystemLoadAverage();
|
||||||
@@ -53,16 +56,11 @@ public class HealthAction extends AdminAction {
|
|||||||
memoryObject.put("max", Runtime.getRuntime().maxMemory());
|
memoryObject.put("max", Runtime.getRuntime().maxMemory());
|
||||||
memoryObject.put("avail", Runtime.getRuntime().totalMemory());
|
memoryObject.put("avail", Runtime.getRuntime().totalMemory());
|
||||||
|
|
||||||
|
File root = new File("/");
|
||||||
|
fileObject.put("space", root.getTotalSpace());
|
||||||
|
fileObject.put("free", root.getFreeSpace());
|
||||||
|
fileObject.put("usable", root.getUsableSpace());
|
||||||
|
|
||||||
JSONArray jsonArray = new JSONArray();
|
|
||||||
jsonObject.put("file", jsonArray);
|
|
||||||
for (File root : File.listRoots()) {
|
|
||||||
JSONObject fObj = new JSONObject();
|
|
||||||
fObj.put("path", root.getPath());
|
|
||||||
fObj.put("space", root.getTotalSpace());
|
|
||||||
fObj.put("free", root.getFreeSpace());
|
|
||||||
fObj.put("usable", root.getUsableSpace());
|
|
||||||
}
|
|
||||||
JSONObject out = new JSONObject();
|
JSONObject out = new JSONObject();
|
||||||
out.put("node1", jsonObject);
|
out.put("node1", jsonObject);
|
||||||
RestResult result = RestResult.ok(out);
|
RestResult result = RestResult.ok(out);
|
||||||
|
|||||||
Reference in New Issue
Block a user