AMBARI-19032 HDFS Metric alerts turns to UNKNOWN state with error "'NoneType' object has no attribute 'split'" (dsen)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/406b245e Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/406b245e Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/406b245e Branch: refs/heads/branch-dev-patch-upgrade Commit: 406b245ef9ed3a43fdf4d974dc1a7fc467c576a4 Parents: 63c0f2e Author: Dmytro Sen <d...@apache.org> Authored: Thu Dec 1 22:15:26 2016 +0200 Committer: Dmytro Sen <d...@apache.org> Committed: Thu Dec 1 22:15:26 2016 +0200 ---------------------------------------------------------------------- .../ambari_commons/ambari_metrics_helper.py | 45 +++++++++++--------- .../timeline/AbstractTimelineMetricsSink.java | 6 +-- .../AbstractTimelineMetricSinkTest.java | 10 ++--- .../timeline/HadoopTimelineMetricsSink.java | 4 +- .../timeline/HadoopTimelineMetricsSinkTest.java | 6 +-- .../src/main/python/core/config_reader.py | 9 ++-- .../src/test/python/core/TestEmitter.py | 2 +- .../1.6.1.2.2.0/package/scripts/params.py | 2 +- .../0.1.0/package/scripts/params.py | 2 +- .../0.1.0/package/scripts/service_check.py | 2 +- .../FLUME/1.4.0.2.0/package/scripts/params.py | 2 +- .../0.96.0.2.0/package/scripts/params_linux.py | 2 +- .../package/alerts/alert_metrics_deviation.py | 2 +- .../KAFKA/0.8.1/package/scripts/params.py | 2 +- .../STORM/0.9.1/package/scripts/params_linux.py | 2 +- .../2.0.6/hooks/before-START/scripts/params.py | 2 +- .../2.1/hooks/before-START/scripts/params.py | 4 +- 17 files changed, 51 insertions(+), 53 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-common/src/main/python/ambari_commons/ambari_metrics_helper.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/ambari_commons/ambari_metrics_helper.py b/ambari-common/src/main/python/ambari_commons/ambari_metrics_helper.py index 2eb0b6d..f6f4068 100644 --- a/ambari-common/src/main/python/ambari_commons/ambari_metrics_helper.py +++ b/ambari-common/src/main/python/ambari_commons/ambari_metrics_helper.py @@ -22,38 +22,41 @@ import os import random from resource_management.libraries.functions import conf_select -DEFAULT_COLLECTOR_SUFFIX = '.sink.timeline.collector' +DEFAULT_COLLECTOR_SUFFIX = '.sink.timeline.collector.hosts' DEFAULT_METRICS2_PROPERTIES_FILE_NAME = 'hadoop-metrics2.properties' def select_metric_collector_for_sink(sink_name): - # TODO check '*' sink_name + # TODO check '*' sink_name - all_collectors_string = get_metric_collectors_from_properties_file(sink_name) + all_collectors_string = get_metric_collectors_from_properties_file(sink_name) + if all_collectors_string: all_collectors_list = all_collectors_string.split(',') return select_metric_collector_hosts_from_hostnames(all_collectors_list) + else: + return 'localhost' def select_metric_collector_hosts_from_hostnames(hosts): - return get_random_host(hosts) + return get_random_host(hosts) def get_random_host(hosts): - return random.choice(hosts) + return random.choice(hosts) def get_metric_collectors_from_properties_file(sink_name): - hadoop_conf_dir = conf_select.get_hadoop_conf_dir() - props = load_properties_from_file(os.path.join(hadoop_conf_dir, DEFAULT_METRICS2_PROPERTIES_FILE_NAME)) - return props.get(sink_name + DEFAULT_COLLECTOR_SUFFIX) + hadoop_conf_dir = conf_select.get_hadoop_conf_dir() + props = load_properties_from_file(os.path.join(hadoop_conf_dir, DEFAULT_METRICS2_PROPERTIES_FILE_NAME)) + return props.get(sink_name + DEFAULT_COLLECTOR_SUFFIX) def load_properties_from_file(filepath, sep='=', comment_char='#'): - """ - Read the file passed as parameter as a properties file. - """ - props = {} - with open(filepath, "rt") as f: - for line in f: - l = line.strip() - if l and not l.startswith(comment_char): - key_value = l.split(sep) - key = key_value[0].strip() - value = sep.join(key_value[1:]).strip('" \t') - props[key] = value - return props + """ + Read the file passed as parameter as a properties file. + """ + props = {} + with open(filepath, "rt") as f: + for line in f: + l = line.strip() + if l and not l.startswith(comment_char): + key_value = l.split(sep) + key = key_value[0].strip() + value = sep.join(key_value[1:]).strip('" \t') + props[key] = value + return props http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/AbstractTimelineMetricsSink.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/AbstractTimelineMetricsSink.java b/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/AbstractTimelineMetricsSink.java index 769d0c1..2c0c822 100644 --- a/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/AbstractTimelineMetricsSink.java +++ b/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/AbstractTimelineMetricsSink.java @@ -477,7 +477,7 @@ public abstract class AbstractTimelineMetricsSink { return sb.toString(); } /** - * Parses input Sting of format "['host1', 'host2']" into Collection of hostnames + * Parses input Sting of format "host1,host2" into Collection of hostnames */ public Collection<String> parseHostsStringIntoCollection(String hostsString) { Set<String> hosts = new HashSet<>(); @@ -487,10 +487,8 @@ public abstract class AbstractTimelineMetricsSink { return hosts; } - String[] untrimmedHosts = hostsString.split(","); - for (String host : untrimmedHosts) { - host = StringUtils.substringBetween(host, "'"); + for (String host : hostsString.split(",")) { if (StringUtils.isEmpty(host)) continue; hosts.add(host.trim()); http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-metrics/ambari-metrics-common/src/test/java/org/apache/hadoop/metrics2/sink/timeline/availability/AbstractTimelineMetricSinkTest.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-common/src/test/java/org/apache/hadoop/metrics2/sink/timeline/availability/AbstractTimelineMetricSinkTest.java b/ambari-metrics/ambari-metrics-common/src/test/java/org/apache/hadoop/metrics2/sink/timeline/availability/AbstractTimelineMetricSinkTest.java index 5e016f8..9b0cdbe 100644 --- a/ambari-metrics/ambari-metrics-common/src/test/java/org/apache/hadoop/metrics2/sink/timeline/availability/AbstractTimelineMetricSinkTest.java +++ b/ambari-metrics/ambari-metrics-common/src/test/java/org/apache/hadoop/metrics2/sink/timeline/availability/AbstractTimelineMetricSinkTest.java @@ -32,21 +32,21 @@ public class AbstractTimelineMetricSinkTest { AbstractTimelineMetricsSink sink = new TestTimelineMetricsSink(); Collection<String> hosts; - hosts = sink.parseHostsStringIntoCollection("[]"); + hosts = sink.parseHostsStringIntoCollection(""); Assert.assertTrue(hosts.isEmpty()); - hosts = sink.parseHostsStringIntoCollection("[u'test1.123.abc.def.local']"); + hosts = sink.parseHostsStringIntoCollection("test1.123.abc.def.local"); Assert.assertTrue(hosts.size() == 1); Assert.assertTrue(hosts.contains("test1.123.abc.def.local")); - hosts = sink.parseHostsStringIntoCollection("['test1.123.abc.def.local']"); + hosts = sink.parseHostsStringIntoCollection("test1.123.abc.def.local "); Assert.assertTrue(hosts.size() == 1); Assert.assertTrue(hosts.contains("test1.123.abc.def.local")); - hosts = sink.parseHostsStringIntoCollection("[u'test1.123.abc.def.local', u'test1.456.abc.def.local']"); + hosts = sink.parseHostsStringIntoCollection("test1.123.abc.def.local,test1.456.abc.def.local"); Assert.assertTrue(hosts.size() == 2); - hosts = sink.parseHostsStringIntoCollection("['test1.123.abc.def.local', 'test1.456.abc.def.local']"); + hosts = sink.parseHostsStringIntoCollection("test1.123.abc.def.local, test1.456.abc.def.local"); Assert.assertTrue(hosts.size() == 2); Assert.assertTrue(hosts.contains("test1.123.abc.def.local")); Assert.assertTrue(hosts.contains("test1.456.abc.def.local")); http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-metrics/ambari-metrics-hadoop-sink/src/main/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSink.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-hadoop-sink/src/main/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSink.java b/ambari-metrics/ambari-metrics-hadoop-sink/src/main/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSink.java index 2bfc6db..7c85171 100644 --- a/ambari-metrics/ambari-metrics-hadoop-sink/src/main/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSink.java +++ b/ambari-metrics/ambari-metrics-hadoop-sink/src/main/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSink.java @@ -194,13 +194,13 @@ public class HadoopTimelineMetricsSink extends AbstractTimelineMetricsSink imple } /** - * Parses input Stings array of format "['host1'", '"host2']" into Collection of hostnames + * Parses input Stings array of format "host1,host2" into Collection of hostnames */ protected Collection<String> parseHostsStringArrayIntoCollection(String[] hostStrings) { Collection<String> result = new HashSet<>(); if (hostStrings == null) return result; for (String s : hostStrings) { - result.addAll(parseHostsStringIntoCollection(s)); + result.add(s.trim()); } return result; } http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-metrics/ambari-metrics-hadoop-sink/src/test/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSinkTest.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-hadoop-sink/src/test/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSinkTest.java b/ambari-metrics/ambari-metrics-hadoop-sink/src/test/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSinkTest.java index 3259c18..5777639 100644 --- a/ambari-metrics/ambari-metrics-hadoop-sink/src/test/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSinkTest.java +++ b/ambari-metrics/ambari-metrics-hadoop-sink/src/test/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSinkTest.java @@ -99,7 +99,7 @@ public class HadoopTimelineMetricsSinkTest { expect(conf.getString("slave.host.name")).andReturn("localhost").anyTimes(); expect(conf.getParent()).andReturn(null).anyTimes(); expect(conf.getPrefix()).andReturn("service").anyTimes(); - expect(conf.getStringArray(eq(COLLECTOR_HOSTS_PROPERTY))).andReturn(new String[]{"['localhost", "'localhost2']"}).anyTimes(); + expect(conf.getStringArray(eq(COLLECTOR_HOSTS_PROPERTY))).andReturn(new String[]{"localhost"," localhost2"}).anyTimes(); expect(conf.getString(eq("serviceName-prefix"), eq(""))).andReturn("").anyTimes(); expect(conf.getString(eq(COLLECTOR_PROTOCOL), eq("http"))).andReturn("http").anyTimes(); expect(conf.getString(eq(COLLECTOR_PORT), eq("6188"))).andReturn("6188").anyTimes(); @@ -171,7 +171,7 @@ public class HadoopTimelineMetricsSinkTest { expect(conf.getString("slave.host.name")).andReturn("localhost").anyTimes(); expect(conf.getParent()).andReturn(null).anyTimes(); expect(conf.getPrefix()).andReturn("service").anyTimes(); - expect(conf.getStringArray(eq(COLLECTOR_HOSTS_PROPERTY))).andReturn(new String[]{"['localhost", "'localhost2']"}).anyTimes(); + expect(conf.getStringArray(eq(COLLECTOR_HOSTS_PROPERTY))).andReturn(new String[]{"localhost", "localhost2"}).anyTimes(); expect(conf.getString(eq("serviceName-prefix"), eq(""))).andReturn("").anyTimes(); expect(conf.getString(eq(COLLECTOR_PROTOCOL), eq("http"))).andReturn("http").anyTimes(); expect(conf.getString(eq(COLLECTOR_PORT), eq("6188"))).andReturn("6188").anyTimes(); @@ -301,7 +301,7 @@ public class HadoopTimelineMetricsSinkTest { expect(conf.getString("slave.host.name")).andReturn("localhost").anyTimes(); expect(conf.getParent()).andReturn(null).anyTimes(); expect(conf.getPrefix()).andReturn("service").anyTimes(); - expect(conf.getStringArray(eq(COLLECTOR_HOSTS_PROPERTY))).andReturn(new String[]{"['localhost", "'localhost2']"}).anyTimes(); + expect(conf.getStringArray(eq(COLLECTOR_HOSTS_PROPERTY))).andReturn(new String[]{"localhost", "localhost2"}).anyTimes(); expect(conf.getString(eq("serviceName-prefix"), eq(""))).andReturn("").anyTimes(); expect(conf.getString(eq(COLLECTOR_PROTOCOL), eq("http"))).andReturn("http").anyTimes(); expect(conf.getString(eq(COLLECTOR_PORT), eq("6188"))).andReturn("6188").anyTimes(); http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/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 890d3ce..b84979a 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 @@ -102,7 +102,7 @@ config_content = """ [default] debug_level = INFO hostname = localhost -metrics_servers = ['localhost','host1','host2'] +metrics_servers = localhost enable_time_threshold = false enable_value_threshold = false @@ -217,10 +217,7 @@ class Configuration: def get_metrics_collector_hosts(self): hosts = self.get("default", "metrics_servers", "localhost") - if hosts is not "localhost": - return ast.literal_eval(hosts) - else: - return hosts + return hosts.split(",") def get_failover_strategy(self): return self.get("collector", "failover_strategy", ROUND_ROBIN_FAILOVER_STRATEGY) @@ -256,4 +253,4 @@ class Configuration: return self._ca_cert_file_path def get_disk_metrics_skip_pattern(self): - return self.get("default", "skip_disk_patterns") \ No newline at end of file + return self.get("default", "skip_disk_patterns") http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/core/TestEmitter.py ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/core/TestEmitter.py b/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/core/TestEmitter.py index de97292..4056ae3 100644 --- a/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/core/TestEmitter.py +++ b/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/core/TestEmitter.py @@ -83,7 +83,7 @@ class TestEmitter(TestCase): emitter.RETRY_SLEEP_INTERVAL = .001 emitter.submit_metrics() - self.assertEqual(request_mock.call_count, 9) + self.assertEqual(request_mock.call_count, 3) self.assertUrlData(request_mock) def assertUrlData(self, request_mock): http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/params.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/params.py index e00c1f5..53cf002 100644 --- a/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/params.py +++ b/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/params.py @@ -122,7 +122,7 @@ info_num_logs = config['configurations']['accumulo-log4j']['info_num_logs'] # metrics2 properties ganglia_server_hosts = default('/clusterHostInfo/ganglia_server_host', []) # is not passed when ganglia is not present ganglia_server_host = '' if len(ganglia_server_hosts) == 0 else ganglia_server_hosts[0] -ams_collector_hosts = default("/clusterHostInfo/metrics_collector_hosts", []) +ams_collector_hosts = ",".join(default("/clusterHostInfo/metrics_collector_hosts", [])) has_metric_collector = not len(ams_collector_hosts) == 0 if has_metric_collector: if 'cluster-env' in config['configurations'] and \ http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/params.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/params.py index acc3763..4bda033 100644 --- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/params.py +++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/params.py @@ -58,7 +58,7 @@ ams_pid_dir = status_params.ams_collector_pid_dir ams_collector_script = "/usr/sbin/ambari-metrics-collector" ams_collector_pid_dir = status_params.ams_collector_pid_dir -ams_collector_hosts = default("/clusterHostInfo/metrics_collector_hosts", []) +ams_collector_hosts = ",".join(default("/clusterHostInfo/metrics_collector_hosts", [])) failover_strategy_blacklisted_interval_seconds = default("/configurations/ams-env/failover_strategy_blacklisted_interval", "600") failover_strategy = default("/configurations/ams-site/failover.strategy", "round-robin") if default("/configurations/ams-site/timeline.metrics.service.http.policy", "HTTP_ONLY") == "HTTPS_ONLY": http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/service_check.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/service_check.py b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/service_check.py index 56ca4a1..b4e9b8f 100644 --- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/service_check.py +++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/service_check.py @@ -146,7 +146,7 @@ class AMSServiceCheck(Script): results = execute_in_parallel(self.service_check_for_single_host, params.ams_collector_hosts, params) - for host in params.ams_collector_hosts: + for host in str(params.ams_collector_hosts).split(","): if host in results: if results[host].status == SUCCESS: Logger.info("Ambari Metrics service check passed on host " + host) http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/params.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/params.py index 008e9d6..a44b461 100644 --- a/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/params.py +++ b/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/params.py @@ -85,7 +85,7 @@ hostname = None if config.has_key('hostname'): hostname = config['hostname'] -ams_collector_hosts = default("/clusterHostInfo/metrics_collector_hosts", []) +ams_collector_hosts = ",".join(default("/clusterHostInfo/metrics_collector_hosts", [])) has_metric_collector = not len(ams_collector_hosts) == 0 metric_collector_port = None if has_metric_collector: http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py index 1f32c41..f47dc8f 100644 --- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py +++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py @@ -151,7 +151,7 @@ has_ganglia_server = not len(ganglia_server_hosts) == 0 if has_ganglia_server: ganglia_server_host = ganglia_server_hosts[0] -ams_collector_hosts = default("/clusterHostInfo/metrics_collector_hosts", []) +ams_collector_hosts = ",".join(default("/clusterHostInfo/metrics_collector_hosts", [])) has_metric_collector = not len(ams_collector_hosts) == 0 if has_metric_collector: if 'cluster-env' in config['configurations'] and \ http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py index 4efdae5..8a06f56 100644 --- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py +++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py @@ -178,7 +178,7 @@ def execute(configurations={}, parameters={}, host_name=None): else: collector_webapp_address = configurations[METRICS_COLLECTOR_WEBAPP_ADDRESS_KEY].split(":") if valid_collector_webapp_address(collector_webapp_address): - collector_host = select_metric_collector_for_sink(app_id.lower()).split(":")[0] + collector_host = select_metric_collector_for_sink(app_id.lower()) collector_port = int(collector_webapp_address[1]) else: return (RESULT_STATE_UNKNOWN, ['{0} value should be set as "fqdn_hostname:port", but set to {1}'.format( http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/params.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/params.py b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/params.py index 0cb88fe..5635fe3 100644 --- a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/params.py +++ b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/params.py @@ -120,7 +120,7 @@ metric_truststore_path= default("/configurations/ams-ssl-client/ssl.client.trust metric_truststore_type= default("/configurations/ams-ssl-client/ssl.client.truststore.type", "") metric_truststore_password= default("/configurations/ams-ssl-client/ssl.client.truststore.password", "") -ams_collector_hosts = default("/clusterHostInfo/metrics_collector_hosts", []) +ams_collector_hosts = ",".join(default("/clusterHostInfo/metrics_collector_hosts", [])) has_metric_collector = not len(ams_collector_hosts) == 0 if has_metric_collector: http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_linux.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_linux.py index e753e98..aca0681 100644 --- a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_linux.py +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_linux.py @@ -170,7 +170,7 @@ if stack_supports_storm_kerberos: else: storm_thrift_transport = config['configurations']['storm-site']['_storm.thrift.nonsecure.transport'] -ams_collector_hosts = default("/clusterHostInfo/metrics_collector_hosts", []) +ams_collector_hosts = ",".join(default("/clusterHostInfo/metrics_collector_hosts", [])) has_metric_collector = not len(ams_collector_hosts) == 0 metric_collector_port = None if has_metric_collector: http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py index 4603c8b..4a5ee25 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py @@ -90,7 +90,7 @@ jtnode_host = default("/clusterHostInfo/jtnode_host", []) namenode_host = default("/clusterHostInfo/namenode_host", []) zk_hosts = default("/clusterHostInfo/zookeeper_hosts", []) ganglia_server_hosts = default("/clusterHostInfo/ganglia_server_host", []) -ams_collector_hosts = default("/clusterHostInfo/metrics_collector_hosts", []) +ams_collector_hosts = ",".join(default("/clusterHostInfo/metrics_collector_hosts", [])) has_namenode = not len(namenode_host) == 0 has_resourcemanager = not len(rm_host) == 0 http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-server/src/main/resources/stacks/HDPWIN/2.1/hooks/before-START/scripts/params.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/hooks/before-START/scripts/params.py b/ambari-server/src/main/resources/stacks/HDPWIN/2.1/hooks/before-START/scripts/params.py index 7cd9340..a22eb90 100644 --- a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/hooks/before-START/scripts/params.py +++ b/ambari-server/src/main/resources/stacks/HDPWIN/2.1/hooks/before-START/scripts/params.py @@ -22,14 +22,14 @@ import nturl2path from ambari_commons.ambari_metrics_helper import select_metric_collector_hosts_from_hostnames config = Script.get_config() -ams_collector_hosts = default("/clusterHostInfo/metrics_collector_hosts", []) +ams_collector_hosts = ",".join(default("/clusterHostInfo/metrics_collector_hosts", [])) has_metric_collector = not len(ams_collector_hosts) == 0 if has_metric_collector: if 'cluster-env' in config['configurations'] and \ 'metrics_collector_vip_host' in config['configurations']['cluster-env']: metric_collector_host = config['configurations']['cluster-env']['metrics_collector_vip_host'] else: - metric_collector_host = select_metric_collector_hosts_from_hostnames(ams_collector_hosts) + metric_collector_host = select_metric_collector_hosts_from_hostnames(ams_collector_hosts.split(",")) if 'cluster-env' in config['configurations'] and \ 'metrics_collector_vip_port' in config['configurations']['cluster-env']: metric_collector_port = config['configurations']['cluster-env']['metrics_collector_vip_port']