http://git-wip-us.apache.org/repos/asf/ambari/blob/35e2851b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/templates/hadoop-metrics2-hivemetastore.properties.j2 ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/templates/hadoop-metrics2-hivemetastore.properties.j2 b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/templates/hadoop-metrics2-hivemetastore.properties.j2 index 3093e56..d4573c3 100644 --- a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/templates/hadoop-metrics2-hivemetastore.properties.j2 +++ b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/templates/hadoop-metrics2-hivemetastore.properties.j2 @@ -53,6 +53,8 @@ hivemetastore.sink.timeline.protocol={{metric_collector_protocol}} hivemetastore.sink.timeline.host_in_memory_aggregation = {{host_in_memory_aggregation}} hivemetastore.sink.timeline.host_in_memory_aggregation_port = {{host_in_memory_aggregation_port}} - + {% if is_aggregation_https_enabled %} + hivemetastore.sink.timeline.host_in_memory_aggregation_protocol = {{host_in_memory_aggregation_protocol}} + {% endif %} {% endif %}
http://git-wip-us.apache.org/repos/asf/ambari/blob/35e2851b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/templates/hadoop-metrics2-hiveserver2.properties.j2 ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/templates/hadoop-metrics2-hiveserver2.properties.j2 b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/templates/hadoop-metrics2-hiveserver2.properties.j2 index 59a7c1b..c67d002 100644 --- a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/templates/hadoop-metrics2-hiveserver2.properties.j2 +++ b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/templates/hadoop-metrics2-hiveserver2.properties.j2 @@ -53,5 +53,8 @@ hiveserver2.sink.timeline.protocol={{metric_collector_protocol}} hiveserver2.sink.timeline.host_in_memory_aggregation = {{host_in_memory_aggregation}} hiveserver2.sink.timeline.host_in_memory_aggregation_port = {{host_in_memory_aggregation_port}} + {% if is_aggregation_https_enabled %} + hiveserver2.sink.timeline.host_in_memory_aggregation_protocol = {{host_in_memory_aggregation_protocol}} + {% endif %} {% endif %} http://git-wip-us.apache.org/repos/asf/ambari/blob/35e2851b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/templates/hadoop-metrics2-llapdaemon.j2 ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/templates/hadoop-metrics2-llapdaemon.j2 b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/templates/hadoop-metrics2-llapdaemon.j2 index 69f6071..cd23e8a 100644 --- a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/templates/hadoop-metrics2-llapdaemon.j2 +++ b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/templates/hadoop-metrics2-llapdaemon.j2 @@ -52,5 +52,8 @@ llapdaemon.sink.timeline.protocol={{metric_collector_protocol}} llapdaemon.sink.timeline.host_in_memory_aggregation = {{host_in_memory_aggregation}} llapdaemon.sink.timeline.host_in_memory_aggregation_port = {{host_in_memory_aggregation_port}} + {% if is_aggregation_https_enabled %} + llapdaemon.sink.timeline.host_in_memory_aggregation_protocol = {{host_in_memory_aggregation_protocol}} + {% endif %} {% endif %} http://git-wip-us.apache.org/repos/asf/ambari/blob/35e2851b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/templates/hadoop-metrics2-llaptaskscheduler.j2 ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/templates/hadoop-metrics2-llaptaskscheduler.j2 b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/templates/hadoop-metrics2-llaptaskscheduler.j2 index c08a498..674d3cc 100644 --- a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/templates/hadoop-metrics2-llaptaskscheduler.j2 +++ b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/templates/hadoop-metrics2-llaptaskscheduler.j2 @@ -52,5 +52,8 @@ llaptaskscheduler.sink.timeline.protocol={{metric_collector_protocol}} llaptaskscheduler.sink.timeline.host_in_memory_aggregation = {{host_in_memory_aggregation}} llaptaskscheduler.sink.timeline.host_in_memory_aggregation_port = {{host_in_memory_aggregation_port}} + {% if is_aggregation_https_enabled %} + llaptaskscheduler.sink.timeline.host_in_memory_aggregation_protocol = {{host_in_memory_aggregation_protocol}} + {% endif %} {% endif %} http://git-wip-us.apache.org/repos/asf/ambari/blob/35e2851b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/configuration/kafka-broker.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/configuration/kafka-broker.xml b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/configuration/kafka-broker.xml index 39dfeba..3edb005 100644 --- a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/configuration/kafka-broker.xml +++ b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/configuration/kafka-broker.xml @@ -423,4 +423,9 @@ <value>{{host_in_memory_aggregation_port}}</value> <on-ambari-upgrade add="true"/> </property> + <property> + <name>kafka.timeline.metrics.host_in_memory_aggregation_protocol</name> + <value>{{host_in_memory_aggregation_protocol}}</value> + <on-ambari-upgrade add="true"/> + </property> </configuration> http://git-wip-us.apache.org/repos/asf/ambari/blob/35e2851b/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 9acc1ef..b385fba 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 @@ -159,6 +159,12 @@ if has_metric_collector: host_in_memory_aggregation = str(default("/configurations/ams-site/timeline.metrics.host.inmemory.aggregation", True)).lower() host_in_memory_aggregation_port = default("/configurations/ams-site/timeline.metrics.host.inmemory.aggregation.port", 61888) + is_aggregation_https_enabled = False + if default("/configurations/ams-site/timeline.metrics.host.inmemory.aggregation.http.policy", "HTTP_ONLY") == "HTTPS_ONLY": + host_in_memory_aggregation_protocol = 'https' + is_aggregation_https_enabled = True + else: + host_in_memory_aggregation_protocol = 'http' pass # Security-related params http://git-wip-us.apache.org/repos/asf/ambari/blob/35e2851b/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 78ec165..ff024e3 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 @@ -210,6 +210,12 @@ metric_collector_sink_jar = "/usr/lib/storm/lib/ambari-metrics-storm-sink-with-c metric_collector_legacy_sink_jar = "/usr/lib/storm/lib/ambari-metrics-storm-sink-legacy-with-common-*.jar" host_in_memory_aggregation = default("/configurations/ams-site/timeline.metrics.host.inmemory.aggregation", True) host_in_memory_aggregation_port = default("/configurations/ams-site/timeline.metrics.host.inmemory.aggregation.port", 61888) +is_aggregation_https_enabled = False +if default("/configurations/ams-site/timeline.metrics.host.inmemory.aggregation.http.policy", "HTTP_ONLY") == "HTTPS_ONLY": + host_in_memory_aggregation_protocol = 'https' + is_aggregation_https_enabled = True +else: + host_in_memory_aggregation_protocol = 'http' # Cluster Zookeeper quorum http://git-wip-us.apache.org/repos/asf/ambari/blob/35e2851b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/config.yaml.j2 ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/config.yaml.j2 b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/config.yaml.j2 index b2dd3c8..7560822 100644 --- a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/config.yaml.j2 +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/config.yaml.j2 @@ -61,8 +61,11 @@ metrics_collector: protocol: "{{metric_collector_protocol}}" port: "{{metric_collector_port}}" appId: "{{metric_collector_app_id}}" - host_in_memory_aggregation = {{host_in_memory_aggregation}} - host_in_memory_aggregation_port = {{host_in_memory_aggregation_port}} + host_in_memory_aggregation: {{host_in_memory_aggregation}} + host_in_memory_aggregation_port: {{host_in_memory_aggregation_port}} + {% if is_aggregation_https_enabled %} + host_in_memory_aggregation_protocol: {{host_in_memory_aggregation_protocol}} + {% endif %} # HTTPS settings truststore.path : "{{metric_truststore_path}}" http://git-wip-us.apache.org/repos/asf/ambari/blob/35e2851b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/storm-metrics2.properties.j2 ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/storm-metrics2.properties.j2 b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/storm-metrics2.properties.j2 index e7db91e..79d0b89 100644 --- a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/storm-metrics2.properties.j2 +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/storm-metrics2.properties.j2 @@ -25,6 +25,9 @@ sendInterval={{metrics_report_interval}}000 clusterReporterAppId=nimbus host_in_memory_aggregation = {{host_in_memory_aggregation}} host_in_memory_aggregation_port = {{host_in_memory_aggregation_port}} +{% if is_aggregation_https_enabled %} +host_in_memory_aggregation_protocol = {{host_in_memory_aggregation_protocol}} +{% endif %} # HTTPS properties truststore.path = {{metric_truststore_path}} http://git-wip-us.apache.org/repos/asf/ambari/blob/35e2851b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/params_linux.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/params_linux.py index 78ec165..ff024e3 100644 --- a/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/params_linux.py +++ b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/params_linux.py @@ -210,6 +210,12 @@ metric_collector_sink_jar = "/usr/lib/storm/lib/ambari-metrics-storm-sink-with-c metric_collector_legacy_sink_jar = "/usr/lib/storm/lib/ambari-metrics-storm-sink-legacy-with-common-*.jar" host_in_memory_aggregation = default("/configurations/ams-site/timeline.metrics.host.inmemory.aggregation", True) host_in_memory_aggregation_port = default("/configurations/ams-site/timeline.metrics.host.inmemory.aggregation.port", 61888) +is_aggregation_https_enabled = False +if default("/configurations/ams-site/timeline.metrics.host.inmemory.aggregation.http.policy", "HTTP_ONLY") == "HTTPS_ONLY": + host_in_memory_aggregation_protocol = 'https' + is_aggregation_https_enabled = True +else: + host_in_memory_aggregation_protocol = 'http' # Cluster Zookeeper quorum http://git-wip-us.apache.org/repos/asf/ambari/blob/35e2851b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/templates/config.yaml.j2 ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/templates/config.yaml.j2 b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/templates/config.yaml.j2 index b2dd3c8..7560822 100644 --- a/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/templates/config.yaml.j2 +++ b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/templates/config.yaml.j2 @@ -61,8 +61,11 @@ metrics_collector: protocol: "{{metric_collector_protocol}}" port: "{{metric_collector_port}}" appId: "{{metric_collector_app_id}}" - host_in_memory_aggregation = {{host_in_memory_aggregation}} - host_in_memory_aggregation_port = {{host_in_memory_aggregation_port}} + host_in_memory_aggregation: {{host_in_memory_aggregation}} + host_in_memory_aggregation_port: {{host_in_memory_aggregation_port}} + {% if is_aggregation_https_enabled %} + host_in_memory_aggregation_protocol: {{host_in_memory_aggregation_protocol}} + {% endif %} # HTTPS settings truststore.path : "{{metric_truststore_path}}" http://git-wip-us.apache.org/repos/asf/ambari/blob/35e2851b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/templates/storm-metrics2.properties.j2 ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/templates/storm-metrics2.properties.j2 b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/templates/storm-metrics2.properties.j2 index e7db91e..79d0b89 100644 --- a/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/templates/storm-metrics2.properties.j2 +++ b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/templates/storm-metrics2.properties.j2 @@ -25,6 +25,9 @@ sendInterval={{metrics_report_interval}}000 clusterReporterAppId=nimbus host_in_memory_aggregation = {{host_in_memory_aggregation}} host_in_memory_aggregation_port = {{host_in_memory_aggregation_port}} +{% if is_aggregation_https_enabled %} +host_in_memory_aggregation_protocol = {{host_in_memory_aggregation_protocol}} +{% endif %} # HTTPS properties truststore.path = {{metric_truststore_path}} http://git-wip-us.apache.org/repos/asf/ambari/blob/35e2851b/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 3488e75..d40fcc8 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 @@ -166,6 +166,12 @@ metrics_collection_period = default("/configurations/ams-site/timeline.metrics.s host_in_memory_aggregation = default("/configurations/ams-site/timeline.metrics.host.inmemory.aggregation", True) host_in_memory_aggregation_port = default("/configurations/ams-site/timeline.metrics.host.inmemory.aggregation.port", 61888) +is_aggregation_https_enabled = False +if default("/configurations/ams-site/timeline.metrics.host.inmemory.aggregation.http.policy", "HTTP_ONLY") == "HTTPS_ONLY": + host_in_memory_aggregation_protocol = 'https' + is_aggregation_https_enabled = True +else: + host_in_memory_aggregation_protocol = 'http' # Cluster Zookeeper quorum zookeeper_quorum = None http://git-wip-us.apache.org/repos/asf/ambari/blob/35e2851b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/templates/hadoop-metrics2.properties.j2 ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/templates/hadoop-metrics2.properties.j2 b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/templates/hadoop-metrics2.properties.j2 index 2cd9aa8..281ac27 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/templates/hadoop-metrics2.properties.j2 +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/templates/hadoop-metrics2.properties.j2 @@ -77,6 +77,9 @@ resourcemanager.sink.ganglia.tagsForPrefix.yarn=Queue *.sink.timeline.port={{metric_collector_port}} *.sink.timeline.host_in_memory_aggregation = {{host_in_memory_aggregation}} *.sink.timeline.host_in_memory_aggregation_port = {{host_in_memory_aggregation_port}} +{% if is_aggregation_https_enabled %} +*.sink.timeline.host_in_memory_aggregation_protocol = {{host_in_memory_aggregation_protocol}} +{% endif %} # HTTPS properties *.sink.timeline.truststore.path = {{metric_truststore_path}} http://git-wip-us.apache.org/repos/asf/ambari/blob/35e2851b/ambari-server/src/main/resources/stacks/HDP/2.6/services/HDFS/configuration/hadoop-metrics2.properties.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/HDFS/configuration/hadoop-metrics2.properties.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/HDFS/configuration/hadoop-metrics2.properties.xml index 84ea231..02be755 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/HDFS/configuration/hadoop-metrics2.properties.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/HDFS/configuration/hadoop-metrics2.properties.xml @@ -88,6 +88,9 @@ resourcemanager.sink.ganglia.tagsForPrefix.yarn=Queue *.sink.timeline.port={{metric_collector_port}} *.sink.timeline.host_in_memory_aggregation = {{host_in_memory_aggregation}} *.sink.timeline.host_in_memory_aggregation_port = {{host_in_memory_aggregation_port}} +{% if is_aggregation_https_enabled %} +*.sink.timeline.host_in_memory_aggregation_protocol = {{host_in_memory_aggregation_protocol}} +{% endif %} # HTTPS properties *.sink.timeline.truststore.path = {{metric_truststore_path}} http://git-wip-us.apache.org/repos/asf/ambari/blob/35e2851b/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/before-START/scripts/params.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/before-START/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/before-START/scripts/params.py index a3830f7..0e38f5d 100644 --- a/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/before-START/scripts/params.py +++ b/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/before-START/scripts/params.py @@ -160,6 +160,12 @@ metrics_report_interval = default("/configurations/ams-site/timeline.metrics.sin metrics_collection_period = default("/configurations/ams-site/timeline.metrics.sink.collection.period", 10) host_in_memory_aggregation = default("/configurations/ams-site/timeline.metrics.host.inmemory.aggregation", True) host_in_memory_aggregation_port = default("/configurations/ams-site/timeline.metrics.host.inmemory.aggregation.port", 61888) +is_aggregation_https_enabled = False +if default("/configurations/ams-site/timeline.metrics.host.inmemory.aggregation.http.policy", "HTTP_ONLY") == "HTTPS_ONLY": + host_in_memory_aggregation_protocol = 'https' + is_aggregation_https_enabled = True +else: + host_in_memory_aggregation_protocol = 'http' # Cluster Zookeeper quorum zookeeper_quorum = None http://git-wip-us.apache.org/repos/asf/ambari/blob/35e2851b/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/before-START/templates/hadoop-metrics2.properties.j2 ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/before-START/templates/hadoop-metrics2.properties.j2 b/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/before-START/templates/hadoop-metrics2.properties.j2 index 2cd9aa8..281ac27 100644 --- a/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/before-START/templates/hadoop-metrics2.properties.j2 +++ b/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/before-START/templates/hadoop-metrics2.properties.j2 @@ -77,6 +77,9 @@ resourcemanager.sink.ganglia.tagsForPrefix.yarn=Queue *.sink.timeline.port={{metric_collector_port}} *.sink.timeline.host_in_memory_aggregation = {{host_in_memory_aggregation}} *.sink.timeline.host_in_memory_aggregation_port = {{host_in_memory_aggregation_port}} +{% if is_aggregation_https_enabled %} +*.sink.timeline.host_in_memory_aggregation_protocol = {{host_in_memory_aggregation_protocol}} +{% endif %} # HTTPS properties *.sink.timeline.truststore.path = {{metric_truststore_path}} http://git-wip-us.apache.org/repos/asf/ambari/blob/35e2851b/ambari-server/src/test/java/org/apache/ambari/server/metric/system/impl/TestAmbariMetricsSinkImpl.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/metric/system/impl/TestAmbariMetricsSinkImpl.java b/ambari-server/src/test/java/org/apache/ambari/server/metric/system/impl/TestAmbariMetricsSinkImpl.java index 3ee8ebc..52aa7ca 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/metric/system/impl/TestAmbariMetricsSinkImpl.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/metric/system/impl/TestAmbariMetricsSinkImpl.java @@ -84,6 +84,11 @@ public class TestAmbariMetricsSinkImpl extends AbstractTimelineMetricsSink imple } @Override + protected String getHostInMemoryAggregationProtocol() { + return "http"; + } + + @Override public void init(MetricsConfiguration configuration) { } http://git-wip-us.apache.org/repos/asf/ambari/blob/35e2851b/ambari-server/src/test/python/stacks/2.0.6/AMBARI_METRICS/test_metrics_monitor.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.0.6/AMBARI_METRICS/test_metrics_monitor.py b/ambari-server/src/test/python/stacks/2.0.6/AMBARI_METRICS/test_metrics_monitor.py new file mode 100644 index 0000000..945d87a --- /dev/null +++ b/ambari-server/src/test/python/stacks/2.0.6/AMBARI_METRICS/test_metrics_monitor.py @@ -0,0 +1,142 @@ +#!/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. +''' + +from mock.mock import MagicMock, patch +from stacks.utils.RMFTestCase import * + +@patch("tempfile.mkdtemp", new = MagicMock(return_value='/some_tmp_dir')) +@patch("os.path.exists", new = MagicMock(return_value=True)) +@patch("platform.linux_distribution", new = MagicMock(return_value="Linux")) +class TestMetricsMonitor(RMFTestCase): + COMMON_SERVICES_PACKAGE_DIR = "AMBARI_METRICS/0.1.0/package" + STACK_VERSION = "2.0.6" + DEFAULT_IMMUTABLE_PATHS = ['/apps/hive/warehouse', '/apps/falcon', '/mr-history/done', '/app-logs', '/tmp'] + + def test_start_default_with_aggregator_https(self): + self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/metrics_monitor.py", + classname = "AmsMonitor", + command = "start", + config_file="default.json", + stack_version = self.STACK_VERSION, + target = RMFTestCase.TARGET_COMMON_SERVICES + ) + self.maxDiff=None + self.assert_ams(inmemory_aggregation = False) + self.assertResourceCalled('Execute', 'ambari-sudo.sh /usr/jdk64/jdk1.7.0_45/bin/keytool -importkeystore -srckeystore /etc/security/clientKeys/all.jks -destkeystore /some_tmp_dir/truststore.p12 -srcalias c6402.ambari.apache.org -deststoretype PKCS12 -srcstorepass bigdata -deststorepass bigdata', + ) + self.assertResourceCalled('Execute', 'ambari-sudo.sh openssl pkcs12 -in /some_tmp_dir/truststore.p12 -out /etc/ambari-metrics-monitor/conf/ca.pem -cacerts -nokeys -passin pass:bigdata', + ) + self.assertResourceCalled('Execute', ('chown', u'ams:hadoop', '/etc/ambari-metrics-monitor/conf/ca.pem'), + sudo=True + ) + self.assertResourceCalled('Execute', ('chmod', '644', '/etc/ambari-metrics-monitor/conf/ca.pem'), + sudo=True) + self.assertResourceCalled('Execute', 'ambari-sudo.sh rm -rf /some_tmp_dir', + ) + self.assertResourceCalled('Execute', '/usr/sbin/ambari-metrics-monitor --config /etc/ambari-metrics-monitor/conf start', + user = 'ams' + ) + self.assertNoMoreResources() + + def test_start_inmemory_aggregator(self): + self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/metrics_monitor.py", + classname = "AmsMonitor", + command = "start", + config_file="default_ams_embedded.json", + stack_version = self.STACK_VERSION, + target = RMFTestCase.TARGET_COMMON_SERVICES + ) + self.maxDiff=None + self.assert_ams(inmemory_aggregation = True) + + self.assertResourceCalled('Execute', '/usr/sbin/ambari-metrics-monitor --config /etc/ambari-metrics-monitor/conf start', + user = 'ams' + ) + self.assertNoMoreResources() + + def assert_ams(self, inmemory_aggregation=False): + self.assertResourceCalled('Directory', '/etc/ambari-metrics-monitor/conf', + owner = 'ams', + group = 'hadoop', + create_parents = True + ) + + self.assertResourceCalled('Directory', '/var/log/ambari-metrics-monitor', + owner = 'ams', + group = 'hadoop', + mode = 0755, + create_parents = True + ) + + if inmemory_aggregation: + self.assertResourceCalled('File', '/etc/ambari-metrics-monitor/conf/log4j.properties', + owner = 'ams', + group = 'hadoop', + content = InlineTemplate(self.getConfig()['configurations']['ams-log4j']['content']), + mode=0644, + ) + self.assertResourceCalled('XmlConfig', 'ams-site.xml', + owner = 'ams', + group = 'hadoop', + conf_dir = '/etc/ambari-metrics-monitor/conf', + configurations = self.getConfig()['configurations']['ams-site'], + configuration_attributes = self.getConfig()['configuration_attributes']['ams-hbase-site'] + ) + + self.assertResourceCalled('XmlConfig', 'ssl-server.xml', + owner = 'ams', + group = 'hadoop', + conf_dir = '/etc/ambari-metrics-monitor/conf', + configurations = self.getConfig()['configurations']['ams-ssl-server'], + configuration_attributes = self.getConfig()['configuration_attributes']['ams-ssl-server'] + ) + pass + + self.assertResourceCalled('Execute', 'ambari-sudo.sh chown -R ams:hadoop /var/log/ambari-metrics-monitor') + self.assertResourceCalled('Directory', '/var/run/ambari-metrics-monitor', + owner = 'ams', + group = 'hadoop', + mode = 0755, + cd_access = 'a', + create_parents = True + ) + self.assertResourceCalled('Directory', '/usr/lib/python2.6/site-packages/resource_monitoring/psutil/build', + owner = 'ams', + group = 'hadoop', + cd_access = 'a', + create_parents = True + ) + + self.assertResourceCalled('Execute', 'ambari-sudo.sh chown -R ams:hadoop /usr/lib/python2.6/site-packages/resource_monitoring') + self.assertResourceCalled('TemplateConfig', '/etc/ambari-metrics-monitor/conf/metric_monitor.ini', + owner = 'ams', + group = 'hadoop', + template_tag = None, + ) + self.assertResourceCalled('TemplateConfig', '/etc/ambari-metrics-monitor/conf/metric_groups.conf', + owner = 'ams', + group = 'hadoop', + template_tag = None, + ) + self.assertResourceCalled('File', '/etc/ambari-metrics-monitor/conf/ams-env.sh', + owner = 'ams', + content = InlineTemplate(self.getConfig()['configurations']['ams-env']['content']) + ) + http://git-wip-us.apache.org/repos/asf/ambari/blob/35e2851b/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 71423c8..6e445c7 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 @@ -826,6 +826,7 @@ "content": "\n" }, "ams-site": { + "timeline.metrics.host.inmemory.aggregation": "true", "timeline.metrics.host.aggregator.minute.ttl": "604800", "timeline.metrics.cluster.aggregator.daily.checkpointCutOffMultiplier": "1", "timeline.metrics.cluster.aggregator.daily.ttl": "63072000", http://git-wip-us.apache.org/repos/asf/ambari/blob/35e2851b/contrib/management-packs/hdf-ambari-mpack/src/main/resources/stacks/HDF/2.0/hooks/before-START/scripts/params.py ---------------------------------------------------------------------- diff --git a/contrib/management-packs/hdf-ambari-mpack/src/main/resources/stacks/HDF/2.0/hooks/before-START/scripts/params.py b/contrib/management-packs/hdf-ambari-mpack/src/main/resources/stacks/HDF/2.0/hooks/before-START/scripts/params.py index 8cc876f..223ae56 100644 --- a/contrib/management-packs/hdf-ambari-mpack/src/main/resources/stacks/HDF/2.0/hooks/before-START/scripts/params.py +++ b/contrib/management-packs/hdf-ambari-mpack/src/main/resources/stacks/HDF/2.0/hooks/before-START/scripts/params.py @@ -137,6 +137,12 @@ metrics_collection_period = default("/configurations/ams-site/timeline.metrics.s host_in_memory_aggregation = default("/configurations/ams-site/timeline.metrics.host.inmemory.aggregation", True) host_in_memory_aggregation_port = default("/configurations/ams-site/timeline.metrics.host.inmemory.aggregation.port", 61888) +is_aggregation_https_enabled = False +if default("/configurations/ams-site/timeline.metrics.host.inmemory.aggregation.http.policy", "HTTP_ONLY") == "HTTPS_ONLY": + host_in_memory_aggregation_protocol = 'https' + is_aggregation_https_enabled = True +else: + host_in_memory_aggregation_protocol = 'http' #hadoop params if has_namenode or dfs_type == 'HCFS':
