Przeglądaj źródła

AMBARI-18199. Wrong hostname in timeline.metrics.service.webapp.address breaks AMS HA. (dsen via avijayan)

Aravindan Vijayan 9 lat temu
rodzic
commit
0e75b99d1f
29 zmienionych plików z 111 dodań i 62 usunięć
  1. 1 1
      ambari-agent/src/test/python/ambari_agent/TestAlerts.py
  2. 56 0
      ambari-common/src/main/python/ambari_commons/ambari_metrics_helper.py
  3. 3 10
      ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
  4. 3 2
      ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/params.py
  5. 1 1
      ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-site.xml
  6. 3 2
      ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/params.py
  7. 3 2
      ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/params.py
  8. 3 2
      ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
  9. 2 2
      ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py
  10. 3 2
      ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
  11. 1 7
      ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/params.py
  12. 3 2
      ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_linux.py
  13. 1 6
      ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
  14. 2 1
      ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
  15. 4 2
      ambari-server/src/main/resources/stacks/HDPWIN/2.1/hooks/before-START/scripts/params.py
  16. 3 3
      ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
  17. 3 2
      ambari-server/src/test/python/stacks/2.0.6/HDFS/test_alert_metrics_deviation.py
  18. 1 1
      ambari-server/src/test/python/stacks/2.0.6/configs/default.json
  19. 1 1
      ambari-server/src/test/python/stacks/2.0.6/configs/default_ams_embedded.json
  20. 1 1
      ambari-server/src/test/python/stacks/2.0.6/configs/default_hive_non_hdfs.json
  21. 1 1
      ambari-server/src/test/python/stacks/2.0.6/configs/default_with_bucket.json
  22. 1 1
      ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
  23. 2 2
      ambari-server/src/test/python/stacks/2.2/configs/journalnode-upgrade-hdfs-secure.json
  24. 2 2
      ambari-server/src/test/python/stacks/2.2/configs/journalnode-upgrade.json
  25. 2 2
      ambari-server/src/test/python/stacks/2.2/configs/ranger-admin-upgrade.json
  26. 2 2
      ambari-server/src/test/python/stacks/2.2/configs/ranger-usersync-upgrade.json
  27. 1 1
      ambari-server/src/test/python/stacks/2.3/configs/ats_1_5.json
  28. 1 1
      ambari-server/src/test/python/stacks/2.5/configs/hsi_default.json
  29. 1 0
      contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java

+ 1 - 1
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()

+ 56 - 0
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

+ 3 - 10
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;
         }
       }
     });

+ 3 - 2
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:

+ 1 - 1
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>

+ 3 - 2
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:

+ 3 - 2
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:

+ 3 - 2
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:

+ 2 - 2
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
 

+ 3 - 2
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:

+ 1 - 7
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", "")
@@ -125,16 +124,11 @@ ams_collector_hosts = 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 = 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:

+ 3 - 2
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:

+ 1 - 6
ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py

@@ -115,16 +115,11 @@ 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:

+ 2 - 1
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")
 

+ 4 - 2
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:

+ 3 - 3
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>>();

+ 3 - 2
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',

+ 1 - 1
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",

+ 1 - 1
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",

+ 1 - 1
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",

+ 1 - 1
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",

+ 1 - 1
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'

+ 2 - 2
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"
         ]
     }
-}
+}

+ 2 - 2
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"
         ]
     }
-}
+}

+ 2 - 2
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"
         ]
     }
-}
+}

+ 2 - 2
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"
         ]
     }
-}
+}

+ 1 - 1
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",

+ 1 - 1
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",

+ 1 - 0
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();