AMBARI-17456 : Support round-robin scheduling with failover for monitors with 
distributed collector - Bug fix (avijayan)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/54a6525f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/54a6525f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/54a6525f

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 54a6525f8c49759fe9a013b35ce476693d1e855f
Parents: a418575
Author: Aravindan Vijayan <avija...@hortonworks.com>
Authored: Fri Sep 16 13:23:21 2016 -0700
Committer: Aravindan Vijayan <avija...@hortonworks.com>
Committed: Fri Sep 16 13:23:21 2016 -0700

----------------------------------------------------------------------
 .../src/main/python/core/config_reader.py               | 12 ++++++++++--
 .../0.1.0/package/templates/metric_monitor.ini.j2       |  1 +
 2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/54a6525f/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py
----------------------------------------------------------------------
diff --git 
a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py
 
b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py
index 2e8a170..3ca3a31 100644
--- 
a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py
+++ 
b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py
@@ -22,6 +22,7 @@ import ConfigParser
 import StringIO
 import json
 import os
+import ast
 from ambari_commons import OSConst
 from ambari_commons.os_family_impl import OsFamilyImpl
 
@@ -100,7 +101,7 @@ AMBARI_AGENT_CONF = 
'/etc/ambari-agent/conf/ambari-agent.ini'
 config_content = """
 [default]
 debug_level = INFO
-metrics_servers = localhost,host1,host2
+metrics_servers = ['localhost','host1','host2']
 enable_time_threshold = false
 enable_value_threshold = false
 
@@ -210,8 +211,15 @@ class Configuration:
   def get_collector_sleep_interval(self):
     return int(self.get("collector", "collector_sleep_interval", 10))
 
+  def get_hostname_config(self):
+    return self.get("default", "hostname", None)
+
   def get_metrics_collector_hosts(self):
-    return self.get("default", "metrics_servers", "localhost").split(",")
+    hosts = self.get("default", "metrics_servers", "localhost")
+    if hosts is not "localhost":
+      return ast.literal_eval(hosts)
+    else:
+      return hosts
 
   def get_failover_strategy(self):
     return self.get("collector", "failover_strategy", 
ROUND_ROBIN_FAILOVER_STRATEGY)

http://git-wip-us.apache.org/repos/asf/ambari/blob/54a6525f/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/templates/metric_monitor.ini.j2
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/templates/metric_monitor.ini.j2
 
b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/templates/metric_monitor.ini.j2
index b011fd5..3823912 100644
--- 
a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/templates/metric_monitor.ini.j2
+++ 
b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/templates/metric_monitor.ini.j2
@@ -18,6 +18,7 @@
 
 [default]
 debug_level = INFO
+hostname = {{hostname}}
 metrics_servers = {{ams_collector_hosts}}
 enable_time_threshold = false
 enable_value_threshold = false

Reply via email to