瀏覽代碼

AMBARI-8420. Add Amabri Metric Provider to get metrics from AMS. Check liveliness. (swagle)

Siddharth Wagle 10 年之前
父節點
當前提交
d2bc0ac819

+ 16 - 0
ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProvider.java

@@ -159,6 +159,22 @@ public abstract class AMSPropertyProvider extends MetricsPropertyProvider {
         Set<Resource> resourceSet = resourceEntry.getValue();
 
         for (Resource resource : resourceSet) {
+          String clusterName = (String) resource.getPropertyValue(clusterNamePropertyId);
+
+          // Check liveliness of host
+          if (!hostProvider.isCollectorHostLive(clusterName, TIMELINE_METRICS)) {
+            LOG.info("METRIC_COLLECTOR host is not live. Skip populating " +
+              "resources with metrics.");
+            return Collections.emptySet();
+          }
+
+          // Check liveliness of Collector
+          if (!hostProvider.isCollectorComponentLive(clusterName, TIMELINE_METRICS)) {
+            LOG.info("METRIC_COLLECTOR is not live. Skip populating resources" +
+              " with metrics.");
+            return Collections.emptySet();
+          }
+
           String metricsParam = getSetString(metrics.keySet(), -1);
           // Reuse uriBuilder
           uriBuilder.removeQuery();