private void populateResource(Resource resource, GangliaMetric gangliaMetric) {
      String metric_name = gangliaMetric.getMetric_name();
      Set<String> propertyIdSet = null;
      List<String> parameterList = null;
      if (metric_name != null) {
        propertyIdSet = metrics.get(metric_name);
        parameterList = new LinkedList<>();

        if (propertyIdSet == null) {
          for (Map.Entry<String, Set<String>> entry : metrics.entrySet()) {

            String key = entry.getKey();

            Pattern pattern = Pattern.compile(key);
            Matcher matcher = pattern.matcher(metric_name);

            if (matcher.matches()) {
              propertyIdSet = entry.getValue();
              // get parameters
              for (int i = 0; i < matcher.groupCount(); ++i) {
                parameterList.add(matcher.group(i + 1));
              }
              break;
            }
          }
        }
      }
      if (propertyIdSet != null) {
        Map<String, PropertyInfo> metricsMap = getComponentMetrics().get(getComponentName(resource));
        if (metricsMap != null) {
          for (String propertyId : propertyIdSet) {
            if (propertyId != null) {
              if (metricsMap.containsKey(propertyId)) {
                if (containsArguments(propertyId)) {
                  int i = 1;
                  for (String param : parameterList) {
                    propertyId = substituteArgument(propertyId, "$" + i, param);
                    ++i;
                  }
                }
                Object value = getValue(gangliaMetric, temporalInfo != null);
                if (value != null) {
                  resource.setProperty(propertyId, value);
                }
              }
            }
          }
        }
      }
    }
Populate the given resource with the given Ganglia metric.

@param resource       the resource
@param gangliaMetric  the Ganglia metrics
ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/ganglia/GangliaPropertyProvider.java