Repository: ambari Updated Branches: refs/heads/trunk defbeddae -> 5ae72ac59
AMBARI-15099 : Ambari missing metrics in UI with Vip settings enabled (avijayan) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5ae72ac5 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5ae72ac5 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5ae72ac5 Branch: refs/heads/trunk Commit: 5ae72ac59e14dc033140ee4626dbe0761a574893 Parents: defbedd Author: Aravindan Vijayan <avija...@hortonworks.com> Authored: Thu Feb 18 14:28:35 2016 -0800 Committer: Aravindan Vijayan <avija...@hortonworks.com> Committed: Thu Feb 18 14:28:35 2016 -0800 ---------------------------------------------------------------------- .../internal/AbstractProviderModule.java | 31 ++++++++++---------- 1 file changed, 16 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/5ae72ac5/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java index 52d95e0..ff9b4e4 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java @@ -310,7 +310,7 @@ public abstract class AbstractProviderModule implements ProviderModule, if (!configProperties.isEmpty()) { clusterMetricserverVipHost = configProperties.get("METRICS_COLLECTOR"); if (clusterMetricserverVipHost != null) { - clusterMetricCollectorMap.put(clusterName, clusterMetricserverVipHost); + LOG.info("Setting Metrics Collector Vip Host : " + clusterMetricserverVipHost); vipHostConfigPresent = true; } } @@ -340,15 +340,19 @@ public abstract class AbstractProviderModule implements ProviderModule, if (isHostLive(clusterName, hostname) && isHostComponentLive(clusterName, hostname, "AMBARI_METRICS", Role.METRICS_COLLECTOR.name())) { clusterMetricCollectorMap.put(clusterName, hostname); - LOG.debug("New Metrics Collector Host : " + hostname); + LOG.info("New Metrics Collector Host : " + hostname); break; } else { - LOG.debug("Metrics Collector Host or host component not live : " + hostname); + LOG.info("Metrics Collector Host or host component not live : " + hostname); } } } } - return clusterMetricCollectorMap.get(clusterName); + + LOG.debug("Cluster Metrics Vip Host : " + clusterMetricserverVipHost); + LOG.debug("Cluster Metrics Collector Host : " + clusterMetricCollectorMap.get(clusterName)); + + return (clusterMetricserverVipHost != null) ? clusterMetricserverVipHost : clusterMetricCollectorMap.get(clusterName); } @Override @@ -848,19 +852,16 @@ public abstract class AbstractProviderModule implements ProviderModule, clusterGangliaCollectorMap.put(clusterName, hostName); } if (componentName.equals(METRIC_SERVER)) { - //If vip config not present // If current collector host is null or if the host or the host component not live // Update clusterMetricCollectorMap. - if (!vipHostConfigPresent) { - String currentCollectorHost = clusterMetricCollectorMap.get(clusterName); - LOG.debug("Current Metrics collector Host : " + currentCollectorHost); - if ((currentCollectorHost == null) || - !(isHostLive(clusterName, currentCollectorHost) && - isHostComponentLive(clusterName, currentCollectorHost, "AMBARI_METRICS", Role.METRICS_COLLECTOR.name())) - ) { - LOG.debug("New Metrics collector Host : " + hostName); - clusterMetricCollectorMap.put(clusterName, hostName); - } + String currentCollectorHost = clusterMetricCollectorMap.get(clusterName); + LOG.info("Current Metrics collector Host : " + currentCollectorHost); + if ((currentCollectorHost == null) || + !(isHostLive(clusterName, currentCollectorHost) && + isHostComponentLive(clusterName, currentCollectorHost, "AMBARI_METRICS", Role.METRICS_COLLECTOR.name())) + ) { + LOG.info("New Metrics collector Host : " + hostName); + clusterMetricCollectorMap.put(clusterName, hostName); } metricServerHosts.add(hostName); }