You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2014/04/23 14:23:36 UTC
[1/3] git commit: AMBARI-5494 - Ability to use custom jmx port from
*-site.xml files to get jmx metrics
Repository: ambari
Updated Branches:
refs/heads/trunk 3ad84982e -> f37d4c940
AMBARI-5494 - Ability to use custom jmx port from *-site.xml files to get jmx metrics
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/227b4792
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/227b4792
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/227b4792
Branch: refs/heads/trunk
Commit: 227b47926322e8e7bef2ae454bd7007cc3ec77e5
Parents: 3ad8498
Author: Artem Baranchuk <ab...@hortonworks.com>
Authored: Thu Apr 17 18:17:54 2014 +0300
Committer: Artem Baranchuk <ab...@hortonworks.com>
Committed: Wed Apr 23 15:23:19 2014 +0300
----------------------------------------------------------------------
.../internal/AbstractProviderModule.java | 2 +-
contrib/ambari-scom/ambari-scom-server/pom.xml | 25 +++
.../ambari/msi/AbstractResourceProvider.java | 2 +
.../ambari/msi/ConfigurationProvider.java | 155 +++++++++++++++++
.../msi/AbstractResourceProviderTest.java | 1 +
.../ambari/msi/ConfigurationProviderTest.java | 171 +++++++++++++++++++
6 files changed, 355 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/227b4792/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
index b9f48dd..b8c4714 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
@@ -171,7 +171,7 @@ public abstract class AbstractProviderModule implements ProviderModule, Resource
@Override
public ResourceProvider getResourceProvider(Resource.Type type) {
- if (!propertyProviders.containsKey(type)) {
+ if (!resourceProviders.containsKey(type)) {
registerResourceProvider(type);
}
return resourceProviders.get(type);
http://git-wip-us.apache.org/repos/asf/ambari/blob/227b4792/contrib/ambari-scom/ambari-scom-server/pom.xml
----------------------------------------------------------------------
diff --git a/contrib/ambari-scom/ambari-scom-server/pom.xml b/contrib/ambari-scom/ambari-scom-server/pom.xml
index 1e82b91..59d13d9 100644
--- a/contrib/ambari-scom/ambari-scom-server/pom.xml
+++ b/contrib/ambari-scom/ambari-scom-server/pom.xml
@@ -28,6 +28,7 @@
<url>http://maven.apache.org</url>
<properties>
<ambari.version>1.3.0-SNAPSHOT</ambari.version>
+ <powermock.version>1.5.4</powermock.version>
</properties>
<dependencies>
<dependency>
@@ -43,6 +44,25 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-junit4</artifactId>
+ <version>${powermock.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito</artifactId>
+ <version>${powermock.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-easymock</artifactId>
+ <version>${powermock.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.ambari</groupId>
<artifactId>ambari-server</artifactId>
<version>${ambari.version}</version>
@@ -52,6 +72,11 @@
<artifactId>jersey-server</artifactId>
<version>1.8</version>
</dependency>
+ <dependency>
+ <groupId>com.thoughtworks.xstream</groupId>
+ <artifactId>xstream</artifactId>
+ <version>1.4.7</version>
+ </dependency>
</dependencies>
<build>
http://git-wip-us.apache.org/repos/asf/ambari/blob/227b4792/contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/AbstractResourceProvider.java
----------------------------------------------------------------------
diff --git a/contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/AbstractResourceProvider.java b/contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/AbstractResourceProvider.java
index 5d7e3db..5fa0b6a 100644
--- a/contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/AbstractResourceProvider.java
+++ b/contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/AbstractResourceProvider.java
@@ -266,6 +266,8 @@ public abstract class AbstractResourceProvider implements ResourceProvider {
return new RequestProvider(clusterDefinition);
} else if (type.equals(Resource.Type.Task)) {
return new TaskProvider(clusterDefinition);
+ } else if (type.equals(Resource.Type.Configuration)) {
+ return new ConfigurationProvider(clusterDefinition);
} else {
return new NoOpProvider(type, clusterDefinition);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/227b4792/contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/ConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/ConfigurationProvider.java b/contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/ConfigurationProvider.java
new file mode 100644
index 0000000..0cb7672
--- /dev/null
+++ b/contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/ConfigurationProvider.java
@@ -0,0 +1,155 @@
+/**
+ * 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.
+ */
+package org.apache.ambari.msi;
+
+import com.thoughtworks.xstream.XStream;
+import com.thoughtworks.xstream.converters.Converter;
+import com.thoughtworks.xstream.converters.MarshallingContext;
+import com.thoughtworks.xstream.converters.UnmarshallingContext;
+import com.thoughtworks.xstream.io.HierarchicalStreamReader;
+import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
+import com.thoughtworks.xstream.io.xml.StaxDriver;
+import org.apache.ambari.server.controller.internal.ResourceImpl;
+import org.apache.ambari.server.controller.spi.Predicate;
+import org.apache.ambari.server.controller.spi.Request;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.utilities.PropertyHelper;
+import org.apache.commons.lang.StringUtils;
+
+import java.io.InputStream;
+import java.util.AbstractMap;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Configuration provider for a MSI defined cluster.
+ */
+public class ConfigurationProvider extends BaseResourceProvider {
+
+ protected static final String CONFIGURATION_CLUSTER_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("Config", "cluster_name");
+ public static final String CONFIGURATION_CONFIG_TYPE_PROPERTY_ID = PropertyHelper.getPropertyId(null, "type");
+ public static final String CONFIGURATION_CONFIG_TAG_PROPERTY_ID = PropertyHelper.getPropertyId(null, "tag");
+
+ private Map<String, Map<String, String>> allConfigs;
+
+ private static final String DESTINATION = "xml";
+ private static final Set<String> clusterConfigurationResources = new HashSet<String>();
+
+ static {
+ clusterConfigurationResources.add("hdfs-site");
+ clusterConfigurationResources.add("mapred-site");
+ clusterConfigurationResources.add("hbase-site");
+ clusterConfigurationResources.add("yarn-site");
+ clusterConfigurationResources.add("core-site");
+ }
+
+ // ----- AbstractResourceProvider ------------------------------------------
+
+ @Override
+ public void updateProperties(Resource resource, Request request, Predicate predicate) {
+ // Do nothing
+ }
+
+ @Override
+ public int updateProperties(Resource resource, Map<String, Object> properties) {
+ // Do nothing
+ return -1;
+ }
+
+ public ConfigurationProvider(ClusterDefinition clusterDefinition) {
+ super(Resource.Type.Configuration, clusterDefinition);
+ init();
+ initConfigurationResources();
+ }
+
+ class ScomConfigConverter implements Converter {
+ @Override
+ public void marshal(Object o, HierarchicalStreamWriter hierarchicalStreamWriter, MarshallingContext marshallingContext) {
+ }
+
+ @Override
+ public Object unmarshal(HierarchicalStreamReader hierarchicalStreamReader, UnmarshallingContext unmarshallingContext) {
+ Map<String, String> map = new HashMap<String, String>();
+
+ while (hierarchicalStreamReader.hasMoreChildren()) {
+ hierarchicalStreamReader.moveDown();
+ String name = "", value = "";
+ while (hierarchicalStreamReader.hasMoreChildren()) {
+ hierarchicalStreamReader.moveDown();
+ if ("name".equalsIgnoreCase(hierarchicalStreamReader.getNodeName())) {
+ name = hierarchicalStreamReader.getValue();
+ }
+ if ("value".equalsIgnoreCase(hierarchicalStreamReader.getNodeName())) {
+ value = hierarchicalStreamReader.getValue();
+ }
+ hierarchicalStreamReader.moveUp();
+ }
+
+ if (StringUtils.isNotEmpty(name) && StringUtils.isNotEmpty(value)) {
+ map.put(name, value);
+ }
+ hierarchicalStreamReader.moveUp();
+ }
+
+ return map;
+ }
+
+ @Override
+ public boolean canConvert(Class aClass) {
+ return AbstractMap.class.isAssignableFrom(aClass);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void init() {
+ allConfigs = new HashMap<String, Map<String, String>>();
+
+ XStream xstream = new XStream(new StaxDriver());
+ xstream.alias("configuration", Map.class);
+ xstream.registerConverter(new ScomConfigConverter());
+
+ for (String configurationResource : clusterConfigurationResources) {
+ String configFileName = configurationResource + "." + DESTINATION;
+ InputStream is = ClassLoader.getSystemResourceAsStream(configFileName);
+ if (is == null) continue;
+ Map<String, String> properties = (HashMap<String, String>) xstream.fromXML(is);
+ allConfigs.put(configurationResource, properties);
+ }
+ }
+
+ private void initConfigurationResources() {
+ String clusterName = getClusterDefinition().getClusterName();
+
+ for (String type : allConfigs.keySet()) {
+ Resource resource = new ResourceImpl(Resource.Type.Configuration);
+ resource.setProperty(CONFIGURATION_CLUSTER_NAME_PROPERTY_ID, clusterName);
+ resource.setProperty(CONFIGURATION_CONFIG_TYPE_PROPERTY_ID, type);
+ resource.setProperty(CONFIGURATION_CONFIG_TAG_PROPERTY_ID, "version1");
+
+ Map<String, String> properties = allConfigs.get(type);
+ for (Map.Entry<String, String> entry : properties.entrySet()) {
+ String id = PropertyHelper.getPropertyId("properties", entry.getKey());
+ resource.setProperty(id, entry.getValue());
+ }
+
+ addResource(resource);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/227b4792/contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/AbstractResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/AbstractResourceProviderTest.java b/contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/AbstractResourceProviderTest.java
index f4e2446..dc5999b 100644
--- a/contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/AbstractResourceProviderTest.java
+++ b/contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/AbstractResourceProviderTest.java
@@ -43,6 +43,7 @@ public class AbstractResourceProviderTest {
types.add(Resource.Type.HostComponent);
types.add(Resource.Type.Request);
types.add(Resource.Type.Task);
+ types.add(Resource.Type.Configuration);
}
@Test
http://git-wip-us.apache.org/repos/asf/ambari/blob/227b4792/contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/ConfigurationProviderTest.java
----------------------------------------------------------------------
diff --git a/contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/ConfigurationProviderTest.java b/contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/ConfigurationProviderTest.java
new file mode 100644
index 0000000..bfa7a87
--- /dev/null
+++ b/contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/ConfigurationProviderTest.java
@@ -0,0 +1,171 @@
+/**
+ * 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.
+ */
+
+package org.apache.ambari.msi;
+
+import com.thoughtworks.xstream.XStream;
+import com.thoughtworks.xstream.io.xml.StaxDriver;
+import org.apache.ambari.server.controller.spi.Predicate;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.utilities.PredicateBuilder;
+import org.apache.ambari.server.controller.utilities.PropertyHelper;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.powermock.api.easymock.PowerMock;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import static org.easymock.EasyMock.*;
+
+/**
+ * Tests for ConfigurationProvider.
+ */
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ConfigurationProvider.class, StaxDriver.class, XStream.class, ClassLoader.class, InputStream.class})
+public class ConfigurationProviderTest {
+
+ @Test
+ public void testConfigurationProvider_init_method_file_doesnt_exists() throws Exception {
+ ClusterDefinition clusterDefinitionMock = createStrictMock(ClusterDefinition.class);
+ PowerMock.suppress(PowerMock.methods(ConfigurationProvider.class, "initConfigurationResources"));
+
+ StaxDriver staxDriver = PowerMock.createStrictMock(StaxDriver.class);
+ XStream xstream = PowerMock.createStrictMock(XStream.class);
+
+ PowerMock.expectNew(StaxDriver.class).andReturn(staxDriver);
+ PowerMock.expectNew(XStream.class, staxDriver).andReturn(xstream);
+ xstream.alias("configuration", Map.class);
+ expectLastCall();
+ xstream.registerConverter(anyObject(ConfigurationProvider.ScomConfigConverter.class));
+ expectLastCall();
+
+ PowerMock.replay(staxDriver, StaxDriver.class, xstream, XStream.class);
+ replay(clusterDefinitionMock);
+ new ConfigurationProvider(clusterDefinitionMock);
+ PowerMock.verify(staxDriver, StaxDriver.class, xstream, XStream.class);
+ verify(clusterDefinitionMock);
+ }
+
+ @Test
+ public void testConfigurationProvider_init_method_file_exists() throws Exception {
+ ClusterDefinition clusterDefinitionMock = createStrictMock(ClusterDefinition.class);
+ PowerMock.suppress(PowerMock.methods(ConfigurationProvider.class, "initConfigurationResources"));
+
+ StaxDriver staxDriver = PowerMock.createStrictMock(StaxDriver.class);
+ XStream xstream = PowerMock.createStrictMock(XStream.class);
+ PowerMock.mockStatic(ClassLoader.class);
+ InputStream mockInputStream = createMock(InputStream.class);
+
+
+ PowerMock.expectNew(StaxDriver.class).andReturn(staxDriver);
+ PowerMock.expectNew(XStream.class, staxDriver).andReturn(xstream);
+ xstream.alias("configuration", Map.class);
+ expectLastCall();
+ xstream.registerConverter(anyObject(ConfigurationProvider.ScomConfigConverter.class));
+ expectLastCall();
+ expect(ClassLoader.getSystemResourceAsStream(anyObject(String.class))).andReturn(mockInputStream).times(5);
+ expect(xstream.fromXML(mockInputStream)).andReturn(new HashMap<String, String>()).times(5);
+
+ PowerMock.replay(staxDriver, StaxDriver.class, xstream, XStream.class, ClassLoader.class);
+ replay(clusterDefinitionMock, mockInputStream);
+
+ new ConfigurationProvider(clusterDefinitionMock);
+
+ PowerMock.verify(staxDriver, StaxDriver.class, xstream, XStream.class, ClassLoader.class);
+ verify(clusterDefinitionMock, mockInputStream);
+ }
+
+ @Test
+ public void testConfigurationProvider_initConfigurationResources_method() throws Exception {
+ ClusterDefinition clusterDefinitionMock = createStrictMock(ClusterDefinition.class);
+ StaxDriver staxDriver = PowerMock.createStrictMock(StaxDriver.class);
+ XStream xstream = PowerMock.createStrictMock(XStream.class);
+ PowerMock.mockStatic(ClassLoader.class);
+ InputStream mockInputStream = createMock(InputStream.class);
+
+
+ PowerMock.expectNew(StaxDriver.class).andReturn(staxDriver);
+ PowerMock.expectNew(XStream.class, staxDriver).andReturn(xstream);
+ xstream.alias("configuration", Map.class);
+ expectLastCall();
+ xstream.registerConverter(anyObject(ConfigurationProvider.ScomConfigConverter.class));
+ expectLastCall();
+ expect(ClassLoader.getSystemResourceAsStream(anyObject(String.class))).andReturn(mockInputStream).times(5);
+ expect(xstream.fromXML(mockInputStream)).andReturn(new HashMap<String, String>() {{
+ put("property_key", "propery_value");
+ }}).times(5);
+
+ expect(clusterDefinitionMock.getClusterName()).andReturn("ambari");
+
+ PowerMock.replay(staxDriver, StaxDriver.class, xstream, XStream.class, ClassLoader.class);
+ replay(clusterDefinitionMock, mockInputStream);
+
+ ConfigurationProvider configurationProvider = new ConfigurationProvider(clusterDefinitionMock);
+
+ PowerMock.verify(staxDriver, StaxDriver.class, xstream, XStream.class, ClassLoader.class);
+ verify(clusterDefinitionMock, mockInputStream);
+
+ Assert.assertEquals(5, configurationProvider.getResources().size());
+ }
+
+ @Test
+ public void testGetResourcesWithPredicate() throws Exception {
+ ClusterDefinition clusterDefinitionMock = createStrictMock(ClusterDefinition.class);
+ StaxDriver staxDriver = PowerMock.createStrictMock(StaxDriver.class);
+ XStream xstream = PowerMock.createStrictMock(XStream.class);
+ PowerMock.mockStatic(ClassLoader.class);
+ InputStream mockInputStream = createMock(InputStream.class);
+
+
+ PowerMock.expectNew(StaxDriver.class).andReturn(staxDriver);
+ PowerMock.expectNew(XStream.class, staxDriver).andReturn(xstream);
+ xstream.alias("configuration", Map.class);
+ expectLastCall();
+ xstream.registerConverter(anyObject(ConfigurationProvider.ScomConfigConverter.class));
+ expectLastCall();
+ expect(ClassLoader.getSystemResourceAsStream(anyObject(String.class))).andReturn(mockInputStream).times(5);
+ expect(xstream.fromXML(mockInputStream)).andReturn(new HashMap<String, String>() {{
+ put("property_key", "propery_value");
+ }}).times(5);
+
+ expect(clusterDefinitionMock.getClusterName()).andReturn("ambari");
+
+ PowerMock.replay(staxDriver, StaxDriver.class, xstream, XStream.class, ClassLoader.class);
+ replay(clusterDefinitionMock, mockInputStream);
+
+ ConfigurationProvider configurationProvider = new ConfigurationProvider(clusterDefinitionMock);
+
+ PowerMock.verify(staxDriver, StaxDriver.class, xstream, XStream.class, ClassLoader.class);
+ verify(clusterDefinitionMock, mockInputStream);
+
+ Predicate configPredicate = new PredicateBuilder().property
+ (ConfigurationProvider.CONFIGURATION_CLUSTER_NAME_PROPERTY_ID).equals("ambari").and()
+ .property(ConfigurationProvider.CONFIGURATION_CONFIG_TYPE_PROPERTY_ID).equals("yarn-site").and()
+ .property(ConfigurationProvider.CONFIGURATION_CONFIG_TAG_PROPERTY_ID).equals("version1").toPredicate();
+
+ Set<Resource> resources = configurationProvider.getResources(PropertyHelper.getReadRequest(), configPredicate);
+ Assert.assertNotNull(resources);
+ Assert.assertEquals(1, resources.size());
+ }
+}
[3/3] git commit: AMBARI-5527 - Support SSL in configs.sh
Posted by ab...@apache.org.
AMBARI-5527 - Support SSL in configs.sh
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f37d4c94
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f37d4c94
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f37d4c94
Branch: refs/heads/trunk
Commit: f37d4c940a7aa41c5046a9604e7bb545a0afab62
Parents: d396b8f
Author: Artem Baranchuk <ab...@hortonworks.com>
Authored: Tue Apr 22 16:46:00 2014 +0300
Committer: Artem Baranchuk <ab...@hortonworks.com>
Committed: Wed Apr 23 15:23:20 2014 +0300
----------------------------------------------------------------------
.../src/main/resources/scripts/configs.sh | 26 +++++++++++++-------
1 file changed, 17 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/f37d4c94/ambari-server/src/main/resources/scripts/configs.sh
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/scripts/configs.sh b/ambari-server/src/main/resources/scripts/configs.sh
index 4e80dca..a07ffb2 100755
--- a/ambari-server/src/main/resources/scripts/configs.sh
+++ b/ambari-server/src/main/resources/scripts/configs.sh
@@ -19,11 +19,12 @@
#
usage () {
- echo "Usage: configs.sh [-u userId] [-p password] [-port port] <ACTION> <AMBARI_HOST> <CLUSTER_NAME> <CONFIG_TYPE> [CONFIG_FILENAME | CONFIG_KEY [CONFIG_VALUE]]";
+ echo "Usage: configs.sh [-u userId] [-p password] [-port port] [-s] <ACTION> <AMBARI_HOST> <CLUSTER_NAME> <CONFIG_TYPE> [CONFIG_FILENAME | CONFIG_KEY [CONFIG_VALUE]]";
echo "";
echo " [-u userId]: Optional user ID to use for authentication. Default is 'admin'.";
echo " [-p password]: Optional password to use for authentication. Default is 'admin'.";
echo " [-port port]: Optional port number for Ambari server. Default is '8080'. Provide empty string to not use port.";
+ echo " [-s]: Optional support of SSL. Default is 'false'. Provide empty string to not use SSL.";
echo " <ACTION>: One of 'get', 'set', 'delete'. 'Set' adds/updates as necessary.";
echo " <AMBARI_HOST>: Server external host name";
echo " <CLUSTER_NAME>: Name given to cluster. Ex: 'c1'"
@@ -37,6 +38,7 @@ usage () {
USERID="admin"
PASSWD="admin"
PORT=":8080"
+SSL_URL_PREFIX=""
if [ "$1" == "-u" ] ; then
USERID=$2;
@@ -60,7 +62,13 @@ if [ "$1" == "-port" ] ; then
echo "PORT=$PORT";
fi
-AMBARIURL="http://$2$PORT"
+if [ "$1" == "-s" ] ; then
+ SSL_URL_PREFIX="s"
+ shift;
+ echo "SSL is enabled";
+fi
+
+AMBARIURL="http$SSL_URL_PREFIX://$2$PORT"
CLUSTER=$3
SITE=$4
SITETAG=''
@@ -75,7 +83,7 @@ currentSiteTag () {
found=''
#currentSite=`cat ds.json | grep -E "$SITE|tag"`;
- currentSite=`curl -s -u $USERID:$PASSWD "$AMBARIURL/api/v1/clusters/$CLUSTER?fields=Clusters/desired_configs" | grep -E "$SITE|tag"`;
+ currentSite=`curl -k -s -u $USERID:$PASSWD "$AMBARIURL/api/v1/clusters/$CLUSTER?fields=Clusters/desired_configs" | grep -E "$SITE|tag"`;
for line in $currentSite; do
if [ $line != "{" -a $line != ":" -a $line != '"tag"' ] ; then
if [ -n "$found" -a -z "$currentSiteTag" ]; then
@@ -87,9 +95,9 @@ currentSiteTag () {
fi
done;
if [ -z $currentSiteTag ]; then
- errOutput=`curl -s -u $USERID:$PASSWD "$AMBARIURL/api/v1/clusters/$CLUSTER?fields=Clusters/desired_configs"`;
+ errOutput=`curl -k -s -u $USERID:$PASSWD "$AMBARIURL/api/v1/clusters/$CLUSTER?fields=Clusters/desired_configs"`;
echo "[ERROR] \"$SITE\" not found in server response.";
- echo "[ERROR] Output of \`curl -s -u $USERID:$PASSWD \"$AMBARIURL/api/v1/clusters/$CLUSTER?fields=Clusters/desired_configs\"\` is:";
+ echo "[ERROR] Output of \`curl -k -s -u $USERID:$PASSWD \"$AMBARIURL/api/v1/clusters/$CLUSTER?fields=Clusters/desired_configs\"\` is:";
echo $errOutput | while read -r line; do
echo "[ERROR] $line";
done;
@@ -108,7 +116,7 @@ doConfigUpdate () {
currentSiteTag
echo "########## Performing '$MODE' $CONFIGKEY:$CONFIGVALUE on (Site:$SITE, Tag:$SITETAG)";
propertiesStarted=0;
- curl -s -u $USERID:$PASSWD "$AMBARIURL/api/v1/clusters/$CLUSTER/configurations?type=$SITE&tag=$SITETAG" | while read -r line; do
+ curl -k -s -u $USERID:$PASSWD "$AMBARIURL/api/v1/clusters/$CLUSTER/configurations?type=$SITE&tag=$SITETAG" | while read -r line; do
## echo ">>> $line";
if [ "$propertiesStarted" -eq 0 -a "`echo $line | grep "\"properties\""`" ]; then
propertiesStarted=1
@@ -136,7 +144,7 @@ doConfigUpdate () {
newFile="doSet_$newTag.json"
echo "########## PUTting json into: $newFile"
echo $finalJson > $newFile
- curl -u $USERID:$PASSWD -X PUT -H "X-Requested-By: ambari" "$AMBARIURL/api/v1/clusters/$CLUSTER" --data @$newFile
+ curl -k -u $USERID:$PASSWD -X PUT -H "X-Requested-By: ambari" "$AMBARIURL/api/v1/clusters/$CLUSTER" --data @$newFile
currentSiteTag
echo "########## NEW Site:$SITE, Tag:$SITETAG";
elif [ "`echo $line | grep "\"$CONFIGKEY\""`" ]; then
@@ -163,7 +171,7 @@ doConfigFileUpdate () {
newFile="$FILENAME"
echo $finalJson>$newFile
echo "########## PUTting file:\"$FILENAME\" into config(type:\"$SITE\", tag:$newTag) via $newFile"
- curl -u $USERID:$PASSWD -X PUT -H "X-Requested-By: ambari" "$AMBARIURL/api/v1/clusters/$CLUSTER" --data @$newFile
+ curl -k -u $USERID:$PASSWD -X PUT -H "X-Requested-By: ambari" "$AMBARIURL/api/v1/clusters/$CLUSTER" --data @$newFile
currentSiteTag
echo "########## NEW Site:$SITE, Tag:$SITETAG";
else
@@ -193,7 +201,7 @@ doGet () {
currentSiteTag
echo "########## Performing 'GET' on (Site:$SITE, Tag:$SITETAG)";
propertiesStarted=0;
- curl -s -u $USERID:$PASSWD "$AMBARIURL/api/v1/clusters/$CLUSTER/configurations?type=$SITE&tag=$SITETAG" | while read -r line; do
+ curl -k -s -u $USERID:$PASSWD "$AMBARIURL/api/v1/clusters/$CLUSTER/configurations?type=$SITE&tag=$SITETAG" | while read -r line; do
## echo ">>> $line";
if [ "$propertiesStarted" -eq 0 -a "`echo $line | grep "\"properties\""`" ]; then
propertiesStarted=1
[2/3] git commit: AMBARI-5495 - Update NODEMANAGER metrics for Hadoop
2
Posted by ab...@apache.org.
AMBARI-5495 - Update NODEMANAGER metrics for Hadoop 2
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d396b8f9
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d396b8f9
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d396b8f9
Branch: refs/heads/trunk
Commit: d396b8f955dc9b83098ac3efa95d04572edc9552
Parents: 227b479
Author: Artem Baranchuk <ab...@hortonworks.com>
Authored: Thu Apr 17 18:53:30 2014 +0300
Committer: Artem Baranchuk <ab...@hortonworks.com>
Committed: Wed Apr 23 15:23:20 2014 +0300
----------------------------------------------------------------------
.../main/resources/sqlserver_properties.json | 36 ++++++++++----------
1 file changed, 18 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d396b8f9/contrib/ambari-scom/ambari-scom-server/src/main/resources/sqlserver_properties.json
----------------------------------------------------------------------
diff --git a/contrib/ambari-scom/ambari-scom-server/src/main/resources/sqlserver_properties.json b/contrib/ambari-scom/ambari-scom-server/src/main/resources/sqlserver_properties.json
index fc552e9..3deac0c 100644
--- a/contrib/ambari-scom/ambari-scom-server/src/main/resources/sqlserver_properties.json
+++ b/contrib/ambari-scom/ambari-scom-server/src/main/resources/sqlserver_properties.json
@@ -11628,7 +11628,7 @@
"temporal": true
},
"metrics/yarn/ContainersCompleted": {
- "metric": "yarn.ContainersCompleted",
+ "metric": "yarn.NodeManagerMetrics.ContainersCompleted",
"pointInTime": true,
"temporal": true
},
@@ -11643,7 +11643,7 @@
"temporal": true
},
"metrics/yarn/ContainersKilled": {
- "metric": "yarn.ContainersKilled",
+ "metric": "yarn.NodeManagerMetrics.ContainersKilled",
"pointInTime": true,
"temporal": true
},
@@ -11698,7 +11698,7 @@
"temporal": true
},
"metrics/yarn/AllocatedGB": {
- "metric": "yarn.AllocatedGB",
+ "metric": "yarn.NodeManagerMetrics.AllocatedGB",
"pointInTime": true,
"temporal": true
},
@@ -11733,7 +11733,7 @@
"temporal": true
},
"metrics/yarn/ContainersFailed": {
- "metric": "yarn.ContainersFailed",
+ "metric": "yarn.NodeManagerMetrics.ContainersFailed",
"pointInTime": true,
"temporal": true
},
@@ -11758,7 +11758,7 @@
"temporal": true
},
"metrics/yarn/AllocatedContainers": {
- "metric": "yarn.AllocatedContainers",
+ "metric": "yarn.NodeManagerMetrics.AllocatedContainers",
"pointInTime": true,
"temporal": true
},
@@ -11828,7 +11828,7 @@
"temporal": true
},
"metrics/yarn/ContainersRunning": {
- "metric": "yarn.ContainersRunning",
+ "metric": "yarn.NodeManagerMetrics.ContainersRunning",
"pointInTime": true,
"temporal": true
},
@@ -11843,7 +11843,7 @@
"temporal": true
},
"metrics/yarn/ContainersLaunched": {
- "metric": "yarn.ContainersLaunched",
+ "metric": "yarn.NodeManagerMetrics.ContainersLaunched",
"pointInTime": true,
"temporal": true
},
@@ -11863,7 +11863,7 @@
"temporal": true
},
"metrics/yarn/AvailableGB": {
- "metric": "yarn.AvailableGB",
+ "metric": "yarn.NodeManagerMetrics.AvailableGB",
"pointInTime": true,
"temporal": true
},
@@ -11878,7 +11878,7 @@
"temporal": true
},
"metrics/yarn/ContainersIniting": {
- "metric": "yarn.ContainersIniting",
+ "metric": "yarn.NodeManagerMetrics.ContainersIniting",
"pointInTime": true,
"temporal": true
},
@@ -22365,7 +22365,7 @@
"temporal": true
},
"metrics/yarn/ContainersCompleted": {
- "metric": "yarn.ContainersCompleted",
+ "metric": "yarn.NodeManagerMetrics.ContainersCompleted",
"pointInTime": true,
"temporal": true
},
@@ -22380,7 +22380,7 @@
"temporal": true
},
"metrics/yarn/ContainersKilled": {
- "metric": "yarn.ContainersKilled",
+ "metric": "yarn.NodeManagerMetrics.ContainersKilled",
"pointInTime": true,
"temporal": true
},
@@ -22435,7 +22435,7 @@
"temporal": true
},
"metrics/yarn/AllocatedGB": {
- "metric": "yarn.AllocatedGB",
+ "metric": "yarn.NodeManagerMetrics.AllocatedGB",
"pointInTime": true,
"temporal": true
},
@@ -22470,7 +22470,7 @@
"temporal": true
},
"metrics/yarn/ContainersFailed": {
- "metric": "yarn.ContainersFailed",
+ "metric": "yarn.NodeManagerMetrics.ContainersFailed",
"pointInTime": true,
"temporal": true
},
@@ -22495,7 +22495,7 @@
"temporal": true
},
"metrics/yarn/AllocatedContainers": {
- "metric": "yarn.AllocatedContainers",
+ "metric": "yarn.NodeManagerMetrics.AllocatedContainers",
"pointInTime": true,
"temporal": true
},
@@ -22565,7 +22565,7 @@
"temporal": true
},
"metrics/yarn/ContainersRunning": {
- "metric": "yarn.ContainersRunning",
+ "metric": "yarn.NodeManagerMetrics.ContainersRunning",
"pointInTime": true,
"temporal": true
},
@@ -22580,7 +22580,7 @@
"temporal": true
},
"metrics/yarn/ContainersLaunched": {
- "metric": "yarn.ContainersLaunched",
+ "metric": "yarn.NodeManagerMetrics.ContainersLaunched",
"pointInTime": true,
"temporal": true
},
@@ -22600,7 +22600,7 @@
"temporal": true
},
"metrics/yarn/AvailableGB": {
- "metric": "yarn.AvailableGB",
+ "metric": "yarn.NodeManagerMetrics.AvailableGB",
"pointInTime": true,
"temporal": true
},
@@ -22615,7 +22615,7 @@
"temporal": true
},
"metrics/yarn/ContainersIniting": {
- "metric": "yarn.ContainersIniting",
+ "metric": "yarn.NodeManagerMetrics.ContainersIniting",
"pointInTime": true,
"temporal": true
},