ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject ambari git commit: AMBARI-15606 Ambari API does not return HDFS RPC metrics based on ports (dsen)
Date Tue, 29 Mar 2016 12:27:16 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 58bc44f3f -> 172d02aa4


AMBARI-15606 Ambari API does not return HDFS RPC metrics based on ports (dsen)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/172d02aa
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/172d02aa
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/172d02aa

Branch: refs/heads/trunk
Commit: 172d02aa48710ea0625e99d37d9830acf82fb13d
Parents: 58bc44f
Author: Dmytro Sen <dsen@apache.org>
Authored: Tue Mar 29 15:26:59 2016 +0300
Committer: Dmytro Sen <dsen@apache.org>
Committed: Tue Mar 29 15:26:59 2016 +0300

----------------------------------------------------------------------
 .../server/api/services/AmbariMetaInfo.java     |  54 +-
 .../internal/AbstractProviderModule.java        | 128 ++++-
 .../server/controller/jmx/JMXHostProvider.java  |  13 +-
 .../controller/jmx/JMXPropertyProvider.java     |   9 +-
 .../controller/utilities/PropertyHelper.java    |  23 +-
 .../apache/ambari/server/utils/AmbariPath.java  |   2 +-
 .../StackDefinedPropertyProviderTest.java       | 557 ++++++++++---------
 .../metrics/JMXPropertyProviderTest.java        |   5 +
 .../utilities/PropertyHelperTest.java           |  57 +-
 9 files changed, 503 insertions(+), 345 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/172d02aa/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
