wuchunfu commented on code in PR #83:
URL: https://github.com/apache/bigtop-manager/pull/83#discussion_r1798712418


##########
bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/proxy/PrometheusProxy.java:
##########
@@ -81,4 +82,262 @@ public JsonNode queryAgentsHealthyStatus() {
         }
         return agentsHealthyStatus;
     }
+    private JsonNode queryAgents(){
+        JsonNode result = query("agent_host_monitoring_cpu");
+        ObjectMapper objectMapper = new ObjectMapper();
+        if (result != null) {
+            JsonNode agentCpus = result.get("data").get("result");
+            if(agentCpus.isArray() && !agentCpus.isEmpty()){
+                Set<String> iPv4addrSet = new HashSet<>();
+                for(JsonNode agent:agentCpus){
+                    
iPv4addrSet.add(agent.get("metric").get("iPv4addr").asText());
+                }
+                ArrayNode iPv4addrArray = objectMapper.createArrayNode();
+                for (String value : iPv4addrSet.toArray(new String[0])) {
+                    iPv4addrArray.add(value);
+                }
+                return 
objectMapper.createObjectNode().set("iPv4addr",iPv4addrArray);// IPV4地址
+            }
+        }
+        return objectMapper.createObjectNode();
+    }
+    public JsonNode queryAgentsInfo() {
+        ObjectMapper objectMapper = new ObjectMapper();
+        ArrayNode agentsInfo = objectMapper.createArrayNode();
+        JsonNode agents = queryAgents().get("iPv4addr"); // 获取全主机

Review Comment:
   @Cat-Drink Please change the comment information to English, thanks



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to