Support multi address for broker stats (#306)

* Support multi address

* Fixed broker health check

* Fixed health check
diff --git a/src/main/java/org/apache/pulsar/manager/service/impl/BrokerStatsServiceImpl.java b/src/main/java/org/apache/pulsar/manager/service/impl/BrokerStatsServiceImpl.java
index ca57605..c7a1037 100644
--- a/src/main/java/org/apache/pulsar/manager/service/impl/BrokerStatsServiceImpl.java
+++ b/src/main/java/org/apache/pulsar/manager/service/impl/BrokerStatsServiceImpl.java
@@ -47,6 +47,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.http.ResponseEntity;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
@@ -131,7 +132,26 @@
             clusterLists.forEach((clusterMap) -> {
                 String cluster = (String) clusterMap.get("cluster");
                 Pair<String, String> envCluster = Pair.of(env.getName(), cluster);
-                collectStatsServiceUrls.put(envCluster, (String) clusterMap.get("serviceUrl"));
+                String webServiceUrl = (String) clusterMap.get("serviceUrl");
+                if (webServiceUrl.contains(",")) {
+                    String[] webServiceUrlList = webServiceUrl.split(",");
+                    if (StringUtils.isNotBlank(pulsarJwtToken)) {
+                        header.put("Authorization", String.format("Bearer %s", pulsarJwtToken));
+                    }
+                    for (String url : webServiceUrlList) {
+                        if (!url.contains("http://")) {
+                            url = "http://" + url;
+                        }
+                        String httpTestResult = HttpUtil.doGet( url + "/admin/v2/brokers/health", header);
+                        if (httpTestResult == null) {
+                            log.error("This service {} is down, please check", url);
+                        } else {
+                            webServiceUrl = url;
+                            break;
+                        }
+                    }
+                }
+                collectStatsServiceUrls.put(envCluster, webServiceUrl);
             });
         }
         collectStatsServiceUrls.forEach((envCluster, serviceUrl) -> {