AMBARI-18199. Wrong hostname in timeline.metrics.service.webapp.address breaks AMS HA. (dsen via avijayan)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0e75b99d Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0e75b99d Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0e75b99d Branch: refs/heads/branch-2.5 Commit: 0e75b99d1f6dd8515d9acbd898ca29d6a9312288 Parents: ea65aee Author: Aravindan Vijayan <[email protected]> Authored: Mon Nov 14 21:10:23 2016 -0800 Committer: Aravindan Vijayan <[email protected]> Committed: Tue Nov 15 11:06:39 2016 -0800 ---------------------------------------------------------------------- .../src/test/python/ambari_agent/TestAlerts.py | 2 +- .../ambari_commons/ambari_metrics_helper.py | 56 ++++++++++++++++++++ .../BlueprintConfigurationProcessor.java | 13 ++--- .../1.6.1.2.2.0/package/scripts/params.py | 5 +- .../0.1.0/configuration/ams-site.xml | 2 +- .../0.1.0/package/scripts/params.py | 5 +- .../FLUME/1.4.0.2.0/package/scripts/params.py | 5 +- .../0.96.0.2.0/package/scripts/params_linux.py | 5 +- .../package/alerts/alert_metrics_deviation.py | 4 +- .../0.12.0.2.0/package/scripts/params_linux.py | 5 +- .../KAFKA/0.8.1/package/scripts/params.py | 8 +-- .../STORM/0.9.1/package/scripts/params_linux.py | 5 +- .../2.0.6/hooks/before-START/scripts/params.py | 7 +-- .../stacks/HDP/2.0.6/services/stack_advisor.py | 3 +- .../2.1/hooks/before-START/scripts/params.py | 6 ++- .../BlueprintConfigurationProcessorTest.java | 6 +-- .../2.0.6/HDFS/test_alert_metrics_deviation.py | 5 +- .../python/stacks/2.0.6/configs/default.json | 2 +- .../2.0.6/configs/default_ams_embedded.json | 2 +- .../2.0.6/configs/default_hive_non_hdfs.json | 2 +- .../2.0.6/configs/default_with_bucket.json | 2 +- .../stacks/2.2/common/test_stack_advisor.py | 2 +- .../journalnode-upgrade-hdfs-secure.json | 4 +- .../stacks/2.2/configs/journalnode-upgrade.json | 4 +- .../2.2/configs/ranger-admin-upgrade.json | 4 +- .../2.2/configs/ranger-usersync-upgrade.json | 4 +- .../test/python/stacks/2.3/configs/ats_1_5.json | 2 +- .../python/stacks/2.5/configs/hsi_default.json | 2 +- .../slider/SliderAppsViewControllerImpl.java | 1 + 29 files changed, 111 insertions(+), 62 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/ambari-agent/src/test/python/ambari_agent/TestAlerts.py ---------------------------------------------------------------------- diff --git a/ambari-agent/src/test/python/ambari_agent/TestAlerts.py b/ambari-agent/src/test/python/ambari_agent/TestAlerts.py index e114daa..2bddc43 100644 --- a/ambari-agent/src/test/python/ambari_agent/TestAlerts.py +++ b/ambari-agent/src/test/python/ambari_agent/TestAlerts.py @@ -411,7 +411,7 @@ class TestAlerts(TestCase): def test_ams_alert(self, ma_load_metric_mock): definition_json = self._get_ams_alert_definition() configuration = {'ams-site': - {'timeline.metrics.service.webapp.address': 'c6401.ambari.apache.org:6188'} + {'timeline.metrics.service.webapp.address': '0.0.0.0:6188'} } collector = AlertCollector() http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/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 new file mode 100644 index 0000000..7b4e8f5 --- /dev/null +++ b/ambari-common/src/main/python/ambari_commons/ambari_metrics_helper.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python + +''' +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +''' + +import os +import random +from resource_management.libraries.functions import conf_select + +DEFAULT_COLLECTOR_SUFFIX = '.sink.timeline.collector' +DEFAULT_METRICS2_PROPERTIES_FILE_NAME = 'hadoop-metrics2.properties' + +def select_metric_collector_for_sink(sink_name): + # TODO check '*' sink_name + + all_collectors_string = get_metric_collectors_from_properties_file(sink_name) + all_collectors_list = all_collectors_string.split(',') + return select_metric_collector_hosts_from_hostnames(all_collectors_list) + +def select_metric_collector_hosts_from_hostnames(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) + +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 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java index de72c2a..ec846f8 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java @@ -2759,17 +2759,10 @@ public class BlueprintConfigurationProcessor { amsSiteMap.put("timeline.metrics.service.webapp.address", new SingleHostTopologyUpdater("METRICS_COLLECTOR") { @Override public String updateForClusterCreate(String propertyName, String origValue, Map<String, Map<String, String>> properties, ClusterTopology topology) { - int metricsCollectorsCount = topology.getHostAssignmentsForComponent("METRICS_COLLECTOR").size(); - if (metricsCollectorsCount == 1) { - String value = origValue; - //localhost will be replaced with real hostname in updateForClusterCreate() - if (isSpecialNetworkAddress(origValue)) { - value = origValue.replace(BIND_ALL_IP_ADDRESS, "localhost"); - } - return super.updateForClusterCreate(propertyName, value, properties, topology); + if (!origValue.startsWith(BIND_ALL_IP_ADDRESS)) { + return origValue.replace(origValue.split(":")[0], BIND_ALL_IP_ADDRESS); } else { - //For multiple collectors - return origValue.replace("localhost", BIND_ALL_IP_ADDRESS); + return origValue; } } }); http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/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 120e3fa..a8a7327 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 @@ -28,6 +28,7 @@ from resource_management.libraries.functions.get_bare_principal import get_bare_ from resource_management.libraries.script.script import Script from resource_management.libraries.functions.stack_features import check_stack_feature from resource_management.libraries.functions import StackFeature +from ambari_commons.ambari_metrics_helper import select_metric_collector_hosts_from_hostnames import status_params @@ -128,12 +129,12 @@ if has_metric_collector: 'metrics_collector_vip_host' in config['configurations']['cluster-env']: metric_collector_host = config['configurations']['cluster-env']['metrics_collector_vip_host'] else: - metric_collector_host = ams_collector_hosts[0] + metric_collector_host = select_metric_collector_hosts_from_hostnames(ams_collector_hosts) 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'] else: - metric_collector_web_address = default("/configurations/ams-site/timeline.metrics.service.webapp.address", "localhost:6188") + metric_collector_web_address = default("/configurations/ams-site/timeline.metrics.service.webapp.address", "0.0.0.0:6188") if metric_collector_web_address.find(':') != -1: metric_collector_port = metric_collector_web_address.split(':')[1] else: http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-site.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-site.xml b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-site.xml index a47581d..9e0b1d0 100644 --- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-site.xml +++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-site.xml @@ -34,7 +34,7 @@ </property> <property> <name>timeline.metrics.service.webapp.address</name> - <value>localhost:6188</value> + <value>0.0.0.0:6188</value> <description> The address of the metrics service web application. </description> http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/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 db046ff..bdedd91 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 @@ -25,6 +25,7 @@ from resource_management.core.logger import Logger from resource_management import * from resource_management.libraries.functions.get_not_managed_resources import get_not_managed_resources from resource_management.libraries.functions.expect import expect +from ambari_commons.ambari_metrics_helper import select_metric_collector_hosts_from_hostnames import status_params from ambari_commons import OSCheck import ConfigParser @@ -113,12 +114,12 @@ 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 = ams_collector_hosts[0] + metric_collector_host = select_metric_collector_hosts_from_hostnames(ams_collector_hosts) 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'] else: - metric_collector_web_address = default("/configurations/ams-site/timeline.metrics.service.webapp.address", "localhost:6188") + metric_collector_web_address = default("/configurations/ams-site/timeline.metrics.service.webapp.address", "0.0.0.0:6188") if metric_collector_web_address.find(':') != -1: metric_collector_port = metric_collector_web_address.split(':')[1] else: http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/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 3203a52..fe29165 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 @@ -22,6 +22,7 @@ from resource_management.libraries.functions import format from resource_management.libraries.functions.version import format_stack_version from resource_management.libraries.functions.default import default from resource_management.libraries.script.script import Script +from ambari_commons.ambari_metrics_helper import select_metric_collector_hosts_from_hostnames if OSCheck.is_windows_family(): from params_windows import * @@ -92,12 +93,12 @@ if has_metric_collector: 'metrics_collector_vip_host' in config['configurations']['cluster-env']: metric_collector_host = config['configurations']['cluster-env']['metrics_collector_vip_host'] else: - metric_collector_host = ams_collector_hosts[0] + metric_collector_host = select_metric_collector_hosts_from_hostnames(ams_collector_hosts) 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'] else: - metric_collector_web_address = default("/configurations/ams-site/timeline.metrics.service.webapp.address", "localhost:6188") + metric_collector_web_address = default("/configurations/ams-site/timeline.metrics.service.webapp.address", "0.0.0.0:6188") if metric_collector_web_address.find(':') != -1: metric_collector_port = metric_collector_web_address.split(':')[1] else: http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/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 89731f2..1deb140 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 @@ -40,6 +40,7 @@ from resource_management.libraries.functions import get_unique_id_and_date from resource_management.libraries.functions.get_not_managed_resources import get_not_managed_resources from resource_management.libraries.script.script import Script from resource_management.libraries.functions.expect import expect +from ambari_commons.ambari_metrics_helper import select_metric_collector_hosts_from_hostnames # server configurations config = Script.get_config() @@ -157,12 +158,12 @@ if has_metric_collector: 'metrics_collector_vip_host' in config['configurations']['cluster-env']: metric_collector_host = config['configurations']['cluster-env']['metrics_collector_vip_host'] else: - metric_collector_host = ams_collector_hosts[0] + metric_collector_host = select_metric_collector_hosts_from_hostnames(ams_collector_hosts) 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'] else: - metric_collector_web_address = default("/configurations/ams-site/timeline.metrics.service.webapp.address", "localhost:6188") + metric_collector_web_address = default("/configurations/ams-site/timeline.metrics.service.webapp.address", "0.0.0.0:6188") if metric_collector_web_address.find(':') != -1: metric_collector_port = metric_collector_web_address.split(':')[1] else: http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/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 f0a1d5c..4efdae5 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 @@ -31,6 +31,7 @@ from ambari_commons.aggregate_functions import sample_standard_deviation, mean from resource_management.libraries.functions.curl_krb_request import curl_krb_request from resource_management.libraries.functions.curl_krb_request import DEFAULT_KERBEROS_KINIT_TIMER_MS from resource_management.libraries.functions.curl_krb_request import KERBEROS_KINIT_TIMER_PARAMETER +from ambari_commons.ambari_metrics_helper import select_metric_collector_for_sink RESULT_STATE_OK = 'OK' @@ -177,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 = collector_webapp_address[0] + collector_host = select_metric_collector_for_sink(app_id.lower()).split(":")[0] 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( @@ -404,7 +405,6 @@ def execute(configurations={}, parameters={}, host_name=None): def valid_collector_webapp_address(webapp_address): if len(webapp_address) == 2 \ and webapp_address[0] != '127.0.0.1' \ - and webapp_address[0] != '0.0.0.0' \ and webapp_address[1].isdigit(): return True http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py index 332f683..6fd53a8 100644 --- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py +++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py @@ -42,6 +42,7 @@ from resource_management.libraries.functions.get_port_from_url import get_port_f from resource_management.libraries.functions.expect import expect from resource_management.libraries import functions from resource_management.libraries.functions.setup_atlas_hook import has_atlas_in_cluster +from ambari_commons.ambari_metrics_helper import select_metric_collector_hosts_from_hostnames # Default log4j version; put config files under /etc/hive/conf log4j_version = '1' @@ -495,12 +496,12 @@ if has_metric_collector: 'metrics_collector_vip_host' in config['configurations']['cluster-env']: metric_collector_host = config['configurations']['cluster-env']['metrics_collector_vip_host'] else: - metric_collector_host = ams_collector_hosts[0] + metric_collector_host = select_metric_collector_hosts_from_hostnames(ams_collector_hosts) 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'] else: - metric_collector_web_address = default("/configurations/ams-site/timeline.metrics.service.webapp.address", "localhost:6188") + metric_collector_web_address = default("/configurations/ams-site/timeline.metrics.service.webapp.address", "0.0.0.0:6188") if metric_collector_web_address.find(':') != -1: metric_collector_port = metric_collector_web_address.split(':')[1] else: http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/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 5c26796..9c427ee 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 @@ -114,7 +114,6 @@ if 'ganglia_server_host' in config['clusterHostInfo'] and \ else: ganglia_installed = False -metric_collector_host = "" metric_collector_port = "" metric_collector_protocol = "" metric_truststore_path= default("/configurations/ams-ssl-client/ssl.client.truststore.location", "") @@ -126,15 +125,10 @@ 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 = ams_collector_hosts[0] - 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'] else: - metric_collector_web_address = default("/configurations/ams-site/timeline.metrics.service.webapp.address", "localhost:6188") + metric_collector_web_address = default("/configurations/ams-site/timeline.metrics.service.webapp.address", "0.0.0.0:6188") if metric_collector_web_address.find(':') != -1: metric_collector_port = metric_collector_web_address.split(':')[1] else: http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/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 17f9e2c..4d73195 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 @@ -39,6 +39,7 @@ from resource_management.libraries.functions import StackFeature from resource_management.libraries.functions.expect import expect from resource_management.libraries.functions.setup_atlas_hook import has_atlas_in_cluster from resource_management.libraries.functions import is_empty +from ambari_commons.ambari_metrics_helper import select_metric_collector_hosts_from_hostnames # server configurations config = Script.get_config() @@ -176,12 +177,12 @@ if has_metric_collector: 'metrics_collector_vip_host' in config['configurations']['cluster-env']: metric_collector_host = config['configurations']['cluster-env']['metrics_collector_vip_host'] else: - metric_collector_host = ams_collector_hosts[0] + metric_collector_host = select_metric_collector_hosts_from_hostnames(ams_collector_hosts) 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'] else: - metric_collector_web_address = default("/configurations/ams-site/timeline.metrics.service.webapp.address", "localhost:6188") + metric_collector_web_address = default("/configurations/ams-site/timeline.metrics.service.webapp.address", "0.0.0.0:6188") if metric_collector_web_address.find(':') != -1: metric_collector_port = metric_collector_web_address.split(':')[1] else: http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/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 cf61539..fdc9c17 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 @@ -116,15 +116,10 @@ if has_ganglia_server: metric_collector_port = None 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 = ams_collector_hosts[0] - 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'] else: - metric_collector_web_address = default("/configurations/ams-site/timeline.metrics.service.webapp.address", "localhost:6188") + metric_collector_web_address = default("/configurations/ams-site/timeline.metrics.service.webapp.address", "0.0.0.0:6188") if metric_collector_web_address.find(':') != -1: metric_collector_port = metric_collector_web_address.split(':')[1] else: http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py index d3c6732..b0ebc6b 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py @@ -640,7 +640,8 @@ class HDP206StackAdvisor(DefaultStackAdvisor): 'metrics_collector_vip_host' in services['configurations']['cluster-env']['properties']: metric_collector_host = services['configurations']['cluster-env']['properties']['metrics_collector_vip_host'] else: - metric_collector_host = 'localhost' if len(amsCollectorHosts) == 0 else amsCollectorHosts[0] + # TODO set "timeline.metrics.service.webapp.address" to 0.0.0.0:port in upgrade catalog + metric_collector_host = '0.0.0.0' putAmsSiteProperty("timeline.metrics.service.webapp.address", str(metric_collector_host) + ":6188") http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/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 5bd2a9e..7cd9340 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 @@ -19,6 +19,8 @@ limitations under the License. from resource_management import * 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", []) has_metric_collector = not len(ams_collector_hosts) == 0 @@ -27,12 +29,12 @@ if has_metric_collector: 'metrics_collector_vip_host' in config['configurations']['cluster-env']: metric_collector_host = config['configurations']['cluster-env']['metrics_collector_vip_host'] else: - metric_collector_host = ams_collector_hosts[0] + metric_collector_host = select_metric_collector_hosts_from_hostnames(ams_collector_hosts) 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'] else: - metric_collector_web_address = default("/configurations/ams-site/timeline.metrics.service.webapp.address", "localhost:6188") + metric_collector_web_address = default("/configurations/ams-site/timeline.metrics.service.webapp.address", "0.0.0.0:6188") if metric_collector_web_address.find(':') != -1: metric_collector_port = metric_collector_web_address.split(':')[1] else: http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java index 3e0cbc6..f2dd099 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java @@ -7841,7 +7841,7 @@ public class BlueprintConfigurationProcessorTest { configProcessor.doUpdateForClusterCreate(); - assertEquals("host1:6188", + assertEquals("0.0.0.0:6188", clusterConfig.getPropertyValue("ams-site", "timeline.metrics.service.webapp.address")); } @@ -7871,7 +7871,7 @@ public class BlueprintConfigurationProcessorTest { configProcessor.doUpdateForClusterCreate(); - assertEquals("host1:6188", + assertEquals("0.0.0.0:6188", clusterConfig.getPropertyValue("ams-site", "timeline.metrics.service.webapp.address")); } @@ -7881,7 +7881,7 @@ public class BlueprintConfigurationProcessorTest { Map<String, String> amsSite = new HashMap<String, String>(); //default - amsSite.put("timeline.metrics.service.webapp.address", "localhost:6188"); + amsSite.put("timeline.metrics.service.webapp.address", "0.0.0.0:6188"); properties.put("ams-site", amsSite); Map<String, Map<String, String>> parentProperties = new HashMap<String, Map<String, String>>(); http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_alert_metrics_deviation.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_alert_metrics_deviation.py b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_alert_metrics_deviation.py index 5bfbfc6..1e35e6f 100644 --- a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_alert_metrics_deviation.py +++ b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_alert_metrics_deviation.py @@ -21,7 +21,7 @@ limitations under the License. # System imports import os import sys - +from ambari_commons import ambari_metrics_helper from mock.mock import patch, MagicMock # Local imports @@ -74,12 +74,13 @@ class TestAlertMetricsDeviation(RMFTestCase): self.assertTrue(messages is not None and len(messages) == 1) self.assertTrue('is a required parameter for the script' in messages[0]) + @patch.object(ambari_metrics_helper, 'get_metric_collectors_from_properties_file', new = MagicMock(return_value='c6401.ambari.apache.org:6188')) @patch("httplib.HTTPConnection") def test_alert(self, conn_mock): configs = { '{{hdfs-site/dfs.namenode.https-address}}': 'c6401.ambari.apache.org:50470', '{{hdfs-site/dfs.http.policy}}': 'HTTP_ONLY', - '{{ams-site/timeline.metrics.service.webapp.address}}': 'c6401.ambari.apache.org:6188', + '{{ams-site/timeline.metrics.service.webapp.address}}': '0.0.0.0:6188', '{{hdfs-site/dfs.namenode.http-address}}': 'c6401.ambari.apache.org:50070', '{{cluster-env/security_enabled}}': 'false', '{{cluster-env/smokeuser}}': 'ambari-qa', http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/ambari-server/src/test/python/stacks/2.0.6/configs/default.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.0.6/configs/default.json b/ambari-server/src/test/python/stacks/2.0.6/configs/default.json index 18cd5f5..0aea0ff 100644 --- a/ambari-server/src/test/python/stacks/2.0.6/configs/default.json +++ b/ambari-server/src/test/python/stacks/2.0.6/configs/default.json @@ -898,7 +898,7 @@ "timeline.metrics.host.aggregator.ttl": "86400", "timeline.metrics.cluster.aggregator.hourly.checkpointCutOffMultiplier": "2", "timeline.metrics.service.cluster.aggregator.appIds": "datanode,nodemanager,hbase", - "timeline.metrics.service.webapp.address": "localhost:6188", + "timeline.metrics.service.webapp.address": "0.0.0.0:6188", "timeline.metrics.cluster.aggregator.hourly.disabled": "false", "timeline.metrics.aggregator.checkpoint.dir": "/var/lib/ambari-metrics-collector/checkpoint", "timeline.metrics.hbase.data.block.encoding": "FAST_DIFF", http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/ambari-server/src/test/python/stacks/2.0.6/configs/default_ams_embedded.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.0.6/configs/default_ams_embedded.json b/ambari-server/src/test/python/stacks/2.0.6/configs/default_ams_embedded.json index 1d5a6b9..dc6c830 100644 --- a/ambari-server/src/test/python/stacks/2.0.6/configs/default_ams_embedded.json +++ b/ambari-server/src/test/python/stacks/2.0.6/configs/default_ams_embedded.json @@ -842,7 +842,7 @@ "timeline.metrics.host.aggregator.ttl": "86400", "timeline.metrics.cluster.aggregator.hourly.checkpointCutOffMultiplier": "2", "timeline.metrics.service.cluster.aggregator.appIds": "datanode,nodemanager,hbase", - "timeline.metrics.service.webapp.address": "localhost:6188", + "timeline.metrics.service.webapp.address": "0.0.0.0:6188", "timeline.metrics.cluster.aggregator.hourly.disabled": "false", "timeline.metrics.aggregator.checkpoint.dir": "/var/lib/ambari-metrics-collector/checkpoint", "timeline.metrics.hbase.data.block.encoding": "FAST_DIFF", http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/ambari-server/src/test/python/stacks/2.0.6/configs/default_hive_non_hdfs.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.0.6/configs/default_hive_non_hdfs.json b/ambari-server/src/test/python/stacks/2.0.6/configs/default_hive_non_hdfs.json index 3692691..4a91e60 100644 --- a/ambari-server/src/test/python/stacks/2.0.6/configs/default_hive_non_hdfs.json +++ b/ambari-server/src/test/python/stacks/2.0.6/configs/default_hive_non_hdfs.json @@ -874,7 +874,7 @@ "timeline.metrics.host.aggregator.ttl": "86400", "timeline.metrics.cluster.aggregator.hourly.checkpointCutOffMultiplier": "2", "timeline.metrics.service.cluster.aggregator.appIds": "datanode,nodemanager,hbase", - "timeline.metrics.service.webapp.address": "localhost:6188", + "timeline.metrics.service.webapp.address": "0.0.0.0:6188", "timeline.metrics.cluster.aggregator.hourly.disabled": "false", "timeline.metrics.aggregator.checkpoint.dir": "/var/lib/ambari-metrics-collector/checkpoint", "timeline.metrics.hbase.data.block.encoding": "FAST_DIFF", http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/ambari-server/src/test/python/stacks/2.0.6/configs/default_with_bucket.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.0.6/configs/default_with_bucket.json b/ambari-server/src/test/python/stacks/2.0.6/configs/default_with_bucket.json index 54172f3..6ef3810 100644 --- a/ambari-server/src/test/python/stacks/2.0.6/configs/default_with_bucket.json +++ b/ambari-server/src/test/python/stacks/2.0.6/configs/default_with_bucket.json @@ -889,7 +889,7 @@ "timeline.metrics.host.aggregator.ttl": "86400", "timeline.metrics.cluster.aggregator.hourly.checkpointCutOffMultiplier": "2", "timeline.metrics.service.cluster.aggregator.appIds": "datanode,nodemanager,hbase", - "timeline.metrics.service.webapp.address": "localhost:6188", + "timeline.metrics.service.webapp.address": "0.0.0.0:6188", "timeline.metrics.cluster.aggregator.hourly.disabled": "false", "timeline.metrics.aggregator.checkpoint.dir": "/var/lib/ambari-metrics-collector/checkpoint", "timeline.metrics.hbase.data.block.encoding": "FAST_DIFF", http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py index 5b17071..5274986 100644 --- a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py +++ b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py @@ -2293,7 +2293,7 @@ class TestHDP22StackAdvisor(TestCase): "timeline.metrics.cluster.aggregate.splitpoints": "master.FileSystem.MetaHlogSplitTime_75th_percentile", "timeline.metrics.host.aggregate.splitpoints": "master.FileSystem.MetaHlogSplitTime_75th_percentile", "timeline.metrics.service.handler.thread.count": "20", - 'timeline.metrics.service.webapp.address': 'host1:6188', + 'timeline.metrics.service.webapp.address': '0.0.0.0:6188', 'timeline.metrics.service.watcher.disabled': 'false', 'timeline.metrics.cache.size': '100', 'timeline.metrics.cache.commit.interval': '10' http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/ambari-server/src/test/python/stacks/2.2/configs/journalnode-upgrade-hdfs-secure.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.2/configs/journalnode-upgrade-hdfs-secure.json b/ambari-server/src/test/python/stacks/2.2/configs/journalnode-upgrade-hdfs-secure.json index d65f4ef..928e313 100644 --- a/ambari-server/src/test/python/stacks/2.2/configs/journalnode-upgrade-hdfs-secure.json +++ b/ambari-server/src/test/python/stacks/2.2/configs/journalnode-upgrade-hdfs-secure.json @@ -316,7 +316,7 @@ "timeline.metrics.cluster.aggregator.hourly.interval": "3600", "timeline.metrics.host.aggregator.ttl": "86400", "timeline.metrics.cluster.aggregator.hourly.checkpointCutOffMultiplier": "2", - "timeline.metrics.service.webapp.address": "localhost:6188", + "timeline.metrics.service.webapp.address": "0.0.0.0:6188", "timeline.metrics.aggregator.checkpoint.dir": "/var/lib/ambari-metrics-collector/checkpoint", "timeline.metrics.host.aggregator.minute.disabled": "false", "timeline.metrics.cluster.aggregator.minute.ttl": "2592000", @@ -1268,4 +1268,4 @@ "c6406.ambari.apache.org" ] } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/ambari-server/src/test/python/stacks/2.2/configs/journalnode-upgrade.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.2/configs/journalnode-upgrade.json b/ambari-server/src/test/python/stacks/2.2/configs/journalnode-upgrade.json index 5807b5b..1a8b71e 100644 --- a/ambari-server/src/test/python/stacks/2.2/configs/journalnode-upgrade.json +++ b/ambari-server/src/test/python/stacks/2.2/configs/journalnode-upgrade.json @@ -316,7 +316,7 @@ "timeline.metrics.cluster.aggregator.hourly.interval": "3600", "timeline.metrics.host.aggregator.ttl": "86400", "timeline.metrics.cluster.aggregator.hourly.checkpointCutOffMultiplier": "2", - "timeline.metrics.service.webapp.address": "localhost:6188", + "timeline.metrics.service.webapp.address": "0.0.0.0:6188", "timeline.metrics.aggregator.checkpoint.dir": "/var/lib/ambari-metrics-collector/checkpoint", "timeline.metrics.host.aggregator.minute.disabled": "false", "timeline.metrics.cluster.aggregator.minute.ttl": "2592000", @@ -1266,4 +1266,4 @@ "c6406.ambari.apache.org" ] } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/ambari-server/src/test/python/stacks/2.2/configs/ranger-admin-upgrade.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.2/configs/ranger-admin-upgrade.json b/ambari-server/src/test/python/stacks/2.2/configs/ranger-admin-upgrade.json index 0a49368..79a5ec1 100644 --- a/ambari-server/src/test/python/stacks/2.2/configs/ranger-admin-upgrade.json +++ b/ambari-server/src/test/python/stacks/2.2/configs/ranger-admin-upgrade.json @@ -396,7 +396,7 @@ "timeline.metrics.cluster.aggregator.hourly.interval": "3600", "timeline.metrics.host.aggregator.ttl": "86400", "timeline.metrics.cluster.aggregator.hourly.checkpointCutOffMultiplier": "2", - "timeline.metrics.service.webapp.address": "localhost:6188", + "timeline.metrics.service.webapp.address": "0.0.0.0:6188", "timeline.metrics.aggregator.checkpoint.dir": "/var/lib/ambari-metrics-collector/checkpoint", "timeline.metrics.host.aggregator.minute.disabled": "false", "timeline.metrics.cluster.aggregator.minute.ttl": "2592000", @@ -1016,4 +1016,4 @@ "c6409.ambari.apache.org" ] } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/ambari-server/src/test/python/stacks/2.2/configs/ranger-usersync-upgrade.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.2/configs/ranger-usersync-upgrade.json b/ambari-server/src/test/python/stacks/2.2/configs/ranger-usersync-upgrade.json index b6615da..879dfae 100644 --- a/ambari-server/src/test/python/stacks/2.2/configs/ranger-usersync-upgrade.json +++ b/ambari-server/src/test/python/stacks/2.2/configs/ranger-usersync-upgrade.json @@ -391,7 +391,7 @@ "timeline.metrics.cluster.aggregator.hourly.interval": "3600", "timeline.metrics.host.aggregator.ttl": "86400", "timeline.metrics.cluster.aggregator.hourly.checkpointCutOffMultiplier": "2", - "timeline.metrics.service.webapp.address": "localhost:6188", + "timeline.metrics.service.webapp.address": "0.0.0.0:6188", "timeline.metrics.aggregator.checkpoint.dir": "/var/lib/ambari-metrics-collector/checkpoint", "timeline.metrics.host.aggregator.minute.disabled": "false", "timeline.metrics.cluster.aggregator.minute.ttl": "2592000", @@ -1011,4 +1011,4 @@ "c6409.ambari.apache.org" ] } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/ambari-server/src/test/python/stacks/2.3/configs/ats_1_5.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.3/configs/ats_1_5.json b/ambari-server/src/test/python/stacks/2.3/configs/ats_1_5.json index c64ca14..3fe1235 100644 --- a/ambari-server/src/test/python/stacks/2.3/configs/ats_1_5.json +++ b/ambari-server/src/test/python/stacks/2.3/configs/ats_1_5.json @@ -833,7 +833,7 @@ "timeline.metrics.host.aggregator.ttl": "86400", "timeline.metrics.cluster.aggregator.hourly.checkpointCutOffMultiplier": "2", "timeline.metrics.service.cluster.aggregator.appIds": "datanode,nodemanager,hbase", - "timeline.metrics.service.webapp.address": "localhost:6188", + "timeline.metrics.service.webapp.address": "0.0.0.0:6188", "timeline.metrics.cluster.aggregator.hourly.disabled": "false", "timeline.metrics.aggregator.checkpoint.dir": "/var/lib/ambari-metrics-collector/checkpoint", "timeline.metrics.hbase.data.block.encoding": "FAST_DIFF", http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/ambari-server/src/test/python/stacks/2.5/configs/hsi_default.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.5/configs/hsi_default.json b/ambari-server/src/test/python/stacks/2.5/configs/hsi_default.json index 78a0d04..f4451fc 100644 --- a/ambari-server/src/test/python/stacks/2.5/configs/hsi_default.json +++ b/ambari-server/src/test/python/stacks/2.5/configs/hsi_default.json @@ -929,7 +929,7 @@ "timeline.metrics.host.aggregator.ttl": "86400", "timeline.metrics.cluster.aggregator.hourly.checkpointCutOffMultiplier": "2", "timeline.metrics.service.cluster.aggregator.appIds": "datanode,nodemanager,hbase", - "timeline.metrics.service.webapp.address": "localhost:6188", + "timeline.metrics.service.webapp.address": "0.0.0.0:6188", "timeline.metrics.cluster.aggregator.hourly.disabled": "false", "timeline.metrics.aggregator.checkpoint.dir": "/var/lib/ambari-metrics-collector/checkpoint", "timeline.metrics.hbase.data.block.encoding": "FAST_DIFF", http://git-wip-us.apache.org/repos/asf/ambari/blob/0e75b99d/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java ---------------------------------------------------------------------- diff --git a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java index 42bd3ba..30bc2b0 100644 --- a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java +++ b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java @@ -266,6 +266,7 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController { if (cluster.getDesiredConfigs().containsKey("ams-site")) { Map<String, String> amsConfigs = ambariClient.getConfiguration(cluster, "ams-site", cluster.getDesiredConfigs().get("ams-site")); AmbariService amsService = ambariClient.getService(cluster, "AMBARI_METRICS"); + // TODO add metrics collector HA support List<AmbariHostComponent> hostsList = amsService.getComponentsToHostComponentsMap().get("METRICS_COLLECTOR"); if (hostsList != null && hostsList.size() > 0) { String collectorHostName = hostsList.get(0).getHostName();