index 434aa96..0f09d94 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
@@ -908,39 +908,35 @@ public class AmbariMetaInfo {
         for (Map.Entry<String, List<MetricDefinition>> metricDefEntry : componentMetricDefEntry.getValue().entrySet()) {
           //For every metric definition
           for (MetricDefinition metricDefinition : metricDefEntry.getValue()) {
-            // Metrics System metrics only
-            if (metricDefinition.getType().equals("ganglia")) {
-              for (Map.Entry<String, Map<String, Metric>> metricByCategory : metricDefinition.getMetricsByCategory().entrySet()) {
-                String category = metricByCategory.getKey();
-                Iterator<Map.Entry<String, Metric>> iterator = metricByCategory.getValue().entrySet().iterator();
-                Map<String, Metric> newMetricsToAdd = new HashMap<>();
-
-                while (iterator.hasNext()) {
-                  Map.Entry<String, Metric> metricEntry = iterator.next();
-                  // Process Namenode rpc metrics
-                  Map<String, Metric> replacementMetrics = PropertyHelper.processRpcMetricDefinition(
-                    componentName, metricEntry.getKey(), metricEntry.getValue());
-                  if (replacementMetrics != null) {
-                    iterator.remove(); // Remove current metric entry
-                    newMetricsToAdd.putAll(replacementMetrics);
-                    // Add aggregate functions for replacement metrics
-                    if (metricDefEntry.getKey().equals(Component.name())) {
-                      for (Map.Entry<String, Metric> replacementMetric : replacementMetrics.entrySet()) {
-                        newMetricsToAdd.putAll(getAggregateFunctionMetrics(replacementMetric.getKey(),
-                          replacementMetric.getValue()));
-                      }
-                    }
-                  } else {
-                    // NOTE: Only Component aggregates supported for now.
-                    if (metricDefEntry.getKey().equals(Component.name())) {
-                      Map<String, Metric> aggregateFunctionMetrics =
-                        getAggregateFunctionMetrics(metricEntry.getKey(), metricEntry.getValue());
-                      newMetricsToAdd.putAll(aggregateFunctionMetrics);
+            for (Map.Entry<String, Map<String, Metric>> metricByCategory : metricDefinition.getMetricsByCategory().entrySet()) {
+              Iterator<Map.Entry<String, Metric>> iterator = metricByCategory.getValue().entrySet().iterator();
+              Map<String, Metric> newMetricsToAdd = new HashMap<>();
+
+              while (iterator.hasNext()) {
+                Map.Entry<String, Metric> metricEntry = iterator.next();
+                // Process Namenode rpc metrics
+                Map<String, Metric> replacementMetrics = PropertyHelper.processRpcMetricDefinition(metricDefinition.getType(),
+                  componentName, metricEntry.getKey(), metricEntry.getValue());
+                if (replacementMetrics != null) {
+                  iterator.remove(); // Remove current metric entry
+                  newMetricsToAdd.putAll(replacementMetrics);
+                  // Add aggregate functions for replacement metrics
+                  if (metricDefEntry.getKey().equals(Component.name())) {
+                    for (Map.Entry<String, Metric> replacementMetric : replacementMetrics.entrySet()) {
+                      newMetricsToAdd.putAll(getAggregateFunctionMetrics(replacementMetric.getKey(),
+                        replacementMetric.getValue()));
                     }
                   }
+                } else {
+                  // NOTE: Only Component aggregates supported for now.
+                  if (metricDefEntry.getKey().equals(Component.name())) {
+                    Map<String, Metric> aggregateFunctionMetrics =
+                      getAggregateFunctionMetrics(metricEntry.getKey(), metricEntry.getValue());
+                    newMetricsToAdd.putAll(aggregateFunctionMetrics);
+                  }
                 }
-                metricByCategory.getValue().putAll(newMetricsToAdd);
               }
+              metricByCategory.getValue().putAll(newMetricsToAdd);
             }
           }
         }

http://git-wip-us.apache.org/repos/asf/ambari/blob/172d02aa/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 30e5b9c..b77fda2 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
@@ -99,6 +99,8 @@ public abstract class AbstractProviderModule implements ProviderModule,
   private static boolean vipHostConfigPresent = false;
 
   private static final Map<String, Map<String, String[]>> jmxDesiredProperties = new HashMap<String, Map<String, String[]>>();
+  private static final Map<String, Map<String, String[]>> jmxDesiredRpcSuffixProperties = new ConcurrentHashMap<>();
+  private volatile Map<String, Map<String, Map<String, String>>> jmxDesiredRpcSuffixes = new HashMap<String, Map<String, Map<String,String>>>();
   private volatile Map<String, String> clusterHdfsSiteConfigVersionMap = new HashMap<String, String>();
   private volatile Map<String, String> clusterJmxProtocolMap = new HashMap<String, String>();
   private volatile Set<String> metricServerHosts = new HashSet<String>();
@@ -108,7 +110,6 @@ public abstract class AbstractProviderModule implements ProviderModule,
 
   static {
     serviceConfigTypes.put(Service.Type.HDFS, "hdfs-site");
-    serviceConfigTypes.put(Service.Type.MAPREDUCE, "mapred-site");
     serviceConfigTypes.put(Service.Type.HBASE, "hbase-site");
     serviceConfigTypes.put(Service.Type.YARN, "yarn-site");
     serviceConfigTypes.put(Service.Type.MAPREDUCE2, "mapred-site");
@@ -117,8 +118,6 @@ public abstract class AbstractProviderModule implements ProviderModule,
     componentServiceMap.put("NAMENODE", Service.Type.HDFS);
     componentServiceMap.put("DATANODE", Service.Type.HDFS);
     componentServiceMap.put("JOURNALNODE", Service.Type.HDFS);
-    componentServiceMap.put("JOBTRACKER", Service.Type.MAPREDUCE);
-    componentServiceMap.put("TASKTRACKER", Service.Type.MAPREDUCE);
     componentServiceMap.put("HBASE_MASTER", Service.Type.HBASE);
     componentServiceMap.put("RESOURCEMANAGER", Service.Type.YARN);
     componentServiceMap.put("NODEMANAGER", Service.Type.YARN);
@@ -134,10 +133,6 @@ public abstract class AbstractProviderModule implements ProviderModule,
     initPropMap.put("JOURNALNODE", new String[]{"dfs.journalnode.http-address"});
     serviceDesiredProperties.put(Service.Type.HDFS, initPropMap);
 
-    initPropMap = new HashMap<String, String[]>();
-    initPropMap.put("JOBTRACKER", new String[]{"mapred.job.tracker.http.address"});
-    initPropMap.put("TASKTRACKER", new String[]{"mapred.task.tracker.http.address"});
-    serviceDesiredProperties.put(Service.Type.MAPREDUCE, initPropMap);
 
     initPropMap = new HashMap<String, String[]>();
     initPropMap.put("HBASE_MASTER", new String[]{"hbase.master.info.port"});
@@ -164,6 +159,18 @@ public abstract class AbstractProviderModule implements ProviderModule,
     initPropMap = new HashMap<String, String[]>();
     initPropMap.put("RESOURCEMANAGER", new String[]{"yarn.http.policy"});
     jmxDesiredProperties.put("RESOURCEMANAGER", initPropMap);
+
+    initPropMap = new HashMap<String, String[]>();
+    initPropMap.put("client", new String[]{"dfs.namenode.rpc-address"});
+    initPropMap.put("datanode", new String[]{"dfs.namenode.servicerpc-address"});
+    initPropMap.put("healthcheck", new String[]{"dfs.namenode.lifeline.rpc-address"});
+    jmxDesiredRpcSuffixProperties.put("NAMENODE", initPropMap);
+
+    initPropMap = new HashMap<String, String[]>();
+    initPropMap.put("client", new String[]{"dfs.namenode.rpc-address.%s.%s"});
+    initPropMap.put("datanode", new String[]{"dfs.namenode.servicerpc-address.%s.%s"});
+    initPropMap.put("healthcheck", new String[]{"dfs.namenode.lifeline.rpc-address.%s.%s"});
+    jmxDesiredRpcSuffixProperties.put("NAMENODE-HA", initPropMap);
   }
 
   /**
@@ -552,6 +559,8 @@ public abstract class AbstractProviderModule implements ProviderModule,
               clusterJmxPorts.get(hostName).put(entry.getKey(), portString);
             }
           }
+
+          initRpcSuffixes(clusterName, componentName, configType, currVersion, hostName);
         }
       } catch (Exception e) {
         LOG.error("Exception initializing jmx port maps. ", e);
@@ -577,38 +586,40 @@ public abstract class AbstractProviderModule implements ProviderModule,
    * for different configurations(like NAMENODE HA).
    * @param service service type
    * @param componentName component name
-   * @param hostName host which contain requested component
+   * @param hostName host which contains requested component
    * @param properties properties which used for special cases(like NAMENODE HA)
    * @param httpsEnabled indicates if https enabled for component
    * @return property name that contain port for {@code componentName} on {@code hostName}
    */
   String[] getPortProperties(Service.Type service, String componentName, String hostName, Map<String, Object> properties, boolean httpsEnabled) {
     componentName = httpsEnabled ? componentName + "-HTTPS" : componentName;
+    if(componentName.startsWith("NAMENODE") && properties.containsKey("dfs.nameservices")) {
+      componentName += "-HA";
+      return getNamenodeHaProperty(properties, serviceDesiredProperties.get(service).get(componentName), hostName);
+    }
+    return serviceDesiredProperties.get(service).get(componentName);
+  }
 
-    if(componentName.equals("NAMENODE")) {
-      // iterate over nameservices and namenodes, to find out namenode http(s) property for concrete host
-      if(properties.containsKey("dfs.nameservices")) {
-        for(String nameserviceId : ((String)properties.get("dfs.nameservices")).split(",")) {
-          String haComponentName = componentName + "-HA";
-          if(properties.containsKey("dfs.ha.namenodes."+nameserviceId)) {
-            for (String namenodeId : ((String)properties.get("dfs.ha.namenodes." + nameserviceId)).split(",")) {
-              String propertyName = String.format(
-                  serviceDesiredProperties.get(service).get(haComponentName)[0],
-                  nameserviceId,
-                  namenodeId
-              );
-              if (properties.containsKey(propertyName)) {
-                String propertyValue = (String)properties.get(propertyName);
-                if (propertyValue.split(":")[0].equals(hostName)) {
-                  return new String[]{propertyName};
-                }
-              }
+  private String[] getNamenodeHaProperty(Map<String, Object> properties, String pattern[], String hostName) {
+    // iterate over nameservices and namenodes, to find out namenode http(s) property for concrete host
+    for(String nameserviceId : ((String)properties.get("dfs.nameservices")).split(",")) {
+      if(properties.containsKey("dfs.ha.namenodes."+nameserviceId)) {
+        for (String namenodeId : ((String)properties.get("dfs.ha.namenodes." + nameserviceId)).split(",")) {
+          String propertyName = String.format(
+            pattern[0],
+            nameserviceId,
+            namenodeId
+          );
+          if (properties.containsKey(propertyName)) {
+            String propertyValue = (String)properties.get(propertyName);
+            if (propertyValue.split(":")[0].equals(hostName)) {
+              return new String[] {propertyName};
             }
           }
         }
       }
     }
-    return serviceDesiredProperties.get(service).get(componentName);
+    return pattern;
   }
 
   /**
@@ -980,8 +991,9 @@ public abstract class AbstractProviderModule implements ProviderModule,
 
   // TODO get configs using ConfigHelper
   private Map<String, String> getDesiredConfigMap(String clusterName, String versionTag,
-                                                  String configType, Map<String, String[]> keys, Map<String, Object> configProperties) throws NoSuchParentResourceException,
-      UnsupportedPropertyException, SystemException {
+                                                  String configType, Map<String, String[]> keys,
+                                                  Map<String, Object> configProperties)
+    throws NoSuchParentResourceException, UnsupportedPropertyException, SystemException {
     if(configProperties == null) {
       configProperties = getConfigProperties(clusterName, versionTag, configType);
     }
@@ -1167,4 +1179,62 @@ public abstract class AbstractProviderModule implements ProviderModule,
       return "http";
   }
 
+  @Override
+  public String getJMXRpcMetricTag(String clusterName, String componentName, String port){
+    Map<String, Map<String, String>> componentToPortsMap = jmxDesiredRpcSuffixes.get(clusterName);
+    if (componentToPortsMap != null && componentToPortsMap.containsKey(componentName)) {
+      Map<String, String> portToTagMap = componentToPortsMap.get(componentName);
+      if (portToTagMap != null) {
+        return portToTagMap.get(port);
+      }
+    }
+    return null;
+  }
+
+  private void initRpcSuffixes(String clusterName, String componentName,
+                               String config, String configVersion,
+                               String hostName)
+                              throws Exception {
+    if (jmxDesiredRpcSuffixProperties.containsKey(componentName)) {
+      Map<String, Map<String, String>> componentToPortsMap;
+      if (jmxDesiredRpcSuffixes.containsKey(clusterName)) {
+        componentToPortsMap = jmxDesiredRpcSuffixes.get(clusterName);
+      } else {
+        componentToPortsMap = new HashMap<>();
+        componentToPortsMap.put(componentName, new HashMap<String, String>());
+        jmxDesiredRpcSuffixes.put(clusterName, componentToPortsMap);
+      }
+
+      Map<String, String> portToTagMap = componentToPortsMap.get(componentName);
+      portToTagMap.clear();
+
+      Map<String, String[]> keys = jmxDesiredRpcSuffixProperties.get(componentName);
+
+      if ("NAMENODE".equals(componentName)) {
+        Map<String, Object> configProperties = getConfigProperties(
+          clusterName,
+          configVersion,
+          serviceConfigTypes.get(componentServiceMap.get(componentName))
+        );
+        if (configProperties.containsKey("dfs.nameservices")) {
+          componentName += "-HA";
+          keys = jmxDesiredRpcSuffixProperties.get(componentName);
+          Map<String, String[]> stringMap = jmxDesiredRpcSuffixProperties.get(componentName);
+          for (String tag: stringMap.keySet()) {
+            keys.put(tag, getNamenodeHaProperty(configProperties, stringMap.get(tag), hostName));
+          }
+        }
+      }
+
+      Map<String, String> props = getDesiredConfigMap(
+        clusterName, configVersion, config,
+        keys);
+      for (Entry<String, String> prop: props.entrySet()) {
+        if (prop.getValue() != null) {
+          portToTagMap.put(getPortString(prop.getValue()).trim(), prop.getKey());
+        }
+      }
+    }
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/172d02aa/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXHostProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXHostProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXHostProvider.java
index 15d44b2..9f913b0 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXHostProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXHostProvider.java
@@ -77,5 +77,16 @@ public interface JMXHostProvider {
    */
   public String getJMXProtocol(String clusterName, String componentName) ;
   
-  
+  /**
+   * Get the rpc tag for the specified cluster name, component and port number
+   *
+   * @param clusterName    the cluster name
+   * @param componentName  the componentName name
+   * @param port           the port number
+   *
+   * @return the RPC tag for the specified cluster name, component and port number(client/healthcheck/etc.).
+   *
+   */
+  public String getJMXRpcMetricTag(String clusterName, String componentName, String port);
+
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/172d02aa/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXPropertyProvider.java
index 1e7f4af..0aa0a1e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXPropertyProvider.java
@@ -251,8 +251,10 @@ public class JMXPropertyProvider extends ThreadPoolEnabledPropertyProvider {
     Map<String, Map<String, Object>> categories = new HashMap<String, Map<String, Object>>();
     String componentName = (String) resource.getPropertyValue(componentNamePropertyId);
 
+    String clusterName = (String) resource.getPropertyValue(clusterNamePropertyId);
+
     for (Map<String, Object> bean : metricHolder.getBeans()) {
-      String category = getCategory(bean);
+      String category = getCategory(bean, clusterName, componentName);
       if (category != null) {
         categories.put(category, bean);
       }
@@ -377,13 +379,14 @@ public class JMXPropertyProvider extends ThreadPoolEnabledPropertyProvider {
             Collections.singleton((String) resource.getPropertyValue(hostNamePropertyId));
   }
 
-  private String getCategory(Map<String, Object> bean) {
+  private String getCategory(Map<String, Object> bean, String clusterName, String componentName) {
     if (bean.containsKey(NAME_KEY)) {
       String name = (String) bean.get(NAME_KEY);
 
       if (bean.containsKey(PORT_KEY)) {
         String port = (String) bean.get(PORT_KEY);
-        name = name.replace("ForPort" + port, "");
+        String tag = jmxHostProvider.getJMXRpcMetricTag(clusterName, componentName, port);
+        name = name.replace("ForPort" + port, tag == null ? "" : ",tag=" + tag);
       }
       return name;
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/172d02aa/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java
index 41da279..87a1ab1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java
@@ -31,6 +31,7 @@ import java.util.regex.Pattern;
 
 import org.apache.ambari.server.controller.internal.PropertyInfo;
 import org.apache.ambari.server.controller.internal.RequestImpl;
+import org.apache.ambari.server.controller.jmx.JMXPropertyProvider;
 import org.apache.ambari.server.controller.spi.PageRequest;
 import org.apache.ambari.server.controller.spi.Request;
 import org.apache.ambari.server.controller.spi.Resource;
@@ -97,8 +98,8 @@ public class PropertyHelper {
   private static final Pattern METRIC_CATEGORY_TOKENIZE_REGEX = Pattern.compile("/+(?=([^\"\\\\\\\\]*(\\\\\\\\.|\"([^\"\\\\\\\\]*\\\\\\\\.)*[^\"\\\\\\\\]*\"))*[^\"]*$)");
 
   static {
-    RPC_METRIC_SUFFIXES.put("rpc.rpc", Arrays.asList("client", "datanode", "healthcheck"));
-    RPC_METRIC_SUFFIXES.put("rpcdetailed.rpcdetailed", Arrays.asList("client", "datanode", "healthcheck"));
+    RPC_METRIC_SUFFIXES.put("metrics/rpc/", Arrays.asList("client", "datanode", "healthcheck"));
+    RPC_METRIC_SUFFIXES.put("metrics/rpcdetailed/", Arrays.asList("client", "datanode", "healthcheck"));
   }
 
   public static String getPropertyId(String category, String name) {
@@ -636,23 +637,28 @@ public class PropertyHelper {
     return false;
   }
 
-
   /**
    * Special handle rpc port tags added to metric names for HDFS Namenode
    *
    * Returns the replacement definitions
    */
-  public static Map<String, org.apache.ambari.server.state.stack.Metric> processRpcMetricDefinition(
+  public static Map<String, org.apache.ambari.server.state.stack.Metric> processRpcMetricDefinition(String metricType,
       String componentName, String propertyId, org.apache.ambari.server.state.stack.Metric metric) {
     Map<String, org.apache.ambari.server.state.stack.Metric> replacementMap = null;
     if (componentName.equalsIgnoreCase("NAMENODE")) {
       for (Map.Entry<String, List<String>> entry : RPC_METRIC_SUFFIXES.entrySet()) {
         String prefix = entry.getKey();
-        if (metric.getName().startsWith(prefix)) {
+        if (propertyId.startsWith(prefix)) {
           replacementMap = new HashMap<>();
           for (String suffix : entry.getValue()) {
+            String newMetricName;
+            if ("jmx".equals(metricType)) {
+              newMetricName = insertTagIntoCategoty(suffix, metric.getName());
+            } else {
+              newMetricName = insertTagInToMetricName(suffix, metric.getName(), prefix);
+            }
             org.apache.ambari.server.state.stack.Metric newMetric = new org.apache.ambari.server.state.stack.Metric(
-              insertTagInToMetricName(suffix, metric.getName(), prefix),
+              newMetricName,
               metric.isPointInTime(),
               metric.isTemporal(),
               metric.isAmsHostMetric(),
@@ -703,4 +709,9 @@ public class PropertyHelper {
     }
     return sb.toString();
   }
+
+  static String insertTagIntoCategoty(String tag, String metricName) {
+    int pos = metricName.lastIndexOf('.');
+    return metricName.substring(0, pos) + ",tag=" + tag + metricName.substring(pos);
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/172d02aa/ambari-server/src/main/java/org/apache/ambari/server/utils/AmbariPath.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/utils/AmbariPath.java b/ambari-server/src/main/java/org/apache/ambari/server/utils/AmbariPath.java
index 4648cbc..790e0be 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/utils/AmbariPath.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/utils/AmbariPath.java
@@ -29,7 +29,7 @@ public class AmbariPath {
   
   public static String getPath(String path) {
     if(rootDirectory == null) {  
-      LOG.warn("Cannot get $ROOT enviroment varaible. Installed to custom root directory Ambari might not work correctly.");
+      LOG.warn("Cannot get $ROOT enviroment variable. Installed to custom root directory Ambari might not work correctly.");
       return path;
     }
     String result = (rootDirectory + path).replaceAll("/+","/");

http://git-wip-us.apache.org/repos/asf/ambari/blob/172d02aa/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProviderTest.java
index 6f5fdff..cc4bd54 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProviderTest.java
@@ -132,7 +132,7 @@ public class StackDefinedPropertyProviderTest {
     cluster.setDesiredStackVersion(stackId);
     helper.getOrCreateRepositoryVersion(stackId, stackId.getStackVersion());
     cluster.createClusterVersion(stackId, stackId.getStackVersion(), "admin",
-        RepositoryVersionState.INSTALLING);
+      RepositoryVersionState.INSTALLING);
 
     clusters.addHost("h1");
     Host host = clusters.getHost("h1");
@@ -259,7 +259,7 @@ public class StackDefinedPropertyProviderTest {
   }
 
   public void testPopulateHostComponentResources() throws Exception {
-    JMXPropertyProviderTest.TestJMXHostProvider tj = new JMXPropertyProviderTest.TestJMXHostProvider(true);
+    TestJMXProvider tj = new TestJMXProvider(true);
     JMXPropertyProviderTest.TestMetricHostProvider tm = new JMXPropertyProviderTest.TestMetricHostProvider();
     TestGangliaServiceProvider serviceProvider = new TestGangliaServiceProvider();
 
@@ -288,16 +288,17 @@ public class StackDefinedPropertyProviderTest {
 
     Assert.assertTrue("Expected JMX metric 'metrics/dfs/FSNamesystem'", values.containsKey("metrics/dfs/FSNamesystem"));
     Assert.assertTrue("Expected JMX metric 'metrics/dfs/namenode'", values.containsKey("metrics/dfs/namenode"));
-    Assert.assertTrue("Expected Ganglia metric 'metrics/rpcdetailed'", values.containsKey("metrics/rpcdetailed"));
+    Assert.assertTrue("Expected Ganglia metric 'metrics/rpcdetailed/client'", values.containsKey("metrics/rpcdetailed/client"));
+    Assert.assertTrue("Expected Ganglia metric 'metrics/rpc/client'", values.containsKey("metrics/rpc/client"));
   }
 
 
   public void testCustomProviders() throws Exception {
 
     StackDefinedPropertyProvider sdpp = new StackDefinedPropertyProvider(
-        Resource.Type.HostComponent, null, null, null, new CombinedStreamProvider(),
-        "HostRoles/cluster_name", "HostRoles/host_name", "HostRoles/component_name", "HostRoles/state",
-        new EmptyPropertyProvider(), new EmptyPropertyProvider());
+      Resource.Type.HostComponent, null, null, null, new CombinedStreamProvider(),
+      "HostRoles/cluster_name", "HostRoles/host_name", "HostRoles/component_name", "HostRoles/state",
+      new EmptyPropertyProvider(), new EmptyPropertyProvider());
 
     Resource resource = new ResourceImpl(Resource.Type.HostComponent);
 
@@ -329,15 +330,15 @@ public class StackDefinedPropertyProviderTest {
   }
 
 
-
   private static class CombinedStreamProvider extends URLStreamProvider {
 
     public CombinedStreamProvider() {
       super(1000, 1000, ComponentSSLConfiguration.instance());
     }
+
     @Override
     public InputStream readFrom(String spec) throws IOException {
-      if (spec.indexOf ("jmx") > -1) {
+      if (spec.indexOf("jmx") > -1) {
         // jmx
         return ClassLoader.getSystemResourceAsStream("hdfs_namenode_jmx.json");
       } else {
@@ -348,7 +349,7 @@ public class StackDefinedPropertyProviderTest {
 
     @Override
     public InputStream readFrom(String spec, String requestMethod, String params)
-        throws IOException {
+      throws IOException {
       return readFrom(spec);
     }
   }
@@ -448,23 +449,23 @@ public class StackDefinedPropertyProviderTest {
 
   public void testPopulateResources_HDP2() throws Exception {
 
-    URLStreamProvider  streamProvider = new TestStreamProvider();
-    JMXPropertyProviderTest.TestJMXHostProvider hostProvider = new JMXPropertyProviderTest.TestJMXHostProvider(true);
+    URLStreamProvider streamProvider = new TestStreamProvider();
+    TestJMXProvider hostProvider = new TestJMXProvider(true);
     JMXPropertyProviderTest.TestMetricHostProvider metricsHostProvider = new JMXPropertyProviderTest.TestMetricHostProvider();
     TestGangliaServiceProvider serviceProvider = new TestGangliaServiceProvider();
 
     StackDefinedPropertyProvider propertyProvider = new StackDefinedPropertyProvider(
-        Resource.Type.HostComponent,
-        hostProvider,
-        metricsHostProvider,
-        serviceProvider,
-        streamProvider,
-        PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
-        PropertyHelper.getPropertyId("HostRoles", "host_name"),
-        PropertyHelper.getPropertyId("HostRoles", "component_name"),
-        PropertyHelper.getPropertyId("HostRoles", "state"),
-        new EmptyPropertyProvider(),
-        new EmptyPropertyProvider());
+      Resource.Type.HostComponent,
+      hostProvider,
+      metricsHostProvider,
+      serviceProvider,
+      streamProvider,
+      PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
+      PropertyHelper.getPropertyId("HostRoles", "host_name"),
+      PropertyHelper.getPropertyId("HostRoles", "component_name"),
+      PropertyHelper.getPropertyId("HostRoles", "state"),
+      new EmptyPropertyProvider(),
+      new EmptyPropertyProvider());
 
     // resourcemanager
     Resource resource = new ResourceImpl(Resource.Type.HostComponent);
@@ -480,19 +481,19 @@ public class StackDefinedPropertyProviderTest {
     Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size());
 
     // see test/resources/resourcemanager_jmx.json for values
-    Assert.assertEquals(6,  resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AggregateContainersAllocated")));
-    Assert.assertEquals(6,  resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AggregateContainersReleased")));
-    Assert.assertEquals(8192,  resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AvailableMB")));
-    Assert.assertEquals(1,  resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AvailableVCores")));
-    Assert.assertEquals(2,  resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AppsSubmitted")));
+    Assert.assertEquals(6, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AggregateContainersAllocated")));
+    Assert.assertEquals(6, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AggregateContainersReleased")));
+    Assert.assertEquals(8192, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AvailableMB")));
+    Assert.assertEquals(1, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AvailableVCores")));
+    Assert.assertEquals(2, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AppsSubmitted")));
 
-    Assert.assertEquals(1,  resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/ClusterMetrics", "NumActiveNMs")));
-    Assert.assertEquals(0,  resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/ClusterMetrics", "NumDecommissionedNMs")));
-    Assert.assertEquals(0,  resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/ClusterMetrics", "NumLostNMs")));
-    Assert.assertEquals(0,  resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/ClusterMetrics", "NumUnhealthyNMs")));
-    Assert.assertEquals(0,  resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/ClusterMetrics", "NumRebootedNMs")));
+    Assert.assertEquals(1, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/ClusterMetrics", "NumActiveNMs")));
+    Assert.assertEquals(0, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/ClusterMetrics", "NumDecommissionedNMs")));
+    Assert.assertEquals(0, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/ClusterMetrics", "NumLostNMs")));
+    Assert.assertEquals(0, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/ClusterMetrics", "NumUnhealthyNMs")));
+    Assert.assertEquals(0, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/ClusterMetrics", "NumRebootedNMs")));
 
-    Assert.assertEquals(932118528,  resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/jvm", "HeapMemoryMax")));
+    Assert.assertEquals(932118528, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/jvm", "HeapMemoryMax")));
 
     //namenode
     resource = new ResourceImpl(Resource.Type.HostComponent);
@@ -509,23 +510,23 @@ public class StackDefinedPropertyProviderTest {
   }
 
   public void testPopulateResources_HDP2_params() throws Exception {
-    TestStreamProvider  streamProvider = new TestStreamProvider();
-    JMXPropertyProviderTest.TestJMXHostProvider hostProvider = new JMXPropertyProviderTest.TestJMXHostProvider(false);
+    TestStreamProvider streamProvider = new TestStreamProvider();
+    TestJMXProvider hostProvider = new TestJMXProvider(false);
     JMXPropertyProviderTest.TestMetricHostProvider metricsHostProvider = new JMXPropertyProviderTest.TestMetricHostProvider();
     TestGangliaServiceProvider serviceProvider = new TestGangliaServiceProvider();
 
     StackDefinedPropertyProvider propertyProvider = new StackDefinedPropertyProvider(
-        Resource.Type.HostComponent,
-        hostProvider,
-        metricsHostProvider,
-        serviceProvider,
-        streamProvider,
-        PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
-        PropertyHelper.getPropertyId("HostRoles", "host_name"),
-        PropertyHelper.getPropertyId("HostRoles", "component_name"),
-        PropertyHelper.getPropertyId("HostRoles", "state"),
-        new EmptyPropertyProvider(),
-        new EmptyPropertyProvider());
+      Resource.Type.HostComponent,
+      hostProvider,
+      metricsHostProvider,
+      serviceProvider,
+      streamProvider,
+      PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
+      PropertyHelper.getPropertyId("HostRoles", "host_name"),
+      PropertyHelper.getPropertyId("HostRoles", "component_name"),
+      PropertyHelper.getPropertyId("HostRoles", "state"),
+      new EmptyPropertyProvider(),
+      new EmptyPropertyProvider());
 
     Resource resource = new ResourceImpl(Resource.Type.HostComponent);
 
@@ -540,44 +541,44 @@ public class StackDefinedPropertyProviderTest {
     Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size());
 
     // see test/resources/resourcemanager_jmx.json for values
-    Assert.assertEquals(6,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AggregateContainersAllocated")));
-    Assert.assertEquals(6,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AggregateContainersReleased")));
+    Assert.assertEquals(6, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AggregateContainersAllocated")));
+    Assert.assertEquals(6, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AggregateContainersReleased")));
     Assert.assertEquals(8192, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AvailableMB")));
-    Assert.assertEquals(1,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AvailableVCores")));
-    Assert.assertEquals(2,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AppsSubmitted")));
+    Assert.assertEquals(1, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AvailableVCores")));
+    Assert.assertEquals(2, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AppsSubmitted")));
 
-    Assert.assertEquals(15,   resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AggregateContainersAllocated")));
-    Assert.assertEquals(12,   resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AggregateContainersReleased")));
+    Assert.assertEquals(15, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AggregateContainersAllocated")));
+    Assert.assertEquals(12, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AggregateContainersReleased")));
     Assert.assertEquals(8192, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AvailableMB")));
-    Assert.assertEquals(1,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AvailableVCores")));
+    Assert.assertEquals(1, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AvailableVCores")));
     Assert.assertEquals(47, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AppsSubmitted")));
 
     Assert.assertEquals(4, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AggregateContainersAllocated")));
     Assert.assertEquals(4, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AggregateContainersReleased")));
     Assert.assertEquals(6048, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AvailableMB")));
-    Assert.assertEquals(1,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AvailableVCores")));
-    Assert.assertEquals(1,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AppsSubmitted")));
+    Assert.assertEquals(1, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AvailableVCores")));
+    Assert.assertEquals(1, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AppsSubmitted")));
   }
 
 
   public void testPopulateResources_HDP2_params_singleProperty() throws Exception {
-    TestStreamProvider  streamProvider = new TestStreamProvider();
-    JMXPropertyProviderTest.TestJMXHostProvider hostProvider = new JMXPropertyProviderTest.TestJMXHostProvider(false);
+    TestStreamProvider streamProvider = new TestStreamProvider();
+    TestJMXProvider hostProvider = new TestJMXProvider(false);
     JMXPropertyProviderTest.TestMetricHostProvider metricsHostProvider = new JMXPropertyProviderTest.TestMetricHostProvider();
     TestGangliaServiceProvider serviceProvider = new TestGangliaServiceProvider();
 
     StackDefinedPropertyProvider propertyProvider = new StackDefinedPropertyProvider(
-        Resource.Type.HostComponent,
-        hostProvider,
-        metricsHostProvider,
-        serviceProvider,
-        streamProvider,
-        PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
-        PropertyHelper.getPropertyId("HostRoles", "host_name"),
-        PropertyHelper.getPropertyId("HostRoles", "component_name"),
-        PropertyHelper.getPropertyId("HostRoles", "state"),
-        new EmptyPropertyProvider(),
-        new EmptyPropertyProvider());
+      Resource.Type.HostComponent,
+      hostProvider,
+      metricsHostProvider,
+      serviceProvider,
+      streamProvider,
+      PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
+      PropertyHelper.getPropertyId("HostRoles", "host_name"),
+      PropertyHelper.getPropertyId("HostRoles", "component_name"),
+      PropertyHelper.getPropertyId("HostRoles", "state"),
+      new EmptyPropertyProvider(),
+      new EmptyPropertyProvider());
 
     Resource resource = new ResourceImpl(Resource.Type.HostComponent);
 
@@ -588,7 +589,7 @@ public class StackDefinedPropertyProviderTest {
 
     // only ask for one property
     Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
-    Request  request = PropertyHelper.getReadRequest(Collections.singleton("metrics/yarn/Queue/root/AvailableMB"), temporalInfoMap);
+    Request request = PropertyHelper.getReadRequest(Collections.singleton("metrics/yarn/Queue/root/AvailableMB"), temporalInfoMap);
 
     Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size());
 
@@ -598,23 +599,23 @@ public class StackDefinedPropertyProviderTest {
   }
 
   public void testPopulateResources_HDP2_params_category() throws Exception {
-    TestStreamProvider  streamProvider = new TestStreamProvider();
-    JMXPropertyProviderTest.TestJMXHostProvider hostProvider = new JMXPropertyProviderTest.TestJMXHostProvider(false);
+    TestStreamProvider streamProvider = new TestStreamProvider();
+    TestJMXProvider hostProvider = new TestJMXProvider(false);
     JMXPropertyProviderTest.TestMetricHostProvider metricsHostProvider = new JMXPropertyProviderTest.TestMetricHostProvider();
     TestGangliaServiceProvider serviceProvider = new TestGangliaServiceProvider();
 
     StackDefinedPropertyProvider propertyProvider = new StackDefinedPropertyProvider(
-        Resource.Type.HostComponent,
-        hostProvider,
-        metricsHostProvider,
-        serviceProvider,
-        streamProvider,
-        PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
-        PropertyHelper.getPropertyId("HostRoles", "host_name"),
-        PropertyHelper.getPropertyId("HostRoles", "component_name"),
-        PropertyHelper.getPropertyId("HostRoles", "state"),
-        new EmptyPropertyProvider(),
-        new EmptyPropertyProvider());
+      Resource.Type.HostComponent,
+      hostProvider,
+      metricsHostProvider,
+      serviceProvider,
+      streamProvider,
+      PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
+      PropertyHelper.getPropertyId("HostRoles", "host_name"),
+      PropertyHelper.getPropertyId("HostRoles", "component_name"),
+      PropertyHelper.getPropertyId("HostRoles", "state"),
+      new EmptyPropertyProvider(),
+      new EmptyPropertyProvider());
 
     Resource resource = new ResourceImpl(Resource.Type.HostComponent);
 
@@ -625,48 +626,48 @@ public class StackDefinedPropertyProviderTest {
 
     // only ask for one property
     Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
-    Request  request = PropertyHelper.getReadRequest(Collections.singleton("metrics/yarn/Queue"), temporalInfoMap);
+    Request request = PropertyHelper.getReadRequest(Collections.singleton("metrics/yarn/Queue"), temporalInfoMap);
 
     Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size());
 
     // see test/resources/resourcemanager_jmx.json for values
-    Assert.assertEquals(6,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AggregateContainersAllocated")));
-    Assert.assertEquals(6,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AggregateContainersReleased")));
+    Assert.assertEquals(6, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AggregateContainersAllocated")));
+    Assert.assertEquals(6, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AggregateContainersReleased")));
     Assert.assertEquals(8192, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AvailableMB")));
-    Assert.assertEquals(1,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AvailableVCores")));
-    Assert.assertEquals(2,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AppsSubmitted")));
+    Assert.assertEquals(1, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AvailableVCores")));
+    Assert.assertEquals(2, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AppsSubmitted")));
 
-    Assert.assertEquals(15,   resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AggregateContainersAllocated")));
-    Assert.assertEquals(12,   resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AggregateContainersReleased")));
+    Assert.assertEquals(15, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AggregateContainersAllocated")));
+    Assert.assertEquals(12, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AggregateContainersReleased")));
     Assert.assertEquals(8192, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AvailableMB")));
-    Assert.assertEquals(1,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AvailableVCores")));
-    Assert.assertEquals(47,   resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AppsSubmitted")));
+    Assert.assertEquals(1, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AvailableVCores")));
+    Assert.assertEquals(47, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AppsSubmitted")));
 
-    Assert.assertEquals(4,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AggregateContainersAllocated")));
-    Assert.assertEquals(4,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AggregateContainersReleased")));
+    Assert.assertEquals(4, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AggregateContainersAllocated")));
+    Assert.assertEquals(4, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AggregateContainersReleased")));
     Assert.assertEquals(6048, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AvailableMB")));
-    Assert.assertEquals(1,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AvailableVCores")));
-    Assert.assertEquals(1,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AppsSubmitted")));
+    Assert.assertEquals(1, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AvailableVCores")));
+    Assert.assertEquals(1, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AppsSubmitted")));
   }
 
   public void testPopulateResources_HDP2_params_category2() throws Exception {
-    TestStreamProvider  streamProvider = new TestStreamProvider();
-    JMXPropertyProviderTest.TestJMXHostProvider hostProvider = new JMXPropertyProviderTest.TestJMXHostProvider(false);
+    TestStreamProvider streamProvider = new TestStreamProvider();
+    TestJMXProvider hostProvider = new TestJMXProvider(false);
     JMXPropertyProviderTest.TestMetricHostProvider metricsHostProvider = new JMXPropertyProviderTest.TestMetricHostProvider();
     TestGangliaServiceProvider serviceProvider = new TestGangliaServiceProvider();
 
     StackDefinedPropertyProvider propertyProvider = new StackDefinedPropertyProvider(
-        Resource.Type.HostComponent,
-        hostProvider,
-        metricsHostProvider,
-        serviceProvider,
-        streamProvider,
-        PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
-        PropertyHelper.getPropertyId("HostRoles", "host_name"),
-        PropertyHelper.getPropertyId("HostRoles", "component_name"),
-        PropertyHelper.getPropertyId("HostRoles", "state"),
-        new EmptyPropertyProvider(),
-        new EmptyPropertyProvider());
+      Resource.Type.HostComponent,
+      hostProvider,
+      metricsHostProvider,
+      serviceProvider,
+      streamProvider,
+      PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
+      PropertyHelper.getPropertyId("HostRoles", "host_name"),
+      PropertyHelper.getPropertyId("HostRoles", "component_name"),
+      PropertyHelper.getPropertyId("HostRoles", "state"),
+      new EmptyPropertyProvider(),
+      new EmptyPropertyProvider());
 
     Resource resource = new ResourceImpl(Resource.Type.HostComponent);
 
@@ -677,7 +678,7 @@ public class StackDefinedPropertyProviderTest {
 
     // only ask for one property
     Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
-    Request  request = PropertyHelper.getReadRequest(Collections.singleton("metrics/yarn/Queue/root/default"), temporalInfoMap);
+    Request request = PropertyHelper.getReadRequest(Collections.singleton("metrics/yarn/Queue/root/default"), temporalInfoMap);
 
     Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size());
 
@@ -688,17 +689,17 @@ public class StackDefinedPropertyProviderTest {
     Assert.assertNull(resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AvailableVCores")));
     Assert.assertNull(resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AppsSubmitted")));
 
-    Assert.assertEquals(15,   resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AggregateContainersAllocated")));
-    Assert.assertEquals(12,   resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AggregateContainersReleased")));
+    Assert.assertEquals(15, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AggregateContainersAllocated")));
+    Assert.assertEquals(12, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AggregateContainersReleased")));
     Assert.assertEquals(8192, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AvailableMB")));
-    Assert.assertEquals(1,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AvailableVCores")));
-    Assert.assertEquals(47,   resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AppsSubmitted")));
+    Assert.assertEquals(1, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AvailableVCores")));
+    Assert.assertEquals(47, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AppsSubmitted")));
 
-    Assert.assertEquals(99,   resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default/sub_queue", "AggregateContainersAllocated")));
-    Assert.assertEquals(98,   resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default/sub_queue", "AggregateContainersReleased")));
+    Assert.assertEquals(99, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default/sub_queue", "AggregateContainersAllocated")));
+    Assert.assertEquals(98, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default/sub_queue", "AggregateContainersReleased")));
     Assert.assertEquals(9898, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default/sub_queue", "AvailableMB")));
-    Assert.assertEquals(2,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default/sub_queue", "AvailableVCores")));
-    Assert.assertEquals(97,   resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default/sub_queue", "AppsSubmitted")));
+    Assert.assertEquals(2, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default/sub_queue", "AvailableVCores")));
+    Assert.assertEquals(97, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default/sub_queue", "AppsSubmitted")));
 
     Assert.assertNull(resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AggregateContainersAllocated")));
     Assert.assertNull(resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AggregateContainersReleased")));
@@ -708,23 +709,23 @@ public class StackDefinedPropertyProviderTest {
   }
 
   public void testPopulateResources_jmx_JournalNode() throws Exception {
-    TestStreamProvider  streamProvider = new TestStreamProvider();
-    JMXPropertyProviderTest.TestJMXHostProvider hostProvider = new JMXPropertyProviderTest.TestJMXHostProvider(false);
+    TestStreamProvider streamProvider = new TestStreamProvider();
+    TestJMXProvider hostProvider = new TestJMXProvider(false);
     JMXPropertyProviderTest.TestMetricHostProvider metricsHostProvider = new JMXPropertyProviderTest.TestMetricHostProvider();
     TestGangliaServiceProvider serviceProvider = new TestGangliaServiceProvider();
 
     StackDefinedPropertyProvider propertyProvider = new StackDefinedPropertyProvider(
-        Resource.Type.HostComponent,
-        hostProvider,
-        metricsHostProvider,
-        serviceProvider,
-        streamProvider,
-        PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
-        PropertyHelper.getPropertyId("HostRoles", "host_name"),
-        PropertyHelper.getPropertyId("HostRoles", "component_name"),
-        PropertyHelper.getPropertyId("HostRoles", "state"),
-        new EmptyPropertyProvider(),
-        new EmptyPropertyProvider());
+      Resource.Type.HostComponent,
+      hostProvider,
+      metricsHostProvider,
+      serviceProvider,
+      streamProvider,
+      PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
+      PropertyHelper.getPropertyId("HostRoles", "host_name"),
+      PropertyHelper.getPropertyId("HostRoles", "component_name"),
+      PropertyHelper.getPropertyId("HostRoles", "state"),
+      new EmptyPropertyProvider(),
+      new EmptyPropertyProvider());
 
     Resource resource = new ResourceImpl(Resource.Type.HostComponent);
 
@@ -831,24 +832,24 @@ public class StackDefinedPropertyProviderTest {
     Cluster cluster = clusters.getCluster("c2");
     cluster.setDesiredStackVersion(new StackId("HDP-2.1.1"));
 
-    TestStreamProvider  streamProvider = new TestStreamProvider();
-    JMXPropertyProviderTest.TestJMXHostProvider hostProvider = new JMXPropertyProviderTest.TestJMXHostProvider(false);
+    TestStreamProvider streamProvider = new TestStreamProvider();
+    TestJMXProvider hostProvider = new TestJMXProvider(false);
     TestGangliaHostProvider gangliaHostProvider = new TestGangliaHostProvider();
     JMXPropertyProviderTest.TestMetricHostProvider metricsHostProvider = new JMXPropertyProviderTest.TestMetricHostProvider();
     TestGangliaServiceProvider serviceProvider = new TestGangliaServiceProvider();
 
     StackDefinedPropertyProvider propertyProvider = new StackDefinedPropertyProvider(
-        Resource.Type.HostComponent,
-        hostProvider,
-        gangliaHostProvider,
-        serviceProvider,
-        streamProvider,
-        PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
-        PropertyHelper.getPropertyId("HostRoles", "host_name"),
-        PropertyHelper.getPropertyId("HostRoles", "component_name"),
-        PropertyHelper.getPropertyId("HostRoles", "state"),
-        new EmptyPropertyProvider(),
-        new EmptyPropertyProvider());
+      Resource.Type.HostComponent,
+      hostProvider,
+      gangliaHostProvider,
+      serviceProvider,
+      streamProvider,
+      PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
+      PropertyHelper.getPropertyId("HostRoles", "host_name"),
+      PropertyHelper.getPropertyId("HostRoles", "component_name"),
+      PropertyHelper.getPropertyId("HostRoles", "state"),
+      new EmptyPropertyProvider(),
+      new EmptyPropertyProvider());
 
     Resource resource = new ResourceImpl(Resource.Type.HostComponent);
 
@@ -874,23 +875,23 @@ public class StackDefinedPropertyProviderTest {
   }
 
   public void testPopulateResources_NoRegionServer() throws Exception {
-    TestStreamProvider  streamProvider = new TestStreamProvider();
-    JMXPropertyProviderTest.TestJMXHostProvider hostProvider = new JMXPropertyProviderTest.TestJMXHostProvider(false);
+    TestStreamProvider streamProvider = new TestStreamProvider();
+    TestJMXProvider hostProvider = new TestJMXProvider(false);
     JMXPropertyProviderTest.TestMetricHostProvider metricsHostProvider = new JMXPropertyProviderTest.TestMetricHostProvider();
     TestGangliaServiceProvider serviceProvider = new TestGangliaServiceProvider();
 
     StackDefinedPropertyProvider propertyProvider = new StackDefinedPropertyProvider(
-        Resource.Type.HostComponent,
-        hostProvider,
-        metricsHostProvider,
-        serviceProvider,
-        streamProvider,
-        PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
-        null,
-        PropertyHelper.getPropertyId("HostRoles", "component_name"),
-        PropertyHelper.getPropertyId("HostRoles", "state"),
-        new EmptyPropertyProvider(),
-        new EmptyPropertyProvider());
+      Resource.Type.HostComponent,
+      hostProvider,
+      metricsHostProvider,
+      serviceProvider,
+      streamProvider,
+      PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
+      null,
+      PropertyHelper.getPropertyId("HostRoles", "component_name"),
+      PropertyHelper.getPropertyId("HostRoles", "state"),
+      new EmptyPropertyProvider(),
+      new EmptyPropertyProvider());
 
     Resource resource = new ResourceImpl(Resource.Type.HostComponent);
 
@@ -910,23 +911,23 @@ public class StackDefinedPropertyProviderTest {
   }
 
   public void testPopulateResources_HBaseMaster2() throws Exception {
-    TestStreamProvider  streamProvider = new TestStreamProvider();
-    JMXPropertyProviderTest.TestJMXHostProvider hostProvider = new JMXPropertyProviderTest.TestJMXHostProvider(false);
+    TestStreamProvider streamProvider = new TestStreamProvider();
+    TestJMXProvider hostProvider = new TestJMXProvider(false);
     JMXPropertyProviderTest.TestMetricHostProvider metricsHostProvider = new JMXPropertyProviderTest.TestMetricHostProvider();
     TestGangliaServiceProvider serviceProvider = new TestGangliaServiceProvider();
 
     StackDefinedPropertyProvider propertyProvider = new StackDefinedPropertyProvider(
-        Resource.Type.HostComponent,
-        hostProvider,
-        metricsHostProvider,
-        serviceProvider,
-        streamProvider,
-        PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
-        PropertyHelper.getPropertyId("HostRoles", "host_name"),
-        PropertyHelper.getPropertyId("HostRoles", "component_name"),
-        PropertyHelper.getPropertyId("HostRoles", "state"),
-        new EmptyPropertyProvider(),
-        new EmptyPropertyProvider());
+      Resource.Type.HostComponent,
+      hostProvider,
+      metricsHostProvider,
+      serviceProvider,
+      streamProvider,
+      PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
+      PropertyHelper.getPropertyId("HostRoles", "host_name"),
+      PropertyHelper.getPropertyId("HostRoles", "component_name"),
+      PropertyHelper.getPropertyId("HostRoles", "state"),
+      new EmptyPropertyProvider(),
+      new EmptyPropertyProvider());
 
     Resource resource = new ResourceImpl(Resource.Type.HostComponent);
 
@@ -951,24 +952,24 @@ public class StackDefinedPropertyProviderTest {
 
   public void testPopulateResources_params_category5() throws Exception {
     org.apache.ambari.server.controller.metrics.ganglia.TestStreamProvider streamProvider =
-        new org.apache.ambari.server.controller.metrics.ganglia.TestStreamProvider("temporal_ganglia_data_yarn_queues.txt");
+      new org.apache.ambari.server.controller.metrics.ganglia.TestStreamProvider("temporal_ganglia_data_yarn_queues.txt");
 
-    JMXPropertyProviderTest.TestJMXHostProvider jmxHostProvider = new JMXPropertyProviderTest.TestJMXHostProvider(true);
+    TestJMXProvider jmxHostProvider = new TestJMXProvider(true);
     TestGangliaHostProvider hostProvider = new TestGangliaHostProvider();
     TestGangliaServiceProvider serviceProvider = new TestGangliaServiceProvider();
 
     StackDefinedPropertyProvider propertyProvider = new StackDefinedPropertyProvider(
-        Resource.Type.HostComponent,
-        jmxHostProvider,
-        hostProvider,
-        serviceProvider,
-        streamProvider,
-        PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
-        PropertyHelper.getPropertyId("HostRoles", "host_name"),
-        PropertyHelper.getPropertyId("HostRoles", "component_name"),
-        PropertyHelper.getPropertyId("HostRoles", "state"),
-        new EmptyPropertyProvider(),
-        new EmptyPropertyProvider());
+      Resource.Type.HostComponent,
+      jmxHostProvider,
+      hostProvider,
+      serviceProvider,
+      streamProvider,
+      PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
+      PropertyHelper.getPropertyId("HostRoles", "host_name"),
+      PropertyHelper.getPropertyId("HostRoles", "component_name"),
+      PropertyHelper.getPropertyId("HostRoles", "state"),
+      new EmptyPropertyProvider(),
+      new EmptyPropertyProvider());
 
 
     Resource resource = new ResourceImpl(Resource.Type.HostComponent);
@@ -984,7 +985,7 @@ public class StackDefinedPropertyProviderTest {
     Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
     temporalInfoMap.put(RM_CATEGORY_1, new TemporalInfoImpl(10L, 20L, 1L));
 
-    Request  request = PropertyHelper.getReadRequest(Collections.singleton(RM_CATEGORY_1), temporalInfoMap);
+    Request request = PropertyHelper.getReadRequest(Collections.singleton(RM_CATEGORY_1), temporalInfoMap);
 
     Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size());
 
@@ -998,24 +999,24 @@ public class StackDefinedPropertyProviderTest {
 
   public void testPopulateResources_ganglia_JournalNode() throws Exception {
     org.apache.ambari.server.controller.metrics.ganglia.TestStreamProvider streamProvider =
-        new org.apache.ambari.server.controller.metrics.ganglia.TestStreamProvider("journalnode_ganglia_data.txt");
+      new org.apache.ambari.server.controller.metrics.ganglia.TestStreamProvider("journalnode_ganglia_data.txt");
 
-    JMXPropertyProviderTest.TestJMXHostProvider jmxHostProvider = new JMXPropertyProviderTest.TestJMXHostProvider(true);
+    TestJMXProvider jmxHostProvider = new TestJMXProvider(true);
     TestGangliaHostProvider hostProvider = new TestGangliaHostProvider();
     TestGangliaServiceProvider serviceProvider = new TestGangliaServiceProvider();
 
     StackDefinedPropertyProvider propertyProvider = new StackDefinedPropertyProvider(
-        Resource.Type.HostComponent,
-        jmxHostProvider,
-        hostProvider,
-        serviceProvider,
-        streamProvider,
-        PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
-        PropertyHelper.getPropertyId("HostRoles", "host_name"),
-        PropertyHelper.getPropertyId("HostRoles", "component_name"),
-        PropertyHelper.getPropertyId("HostRoles", "state"),
-        new EmptyPropertyProvider(),
-        new EmptyPropertyProvider());
+      Resource.Type.HostComponent,
+      jmxHostProvider,
+      hostProvider,
+      serviceProvider,
+      streamProvider,
+      PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
+      PropertyHelper.getPropertyId("HostRoles", "host_name"),
+      PropertyHelper.getPropertyId("HostRoles", "component_name"),
+      PropertyHelper.getPropertyId("HostRoles", "state"),
+      new EmptyPropertyProvider(),
+      new EmptyPropertyProvider());
 
 
     Resource resource = new ResourceImpl(Resource.Type.HostComponent);
@@ -1026,60 +1027,60 @@ public class StackDefinedPropertyProviderTest {
 
 
     Object[][] testData = {
-        {"metrics", "boottime", 1378290058.0},
-        {"metrics/cpu", "cpu_aidle", 0.0},
-        {"metrics/cpu", "cpu_idle", 88.2},
-        {"metrics/cpu", "cpu_nice", 0.0},
-        {"metrics/cpu", "cpu_num", 2.0},
-        {"metrics/cpu", "cpu_speed", 3583.0},
-        {"metrics/cpu", "cpu_system", 8.4},
-        {"metrics/cpu", "cpu_user", 3.3},
-        {"metrics/cpu", "cpu_wio", 0.1},
-        {"metrics/disk", "disk_free", 92.428},
-        {"metrics/disk", "disk_total", 101.515},
-        {"metrics/disk", "part_max_used", 12.8},
-        {"metrics/load", "load_fifteen", 0.026},
-        {"metrics/load", "load_five", 0.114},
-        {"metrics/load", "load_one", 0.226},
-        {"metrics/memory", "mem_buffers", 129384.0},
-        {"metrics/memory", "mem_cached", 589576.0},
-        {"metrics/memory", "mem_free", 1365496.0},
-        {"metrics/memory", "mem_shared", 0.0},
-        {"metrics/memory", "mem_total", 4055144.0},
-        {"metrics/memory", "swap_free", 4128760.0},
-        {"metrics/memory", "swap_total", 4128760.0},
-        {"metrics/network", "bytes_in", 22547.48},
-        {"metrics/network", "bytes_out", 5772.33},
-        {"metrics/network", "pkts_in", 24.0},
-        {"metrics/network", "pkts_out", 35.4},
-        {"metrics/process", "proc_run", 4.0},
-        {"metrics/process", "proc_total", 657.0},
-        {"metrics/dfs/journalNode", "batchesWritten", 0.0},
-        {"metrics/dfs/journalNode", "batchesWrittenWhileLagging", 0.0},
-        {"metrics/dfs/journalNode", "bytesWritten", 0.0},
-        {"metrics/dfs/journalNode", "currentLagTxns", 0.0},
-        {"metrics/dfs/journalNode", "lastPromisedEpoch", 5.0},
-        {"metrics/dfs/journalNode", "lastWriterEpoch", 5.0},
-        {"metrics/dfs/journalNode", "lastWrittenTxId", 613.0},
-        {"metrics/dfs/journalNode", "syncs60s50thPercentileLatencyMicros", 0.0},
-        {"metrics/dfs/journalNode", "syncs60s75thPercentileLatencyMicros", 0.0},
-        {"metrics/dfs/journalNode", "syncs60s90thPercentileLatencyMicros", 0.0},
-        {"metrics/dfs/journalNode", "syncs60s95thPercentileLatencyMicros", 0.0},
-        {"metrics/dfs/journalNode", "syncs60s99thPercentileLatencyMicros", 0.0},
-        {"metrics/dfs/journalNode", "syncs60s_num_ops", 0.0},
-        {"metrics/dfs/journalNode", "syncs300s50thPercentileLatencyMicros", 0.0},
-        {"metrics/dfs/journalNode", "syncs300s75thPercentileLatencyMicros", 0.0},
-        {"metrics/dfs/journalNode", "syncs300s90thPercentileLatencyMicros", 0.0},
-        {"metrics/dfs/journalNode", "syncs300s95thPercentileLatencyMicros", 0.0},
-        {"metrics/dfs/journalNode", "syncs300s99thPercentileLatencyMicros", 0.0},
-        {"metrics/dfs/journalNode", "syncs300s_num_ops", 0.0},
-        {"metrics/dfs/journalNode", "syncs3600s50thPercentileLatencyMicros", 0.0},
-        {"metrics/dfs/journalNode", "syncs3600s75thPercentileLatencyMicros", 0.0},
-        {"metrics/dfs/journalNode", "syncs3600s90thPercentileLatencyMicros", 0.0},
-        {"metrics/dfs/journalNode", "syncs3600s95thPercentileLatencyMicros", 0.0},
-        {"metrics/dfs/journalNode", "syncs3600s99thPercentileLatencyMicros", 0.0},
-        {"metrics/dfs/journalNode", "syncs3600s_num_ops", 0.0},
-        {"metrics/dfs/journalNode", "txnsWritten", 0.0}
+      {"metrics", "boottime", 1378290058.0},
+      {"metrics/cpu", "cpu_aidle", 0.0},
+      {"metrics/cpu", "cpu_idle", 88.2},
+      {"metrics/cpu", "cpu_nice", 0.0},
+      {"metrics/cpu", "cpu_num", 2.0},
+      {"metrics/cpu", "cpu_speed", 3583.0},
+      {"metrics/cpu", "cpu_system", 8.4},
+      {"metrics/cpu", "cpu_user", 3.3},
+      {"metrics/cpu", "cpu_wio", 0.1},
+      {"metrics/disk", "disk_free", 92.428},
+      {"metrics/disk", "disk_total", 101.515},
+      {"metrics/disk", "part_max_used", 12.8},
+      {"metrics/load", "load_fifteen", 0.026},
+      {"metrics/load", "load_five", 0.114},
+      {"metrics/load", "load_one", 0.226},
+      {"metrics/memory", "mem_buffers", 129384.0},
+      {"metrics/memory", "mem_cached", 589576.0},
+      {"metrics/memory", "mem_free", 1365496.0},
+      {"metrics/memory", "mem_shared", 0.0},
+      {"metrics/memory", "mem_total", 4055144.0},
+      {"metrics/memory", "swap_free", 4128760.0},
+      {"metrics/memory", "swap_total", 4128760.0},
+      {"metrics/network", "bytes_in", 22547.48},
+      {"metrics/network", "bytes_out", 5772.33},
+      {"metrics/network", "pkts_in", 24.0},
+      {"metrics/network", "pkts_out", 35.4},
+      {"metrics/process", "proc_run", 4.0},
+      {"metrics/process", "proc_total", 657.0},
+      {"metrics/dfs/journalNode", "batchesWritten", 0.0},
+      {"metrics/dfs/journalNode", "batchesWrittenWhileLagging", 0.0},
+      {"metrics/dfs/journalNode", "bytesWritten", 0.0},
+      {"metrics/dfs/journalNode", "currentLagTxns", 0.0},
+      {"metrics/dfs/journalNode", "lastPromisedEpoch", 5.0},
+      {"metrics/dfs/journalNode", "lastWriterEpoch", 5.0},
+      {"metrics/dfs/journalNode", "lastWrittenTxId", 613.0},
+      {"metrics/dfs/journalNode", "syncs60s50thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs60s75thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs60s90thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs60s95thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs60s99thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs60s_num_ops", 0.0},
+      {"metrics/dfs/journalNode", "syncs300s50thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs300s75thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs300s90thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs300s95thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs300s99thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs300s_num_ops", 0.0},
+      {"metrics/dfs/journalNode", "syncs3600s50thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs3600s75thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs3600s90thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs3600s95thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs3600s99thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs3600s_num_ops", 0.0},
+      {"metrics/dfs/journalNode", "txnsWritten", 0.0}
     };
 
     Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
@@ -1112,33 +1113,33 @@ public class StackDefinedPropertyProviderTest {
 
   public void testPopulateResources_resourcemanager_clustermetrics() throws Exception {
 
-    String[] metrics = new String[] {
-        "metrics/yarn/ClusterMetrics/NumActiveNMs",
-        "metrics/yarn/ClusterMetrics/NumDecommissionedNMs",
-        "metrics/yarn/ClusterMetrics/NumLostNMs",
-        "metrics/yarn/ClusterMetrics/NumUnhealthyNMs",
-        "metrics/yarn/ClusterMetrics/NumRebootedNMs"
+    String[] metrics = new String[]{
+      "metrics/yarn/ClusterMetrics/NumActiveNMs",
+      "metrics/yarn/ClusterMetrics/NumDecommissionedNMs",
+      "metrics/yarn/ClusterMetrics/NumLostNMs",
+      "metrics/yarn/ClusterMetrics/NumUnhealthyNMs",
+      "metrics/yarn/ClusterMetrics/NumRebootedNMs"
     };
 
     org.apache.ambari.server.controller.metrics.ganglia.TestStreamProvider streamProvider =
-        new org.apache.ambari.server.controller.metrics.ganglia.TestStreamProvider("yarn_ganglia_data.txt");
+      new org.apache.ambari.server.controller.metrics.ganglia.TestStreamProvider("yarn_ganglia_data.txt");
 
-    JMXPropertyProviderTest.TestJMXHostProvider jmxHostProvider = new JMXPropertyProviderTest.TestJMXHostProvider(true);
+    TestJMXProvider jmxHostProvider = new TestJMXProvider(true);
     TestGangliaHostProvider hostProvider = new TestGangliaHostProvider();
     TestGangliaServiceProvider serviceProvider = new TestGangliaServiceProvider();
 
     StackDefinedPropertyProvider propertyProvider = new StackDefinedPropertyProvider(
-        Resource.Type.HostComponent,
-        jmxHostProvider,
-        hostProvider,
-        serviceProvider,
-        streamProvider,
-        PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
-        PropertyHelper.getPropertyId("HostRoles", "host_name"),
-        PropertyHelper.getPropertyId("HostRoles", "component_name"),
-        PropertyHelper.getPropertyId("HostRoles", "state"),
-        new EmptyPropertyProvider(),
-        new EmptyPropertyProvider());
+      Resource.Type.HostComponent,
+      jmxHostProvider,
+      hostProvider,
+      serviceProvider,
+      streamProvider,
+      PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
+      PropertyHelper.getPropertyId("HostRoles", "host_name"),
+      PropertyHelper.getPropertyId("HostRoles", "component_name"),
+      PropertyHelper.getPropertyId("HostRoles", "state"),
+      new EmptyPropertyProvider(),
+      new EmptyPropertyProvider());
 
     for (String metric : metrics) {
       Resource resource = new ResourceImpl(Resource.Type.HostComponent);
@@ -1150,7 +1151,7 @@ public class StackDefinedPropertyProviderTest {
       // only ask for one property
       Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
       temporalInfoMap.put(metric, new TemporalInfoImpl(10L, 20L, 1L));
-      Request  request = PropertyHelper.getReadRequest(Collections.singleton(metric), temporalInfoMap);
+      Request request = PropertyHelper.getReadRequest(Collections.singleton(metric), temporalInfoMap);
 
       Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size());
 
@@ -1168,7 +1169,7 @@ public class StackDefinedPropertyProviderTest {
     org.apache.ambari.server.controller.metrics.ganglia.TestStreamProvider streamProvider =
       new org.apache.ambari.server.controller.metrics.ganglia.TestStreamProvider("ams/aggregate_component_metric.json");
     injectCacheEntryFactoryWithStreamProvider(streamProvider);
-    JMXPropertyProviderTest.TestJMXHostProvider jmxHostProvider = new JMXPropertyProviderTest.TestJMXHostProvider(true);
+    TestJMXProvider jmxHostProvider = new TestJMXProvider(true);
     TestGangliaHostProvider hostProvider = new TestGangliaHostProvider();
     MetricsServiceProvider serviceProvider = new MetricsServiceProvider() {
       @Override
@@ -1216,4 +1217,16 @@ public class StackDefinedPropertyProviderTest {
     field.setAccessible(true);
     field.set(cacheEntryFactory, new MetricsRequestHelper(streamProvider));
   }
-}
+
+  public static class TestJMXProvider extends JMXPropertyProviderTest.TestJMXHostProvider {
+
+    public TestJMXProvider(boolean unknownPort) {
+      super(unknownPort);
+    }
+
+    @Override
+    public String getJMXRpcMetricTag(String clusterName, String componentName, String port) {
+      return "8020".equals(port) ? "client" : null;
+    }
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/172d02aa/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/JMXPropertyProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/JMXPropertyProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/JMXPropertyProviderTest.java
index 6dfced1..d8bf496 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/JMXPropertyProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/JMXPropertyProviderTest.java
@@ -528,6 +528,11 @@ public class JMXPropertyProviderTest {
       return "http";
     }
 
+    @Override
+    public String getJMXRpcMetricTag(String clusterName, String componentName, String port) {
+      return null;
+    }
+
   }
 
   public static class TestMetricHostProvider implements MetricHostProvider {

http://git-wip-us.apache.org/repos/asf/ambari/blob/172d02aa/ambari-server/src/test/java/org/apache/ambari/server/controller/utilities/PropertyHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/utilities/PropertyHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/utilities/PropertyHelperTest.java
index 2beb462..adbafe4 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/utilities/PropertyHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/utilities/PropertyHelperTest.java
@@ -26,6 +26,7 @@ import java.util.TreeSet;
 
 import org.apache.ambari.server.controller.internal.PropertyInfo;
 import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.state.stack.Metric;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -305,16 +306,64 @@ public class PropertyHelperTest {
   @Test
   public void testInsertTagIntoMetricName() {
     Assert.assertEquals("rpc.rpc.client.CallQueueLength",
-      PropertyHelper.insertTagInToMetricName("client", "rpc.rpc.CallQueueLength", "rpc.rpc"));
+      PropertyHelper.insertTagInToMetricName("client", "rpc.rpc.CallQueueLength", "metrics/rpc/"));
 
     Assert.assertEquals("rpc.rpc.client.CallQueueLength",
-      PropertyHelper.insertTagInToMetricName("client", "rpc.rpc.CallQueueLength", "rpc.rpc."));
+      PropertyHelper.insertTagInToMetricName("client", "rpc.rpc.CallQueueLength", "metrics/rpc/"));
 
     Assert.assertEquals("metrics/rpc/client/CallQueueLen",
-      PropertyHelper.insertTagInToMetricName("client", "metrics/rpc/CallQueueLen", "rpc.rpc"));
+      PropertyHelper.insertTagInToMetricName("client", "metrics/rpc/CallQueueLen", "metrics/rpc/"));
 
     Assert.assertEquals("metrics/rpc/client/CallQueueLen",
-      PropertyHelper.insertTagInToMetricName("client", "metrics/rpc/CallQueueLen", "rpc.rpc."));
+      PropertyHelper.insertTagInToMetricName("client", "metrics/rpc/CallQueueLen", "metrics/rpc/"));
+
+    Assert.assertEquals("rpcdetailed.rpcdetailed.client.FsyncAvgTime",
+      PropertyHelper.insertTagInToMetricName("client", "rpcdetailed.rpcdetailed.FsyncAvgTime", "metrics/rpc/"));
+    Assert.assertEquals("metrics/rpcdetailed/client/fsync_avg_time",
+      PropertyHelper.insertTagInToMetricName("client", "metrics/rpcdetailed/fsync_avg_time", "metrics/rpc/"));
+  }
+
+  @Test
+  public void testProcessRpcMetricDefinition() {
+    //ganglia metric
+    org.apache.ambari.server.state.stack.Metric metric =
+      new org.apache.ambari.server.state.stack.Metric("rpcdetailed.rpcdetailed.FsyncAvgTime", false, true, false, "unitless");
+    Map<String, Metric> replacementMap = PropertyHelper.processRpcMetricDefinition("ganglia", "NAMENODE", "metrics/rpcdetailed/fsync_avg_time", metric);
+    Assert.assertNotNull(replacementMap);
+    Assert.assertEquals(3, replacementMap.size());
+    Assert.assertTrue(replacementMap.containsKey("metrics/rpcdetailed/client/fsync_avg_time"));
+    Assert.assertTrue(replacementMap.containsKey("metrics/rpcdetailed/datanode/fsync_avg_time"));
+    Assert.assertTrue(replacementMap.containsKey("metrics/rpcdetailed/healthcheck/fsync_avg_time"));
+    Assert.assertEquals("rpcdetailed.rpcdetailed.client.FsyncAvgTime", replacementMap.get("metrics/rpcdetailed/client/fsync_avg_time").getName());
+    Assert.assertEquals("rpcdetailed.rpcdetailed.datanode.FsyncAvgTime", replacementMap.get("metrics/rpcdetailed/datanode/fsync_avg_time").getName());
+    Assert.assertEquals("rpcdetailed.rpcdetailed.healthcheck.FsyncAvgTime", replacementMap.get("metrics/rpcdetailed/healthcheck/fsync_avg_time").getName());
+
+    //jmx metric
+    metric =
+      new org.apache.ambari.server.state.stack.Metric("Hadoop:service=NameNode,name=RpcDetailedActivity.FsyncAvgTime", true, false, false, "unitless");
+    replacementMap = PropertyHelper.processRpcMetricDefinition("jmx", "NAMENODE", "metrics/rpcdetailed/fsync_avg_time", metric);
+    Assert.assertNotNull(replacementMap);
+    Assert.assertEquals(3, replacementMap.size());
+    Assert.assertTrue(replacementMap.containsKey("metrics/rpcdetailed/client/fsync_avg_time"));
+    Assert.assertTrue(replacementMap.containsKey("metrics/rpcdetailed/datanode/fsync_avg_time"));
+    Assert.assertTrue(replacementMap.containsKey("metrics/rpcdetailed/healthcheck/fsync_avg_time"));
+    Assert.assertEquals("Hadoop:service=NameNode,name=RpcDetailedActivity,tag=client.FsyncAvgTime", replacementMap.get("metrics/rpcdetailed/client/fsync_avg_time").getName());
+    Assert.assertEquals("Hadoop:service=NameNode,name=RpcDetailedActivity,tag=datanode.FsyncAvgTime", replacementMap.get("metrics/rpcdetailed/datanode/fsync_avg_time").getName());
+    Assert.assertEquals("Hadoop:service=NameNode,name=RpcDetailedActivity,tag=healthcheck.FsyncAvgTime", replacementMap.get("metrics/rpcdetailed/healthcheck/fsync_avg_time").getName());
+
+    //jmx metric 2
+    metric =
+      new org.apache.ambari.server.state.stack.Metric("Hadoop:service=NameNode,name=RpcActivity.RpcQueueTime_avg_time", true, false, false, "unitless");
+    replacementMap = PropertyHelper.processRpcMetricDefinition("jmx", "NAMENODE", "metrics/rpc/RpcQueueTime_avg_time", metric);
+    Assert.assertNotNull(replacementMap);
+    Assert.assertEquals(3, replacementMap.size());
+    Assert.assertTrue(replacementMap.containsKey("metrics/rpc/client/RpcQueueTime_avg_time"));
+    Assert.assertTrue(replacementMap.containsKey("metrics/rpc/datanode/RpcQueueTime_avg_time"));
+    Assert.assertTrue(replacementMap.containsKey("metrics/rpc/healthcheck/RpcQueueTime_avg_time"));
+    Assert.assertEquals("Hadoop:service=NameNode,name=RpcActivity,tag=client.RpcQueueTime_avg_time", replacementMap.get("metrics/rpc/client/RpcQueueTime_avg_time").getName());
+    Assert.assertEquals("Hadoop:service=NameNode,name=RpcActivity,tag=datanode.RpcQueueTime_avg_time", replacementMap.get("metrics/rpc/datanode/RpcQueueTime_avg_time").getName());
+    Assert.assertEquals("Hadoop:service=NameNode,name=RpcActivity,tag=healthcheck.RpcQueueTime_avg_time", replacementMap.get("metrics/rpc/healthcheck/RpcQueueTime_avg_time").getName());
+
   }
 
   // remove any replacement tokens (e.g. $1.replaceAll(\",q(\\d+)=\",\"/\").substring(1)) in the metric names


Mime
View raw message