Browse Source

Drop the heap and RAM used from _cat/nodes and add the RAM percentage.

In this view you never care about the actual heap used bytes; you only
want to know that your max is set to what you meant and what
percentage you're currently using.

Closes #4151.
Andrew Raines 12 năm trước cách đây
mục cha
commit
2b8bf07bd3

+ 6 - 6
src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java

@@ -69,7 +69,7 @@ public class RestNodesAction extends BaseRestHandler {
                     @Override
                     public void onResponse(final NodesInfoResponse nodesInfoResponse) {
                         NodesStatsRequest nodesStatsRequest = new NodesStatsRequest();
-                        nodesStatsRequest.clear().jvm(true).fs(true);
+                        nodesStatsRequest.clear().jvm(true).os(true).fs(true);
                         client.admin().cluster().nodesStats(nodesStatsRequest, new ActionListener<NodesStatsResponse>() {
                             @Override
                             public void onResponse(NodesStatsResponse nodesStatsResponse) {
@@ -125,9 +125,9 @@ public class RestNodesAction extends BaseRestHandler {
         table.addCell("es");
         table.addCell("jdk");
         table.addCell("diskAvail", "text-align:right;");
-        table.addCell("heapUsed", "text-align:right;");
+        table.addCell("heapPercent", "text-align:right;");
         table.addCell("heapMax", "text-align:right;");
-        table.addCell("heapRatio", "text-align:right;");
+        table.addCell("ramPercent", "text-align:right;");
         table.addCell("ramMax", "text-align:right;");
 
         table.addCell("uptime", "text-align:right;");
@@ -170,10 +170,10 @@ public class RestNodesAction extends BaseRestHandler {
             table.addCell(info == null ? null : info.getVersion().number());
             table.addCell(info == null ? null : info.getJvm().version());
             table.addCell(availableDisk < 0 ? null : ByteSizeValue.parseBytesSizeValue(new Long(availableDisk).toString()));
-            table.addCell(heapUsed < 0 ? null : new ByteSizeValue(heapUsed));
+            table.addCell(heapRatio < 0 ? null : String.format(Locale.ROOT, "%.1f", heapRatio*100.0));
             table.addCell(heapMax < 0 ? null : new ByteSizeValue(heapMax));
-            table.addCell(heapRatio < 0 ? null : String.format(Locale.ROOT, "%.1f%%", heapRatio*100.0));
-            table.addCell(info == null ? null : info.getOs().mem() == null ? null : info.getOs().mem().total()); // sigar fails to load in IntelliJ
+            table.addCell(stats == null ? null : stats.getOs() == null ? null : stats.getOs().mem().usedPercent());
+            table.addCell(info == null ? null : info.getOs() == null ? null : info.getOs().mem().total()); // sigar fails to load in IntelliJ
             table.addCell(stats == null ? null : stats.getJvm().uptime());
             table.addCell(node.clientNode() ? "c" : node.dataNode() ? "d" : null);
             table.addCell(masterId.equals(node.id()) ? "*" : node.masterNode() ? "m" : null);