Support round-robin scheduling with failover for monitors with distributed collector (Commit 2). (avijayan)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ea65aee9 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ea65aee9 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ea65aee9 Branch: refs/heads/branch-2.5 Commit: ea65aee9ba749adeb2088f9a55de270923f9a04c Parents: 9b23777 Author: Aravindan Vijayan <[email protected]> Authored: Mon Nov 14 21:06:41 2016 -0800 Committer: Aravindan Vijayan <[email protected]> Committed: Tue Nov 15 11:06:38 2016 -0800 ---------------------------------------------------------------------- .../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/ea65aee9/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 b0a7733..fa9ea9f 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/ea65aee9/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
