You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by am...@apache.org on 2018/03/12 20:15:07 UTC

[ambari] branch trunk updated (55ae952 -> b614378)

This is an automated email from the ASF dual-hosted git repository.

amagyar pushed a change to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git.


    from 55ae952  [AMBARI-23185] Added a new CLI option in the setup-ldap tool to indicate whether to force LDAP auth method even if another one - or none at all - is already configured (#615)
     new cb01382  AMBARI-22755. Show OneFS JMX metrics on the UI (amagyar)
     new 0c14220   AMBARI-22755. Show OneFS JMX metrics on the UI (amagyar)
     new a6dd77a  AMBARI-22755. Show OneFS JMX metrics on the UI (amagyar)
     new b614378  AMBARI-22755. Show OneFS JMX metrics on the UI (amagyar)

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../internal/AbstractProviderModule.java           |  10 +-
 .../internal/ConfigBasedJmxHostProvider.java       |  95 +++++++++++++++++++
 .../internal/StackDefinedPropertyProvider.java     |   9 +-
 .../server/controller/jmx/JMXHostProvider.java     |  32 +------
 .../state/{alert/AlertUri.java => UriInfo.java}    |   8 +-
 .../ambari/server/state/alert/AmsSource.java       |   6 +-
 .../ambari/server/state/alert/MetricSource.java    |   5 +-
 .../ambari/server/state/alert/ServerSource.java    |   6 +-
 .../ambari/server/state/alert/WebSource.java       |   6 +-
 .../server/state/stack/MetricDefinition.java       |   9 ++
 .../internal/ConfigBasedJmxHostProviderTest.java   |  93 ++++++++++++++++++
 .../controller/internal/JMXHostProviderTest.java   | 104 +++++++-------------
 .../OverriddenMetricsHostProviderTest.java         |   2 +-
 ...ComponentConfigurationResourceProviderTest.java |   2 +-
 .../metrics/JMXPropertyProviderTest.java           |  11 +--
 .../{alert/AlertUriTest.java => UriInfoTest.java}  |  10 +-
 .../app/controllers/global/update_controller.js    |   3 +-
 ambari-web/app/mappers/service_metrics_mapper.js   |  49 ++++++++++
 ambari-web/app/models.js                           |   1 +
 ambari-web/app/models/service.js                   |   1 +
 ambari-web/app/models/service/onefs.js             |  43 +++++++++
 ambari-web/app/views/main/service/info/summary.js  |   1 +
 .../addon-services/ONEFS/1.0.0/metrics.json        | 105 +++++++++++++++++++++
 23 files changed, 472 insertions(+), 139 deletions(-)
 create mode 100644 ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProvider.java
 rename ambari-server/src/main/java/org/apache/ambari/server/state/{alert/AlertUri.java => UriInfo.java} (98%)
 create mode 100644 ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProviderTest.java
 rename ambari-server/src/test/java/org/apache/ambari/server/state/{alert/AlertUriTest.java => UriInfoTest.java} (89%)
 create mode 100644 ambari-web/app/models/service/onefs.js

-- 
To stop receiving notification emails like this one, please contact
amagyar@apache.org.

[ambari] 04/04: AMBARI-22755. Show OneFS JMX metrics on the UI (amagyar)

Posted by am...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

amagyar pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git

commit b614378a9c6edc23ab628f2acf8af5ef11ba68d5
Author: Attila Magyar <am...@hortonworks.com>
AuthorDate: Mon Mar 12 20:35:03 2018 +0100

    AMBARI-22755. Show OneFS JMX metrics on the UI (amagyar)
---
 .../ambari/server/controller/internal/ConfigBasedJmxHostProvider.java | 4 ++--
 .../server/controller/internal/StackDefinedPropertyProvider.java      | 2 +-
 .../main/java/org/apache/ambari/server/state/{alert => }/UriInfo.java | 2 +-
 .../src/main/java/org/apache/ambari/server/state/alert/AmsSource.java | 2 ++
 .../main/java/org/apache/ambari/server/state/alert/MetricSource.java  | 1 +
 .../main/java/org/apache/ambari/server/state/alert/ServerSource.java  | 2 ++
 .../src/main/java/org/apache/ambari/server/state/alert/WebSource.java | 2 ++
 .../java/org/apache/ambari/server/state/stack/MetricDefinition.java   | 2 +-
 .../server/controller/internal/ConfigBasedJmxHostProviderTest.java    | 2 +-
 .../java/org/apache/ambari/server/state/{alert => }/UriInfoTest.java  | 2 +-
 10 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProvider.java
index ff513c5..5291898 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProvider.java
@@ -30,10 +30,10 @@ import java.util.Set;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.controller.jmx.JMXHostProvider;
 import org.apache.ambari.server.state.ConfigHelper;
-import org.apache.ambari.server.state.alert.UriInfo;
+import org.apache.ambari.server.state.UriInfo;
 
 /**
- * I'm a special {@link JMXHostProvider} that resolves JMX URIs based on cluster configuration.
+ * A special {@link JMXHostProvider} that resolves JMX URIs based on cluster configuration.
  */
 public class ConfigBasedJmxHostProvider implements JMXHostProvider {
   private final Map<String, UriInfo> overriddenJmxUris;
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProvider.java
index 99ad46f..4e1d07e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProvider.java
@@ -50,7 +50,7 @@ import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.ConfigHelper;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.StackId;
-import org.apache.ambari.server.state.alert.UriInfo;
+import org.apache.ambari.server.state.UriInfo;
 import org.apache.ambari.server.state.stack.Metric;
 import org.apache.ambari.server.state.stack.MetricDefinition;
 import org.slf4j.Logger;
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/UriInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/state/UriInfo.java
similarity index 99%
rename from ambari-server/src/main/java/org/apache/ambari/server/state/alert/UriInfo.java
rename to ambari-server/src/main/java/org/apache/ambari/server/state/UriInfo.java
index a2f1497..f7713c4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/UriInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/UriInfo.java
@@ -15,7 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.ambari.server.state.alert;
+package org.apache.ambari.server.state;
 
 import java.net.URI;
 import java.util.Map;
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AmsSource.java b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AmsSource.java
index f739115..ab8b671 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AmsSource.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AmsSource.java
@@ -20,6 +20,8 @@ package org.apache.ambari.server.state.alert;
 import java.util.List;
 import java.util.Objects;
 
+import org.apache.ambari.server.state.UriInfo;
+
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.google.gson.annotations.SerializedName;
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricSource.java b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricSource.java
index ff7565e..bfb3021 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricSource.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricSource.java
@@ -26,6 +26,7 @@ import java.util.Objects;
 import java.util.Optional;
 
 import org.apache.ambari.server.controller.jmx.JMXMetricHolder;
+import org.apache.ambari.server.state.UriInfo;
 import org.springframework.expression.spel.standard.SpelExpressionParser;
 import org.springframework.expression.spel.support.StandardEvaluationContext;
 
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/ServerSource.java b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/ServerSource.java
index 642428e..bc59f81 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/ServerSource.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/ServerSource.java
@@ -19,6 +19,8 @@ package org.apache.ambari.server.state.alert;
 
 import java.util.Objects;
 
+import org.apache.ambari.server.state.UriInfo;
+
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.google.gson.annotations.SerializedName;
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/WebSource.java b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/WebSource.java
index 16d8aad..33d8dbb 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/WebSource.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/WebSource.java
@@ -19,6 +19,8 @@ package org.apache.ambari.server.state.alert;
 
 import java.util.Objects;
 
+import org.apache.ambari.server.state.UriInfo;
+
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.google.gson.annotations.SerializedName;
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/MetricDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/MetricDefinition.java
index ed3c2a2..6d2b126 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/MetricDefinition.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/MetricDefinition.java
@@ -24,7 +24,7 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Optional;
 
-import org.apache.ambari.server.state.alert.UriInfo;
+import org.apache.ambari.server.state.UriInfo;
 import org.codehaus.jackson.annotate.JsonIgnore;
 import org.codehaus.jackson.annotate.JsonProperty;
 
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProviderTest.java
index 3e86b63..744ff84 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProviderTest.java
@@ -32,7 +32,7 @@ import java.util.Set;
 
 import org.apache.ambari.server.controller.jmx.JMXHostProvider;
 import org.apache.ambari.server.state.ConfigHelper;
-import org.apache.ambari.server.state.alert.UriInfo;
+import org.apache.ambari.server.state.UriInfo;
 import org.easymock.EasyMockRule;
 import org.easymock.EasyMockSupport;
 import org.easymock.Mock;
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/alert/UriInfoTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/UriInfoTest.java
similarity index 97%
rename from ambari-server/src/test/java/org/apache/ambari/server/state/alert/UriInfoTest.java
rename to ambari-server/src/test/java/org/apache/ambari/server/state/UriInfoTest.java
index c37b2ca..b8b13f3 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/alert/UriInfoTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/UriInfoTest.java
@@ -15,7 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.ambari.server.state.alert;
+package org.apache.ambari.server.state;
 
 import static org.hamcrest.core.Is.is;
 import static org.junit.Assert.assertThat;

-- 
To stop receiving notification emails like this one, please contact
amagyar@apache.org.

[ambari] 01/04: AMBARI-22755. Show OneFS JMX metrics on the UI (amagyar)

Posted by am...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

amagyar pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git

commit cb013822f6f93548bab0734a7660a361e5a4f725
Author: Attila Magyar <am...@hortonworks.com>
AuthorDate: Wed Mar 7 20:09:16 2018 +0100

    AMBARI-22755. Show OneFS JMX metrics on the UI (amagyar)
---
 .../internal/AbstractProviderModule.java           |  10 +-
 .../internal/ConfigBasedJmxHostProvider.java       |  95 +++++++++++++++++++
 .../internal/StackDefinedPropertyProvider.java     |   9 +-
 .../server/controller/jmx/JMXHostProvider.java     |  32 +------
 .../ambari/server/state/alert/AmsSource.java       |   4 +-
 .../ambari/server/state/alert/MetricSource.java    |   4 +-
 .../state/alert/{AlertUri.java => MetricsUri.java} |   6 +-
 .../ambari/server/state/alert/ServerSource.java    |   4 +-
 .../ambari/server/state/alert/WebSource.java       |   4 +-
 .../server/state/stack/MetricDefinition.java       |   9 ++
 .../internal/ConfigBasedJmxHostProviderTest.java   |  93 ++++++++++++++++++
 .../controller/internal/JMXHostProviderTest.java   | 104 +++++++-------------
 .../metrics/JMXPropertyProviderTest.java           |  11 +--
 .../{AlertUriTest.java => MetricsUriTest.java}     |   8 +-
 .../app/controllers/global/update_controller.js    |   3 +-
 ambari-web/app/mappers/service_metrics_mapper.js   |  49 ++++++++++
 ambari-web/app/models.js                           |   1 +
 ambari-web/app/models/service.js                   |   1 +
 ambari-web/app/models/service/onefs.js             |  43 +++++++++
 ambari-web/app/views/main/service/info/summary.js  |   1 +
 .../addon-services/ONEFS/1.0.0/metrics.json        | 105 +++++++++++++++++++++
 21 files changed, 461 insertions(+), 135 deletions(-)

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 caa21bc..4486410 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
@@ -486,8 +486,7 @@ public abstract class AbstractProviderModule implements ProviderModule,
     return hosts;
   }
 
-  @Override
-  public Host getHost(String clusterName, String hostName) {
+  private Host getHost(String clusterName, String hostName) {
     Host host = null;
     try {
       Cluster cluster = managementController.getClusters().getCluster(clusterName);
@@ -518,12 +517,7 @@ public abstract class AbstractProviderModule implements ProviderModule,
   // ----- JMXHostProvider ---------------------------------------------------
 
   @Override
-  public String getPort(String clusterName, String componentName, String hostName) throws SystemException {
-    return getPort(clusterName, componentName, hostName, false);
-  }
-
-  @Override
-  public String getPort(String clusterName, String componentName, String hostName, boolean httpsEnabled) throws SystemException {
+  public String getPort(String clusterName, String componentName, String hostName, boolean httpsEnabled) {
     ConcurrentMap<String, ConcurrentMap<String, String>> clusterJmxPorts;
     // Still need double check to ensure single init
     if (!jmxPortMap.containsKey(clusterName)) {
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProvider.java
new file mode 100644
index 0000000..62b292f
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProvider.java
@@ -0,0 +1,95 @@
+/*
+ *
+ *  * 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.server.controller.internal;
+
+import static edu.emory.mathcs.backport.java.util.Collections.singleton;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.controller.jmx.JMXHostProvider;
+import org.apache.ambari.server.state.ConfigHelper;
+import org.apache.ambari.server.state.alert.MetricsUri;
+
+/**
+ * I'm a special {@link JMXHostProvider} that resolves JMX URIs based on cluster configuration.
+ */
+public class ConfigBasedJmxHostProvider implements JMXHostProvider {
+  private final Map<String, MetricsUri> overriddenJmxUris;
+  private final JMXHostProvider defaultProvider;
+  private final ConfigHelper configHelper;
+
+  public ConfigBasedJmxHostProvider(Map<String, MetricsUri> overriddenJmxUris, JMXHostProvider defaultProvider, ConfigHelper configHelper) {
+    this.overriddenJmxUris = overriddenJmxUris;
+    this.defaultProvider = defaultProvider;
+    this.configHelper = configHelper;
+  }
+
+  @Override
+  public String getPublicHostName(String clusterName, String hostName) {
+    return defaultProvider.getPublicHostName(clusterName, hostName);
+  }
+
+  @Override
+  public Set<String> getHostNames(String clusterName, String componentName) {
+    return overridenJmxUri(componentName)
+      .map(uri -> singleton(resolve(uri, clusterName).getHost()))
+      .orElseGet(() -> defaultProvider.getHostNames(clusterName, componentName));
+  }
+
+  private URI resolve(MetricsUri uri, String clusterName) {
+    try {
+      return uri.resolve(config(clusterName));
+    } catch (AmbariException e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  @Override
+  public String getPort(String clusterName, String componentName, String hostName, boolean httpsEnabled) {
+    return overridenJmxUri(componentName)
+      .map(uri -> String.valueOf(resolve(uri, clusterName).getPort()))
+      .orElseGet(() -> defaultProvider.getPort(clusterName, componentName, hostName, httpsEnabled));
+  }
+
+  @Override
+  public String getJMXProtocol(String clusterName, String componentName) {
+    return overridenJmxUri(componentName)
+      .map(uri -> resolve(uri, clusterName).getScheme())
+      .orElseGet(() -> defaultProvider.getJMXProtocol(clusterName, componentName));
+  }
+
+  @Override
+  public String getJMXRpcMetricTag(String clusterName, String componentName, String port) {
+    return defaultProvider.getJMXRpcMetricTag(clusterName, componentName, port);
+  }
+
+  private Optional<MetricsUri> overridenJmxUri(String component) {
+    return Optional.ofNullable(overriddenJmxUris.get(component));
+  }
+
+  private Map<String, Map<String, String>> config(String clusterName) throws AmbariException {
+    return configHelper.getEffectiveConfigProperties(clusterName, null);
+  }
+}
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProvider.java
index 861007b..34936a9 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProvider.java
@@ -50,6 +50,7 @@ import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.ConfigHelper;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.StackId;
+import org.apache.ambari.server.state.alert.MetricsUri;
 import org.apache.ambari.server.state.stack.Metric;
 import org.apache.ambari.server.state.stack.MetricDefinition;
 import org.slf4j.Logger;
@@ -157,6 +158,7 @@ public class StackDefinedPropertyProvider implements PropertyProvider {
 
     List<PropertyProvider> additional = new ArrayList<>();
     Map<String, String> overriddenHosts = new HashMap<>();
+    Map<String, MetricsUri> overriddenJmxUris = new HashMap<>();
 
     try {
       for (Resource r : resources) {
@@ -188,6 +190,7 @@ public class StackDefinedPropertyProvider implements PropertyProvider {
             m.getOverriddenHosts().ifPresent(host -> overriddenHosts.put(componentName, host));
           } else if (m.getType().equals("jmx")) {
             jmxMap.put(componentName, getPropertyInfo(m));
+            m.getJmxSourceUri().ifPresent(uri -> overriddenJmxUris.put(componentName, uri));
           } else {
             PropertyProvider pp = getDelegate(m,
                 streamProvider, metricHostProvider,
@@ -222,7 +225,7 @@ public class StackDefinedPropertyProvider implements PropertyProvider {
       if (jmxMap.size() > 0) {
         JMXPropertyProvider jpp = metricPropertyProviderFactory.createJMXPropertyProvider(jmxMap,
             streamProvider,
-            jmxHostProvider, metricHostProvider,
+            jmxHostProvider(overriddenJmxUris, jmxHostProvider, injector.getInstance(ConfigHelper.class)), metricHostProvider,
             clusterNamePropertyId, hostNamePropertyId,
             componentNamePropertyId, resourceStatePropertyId);
 
@@ -247,6 +250,10 @@ public class StackDefinedPropertyProvider implements PropertyProvider {
     return resources;
   }
 
+  private JMXHostProvider jmxHostProvider(Map<String, MetricsUri> overriddenJmxUris, JMXHostProvider defaultProvider, ConfigHelper configHelper) {
+    return overriddenJmxUris.isEmpty() ? defaultProvider : new ConfigBasedJmxHostProvider(overriddenJmxUris, defaultProvider, configHelper);
+  }
+
   private MetricHostProvider metricHostProvider(Map<String, String> overriddenHosts) {
     return new OverriddenMetricsHostProvider(overriddenHosts, metricHostProvider, injector.getInstance(ConfigHelper.class));
   }
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 4e48b53..ea79fe7 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
@@ -19,9 +19,6 @@ package org.apache.ambari.server.controller.jmx;
 
 import java.util.Set;
 
-import org.apache.ambari.server.controller.spi.SystemException;
-import org.apache.ambari.server.state.Host;
-
 /**
  * Provider of JMX host information.
  */
@@ -41,28 +38,6 @@ public interface JMXHostProvider {
   Set<String> getHostNames(String clusterName, String componentName);
 
   /**
-   * Get cluster host info given the host name
-   * @param clusterName
-   * @param hostName the host name
-   * @return the host info {@link Host}
-   */
-  Host getHost(String clusterName, String hostName);
-
-  /**
-   * Get the port for the specified cluster name and component.
-   *
-   * @param clusterName    the cluster name
-   * @param componentName  the component name
-   * @param hostName       the component hostName
-   *
-   * @return the port for the specified cluster name and component
-   *
-   * @throws SystemException if unable to get the JMX port
-   */
-  String getPort(String clusterName, String componentName, String hostName)
-      throws SystemException;
-
-  /**
    * Get the port for the specified cluster name and component.
    *
    * @param clusterName    the cluster name
@@ -71,12 +46,9 @@ public interface JMXHostProvider {
    * @param httpsEnabled   https enabled
    *
    * @return the port for the specified cluster name and component
-   *
-   * @throws SystemException if unable to get the JMX port
    */
-  String getPort(String clusterName, String componentName, String hostName, boolean httpsEnabled)
-      throws SystemException;
-  
+  String getPort(String clusterName, String componentName, String hostName, boolean httpsEnabled);
+
   /**
    * Get the protocol for the specified cluster name and component.
    *
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AmsSource.java b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AmsSource.java
index f894be1..3a3ec2f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AmsSource.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AmsSource.java
@@ -34,7 +34,7 @@ import com.google.gson.annotations.SerializedName;
 public class AmsSource extends Source {
 
   @SerializedName("uri")
-  private AlertUri uri = null;
+  private MetricsUri uri = null;
 
   @SerializedName("ams")
   private AmsInfo amsInfo = null;
@@ -51,7 +51,7 @@ public class AmsSource extends Source {
    * @return the uri info, which may include port information
    */
   @JsonProperty("uri")
-  public AlertUri getUri() {
+  public MetricsUri getUri() {
     return uri;
   }
 
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricSource.java b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricSource.java
index f44e17f..8107383 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricSource.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricSource.java
@@ -43,7 +43,7 @@ import com.google.gson.annotations.SerializedName;
 public class MetricSource extends Source {
 
   @SerializedName("uri")
-  private AlertUri uri = null;
+  private MetricsUri uri = null;
 
   @SerializedName("jmx")
   private JmxInfo jmxInfo = null;
@@ -71,7 +71,7 @@ public class MetricSource extends Source {
    * @return the uri info, which may include port information
    */
   @JsonProperty("uri")
-  public AlertUri getUri() {
+  public MetricsUri getUri() {
     return uri;
   }
 
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AlertUri.java b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricsUri.java
similarity index 98%
rename from ambari-server/src/main/java/org/apache/ambari/server/state/alert/AlertUri.java
rename to ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricsUri.java
index 82fc97b..0e52fd6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AlertUri.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricsUri.java
@@ -29,7 +29,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
 import com.google.gson.annotations.SerializedName;
 
 /**
- * The {@link AlertUri} class is used to represent a complex URI structure where
+ * The {@link MetricsUri} class is used to represent a complex URI structure where
  * there can be both a plaintext and SSL URI. This is used in cases where the
  * alert definition needs a way to expose which URL (http or https) should be
  * used to gather data. Currently, only {@link MetricSource} uses this, but it
@@ -37,7 +37,7 @@ import com.google.gson.annotations.SerializedName;
  * URI.
  */
 @JsonInclude(JsonInclude.Include.NON_EMPTY)
-public class AlertUri {
+public class MetricsUri {
   /**
    * The HTTP URI to use.
    */
@@ -374,7 +374,7 @@ public class AlertUri {
       return false;
     }
 
-    AlertUri other = (AlertUri) obj;
+    MetricsUri other = (MetricsUri) obj;
     if (m_httpUri == null) {
       if (other.m_httpUri != null) {
         return false;
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/ServerSource.java b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/ServerSource.java
index a385073..19e7ae6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/ServerSource.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/ServerSource.java
@@ -34,7 +34,7 @@ public class ServerSource extends ParameterizedSource {
   private String m_class;
 
   @SerializedName("uri")
-  private AlertUri uri = null;
+  private MetricsUri uri = null;
 
   @SerializedName("jmx")
   private MetricSource.JmxInfo jmxInfo = null;
@@ -52,7 +52,7 @@ public class ServerSource extends ParameterizedSource {
     return jmxInfo;
   }
 
-  public AlertUri getUri() {
+  public MetricsUri getUri() {
     return uri;
   }
 
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/WebSource.java b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/WebSource.java
index 63b5647..9accae3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/WebSource.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/WebSource.java
@@ -33,13 +33,13 @@ import com.google.gson.annotations.SerializedName;
 public class WebSource extends Source {
 
   @SerializedName("uri")
-  private AlertUri uri = null;
+  private MetricsUri uri = null;
 
   /**
    * @return the uri info, which may include port information
    */
   @JsonProperty("uri")
-  public AlertUri getUri() {
+  public MetricsUri getUri() {
     return uri;
   }
 
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/MetricDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/MetricDefinition.java
index 033b18b..08902d8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/MetricDefinition.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/MetricDefinition.java
@@ -24,9 +24,12 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Optional;
 
+import org.apache.ambari.server.state.alert.MetricsUri;
 import org.codehaus.jackson.annotate.JsonIgnore;
 import org.codehaus.jackson.annotate.JsonProperty;
 
+import com.google.gson.annotations.SerializedName;
+
 /**
  * Used to represent metrics for a stack component.
  */
@@ -35,6 +38,8 @@ public class MetricDefinition {
   private String type = null;
   private Map<String, String> properties = null;
   private Map<String, Map<String, Metric>> metrics = null;
+  @SerializedName("jmx_source_uri")
+  private MetricsUri jmxSourceUri;
 
   public MetricDefinition(String type, Map<String, String> properties, Map<String, Map<String, Metric>> metrics) {
     this.type = type;
@@ -82,4 +87,8 @@ public class MetricDefinition {
       ? Optional.empty()
       : Optional.ofNullable(properties.get(OVERRIDDEN_HOST_PROP));
   }
+
+  public Optional<MetricsUri> getJmxSourceUri() {
+    return !"jmx".equalsIgnoreCase(type) ? Optional.empty() : Optional.ofNullable(jmxSourceUri);
+  }
 }
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProviderTest.java
new file mode 100644
index 0000000..ca4b4e4
--- /dev/null
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProviderTest.java
@@ -0,0 +1,93 @@
+/*
+ *
+ *  * 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.server.controller.internal;
+
+import static org.easymock.EasyMock.expect;
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.ambari.server.controller.jmx.JMXHostProvider;
+import org.apache.ambari.server.state.ConfigHelper;
+import org.apache.ambari.server.state.alert.MetricsUri;
+import org.easymock.EasyMockRule;
+import org.easymock.EasyMockSupport;
+import org.easymock.Mock;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class ConfigBasedJmxHostProviderTest extends EasyMockSupport {
+  private static final String COMPONENT_WITH_OVERRIDDEN_HOST = "component1";
+  private static final String CLUSTER_1 = "cluster1";
+  private static final String COMPONENT_WITHOUT_OVERRIDDEN_HOST = "componentWithoutOverriddenHost";
+  private static final String RESOLVED_HOST = "resolved.fqdn";
+  private static final Set<String> resolvedUris = new HashSet<>(Arrays.asList(RESOLVED_HOST));
+  @Rule
+  public EasyMockRule mocks = new EasyMockRule(this);
+  @Mock
+  private JMXHostProvider defaultHostProvider;
+  @Mock
+  private ConfigHelper configHelper;
+  private JMXHostProvider hostProvider;
+
+  @Before
+  public void setUp() throws Exception {
+    hostProvider = new ConfigBasedJmxHostProvider(overrideHosts(), defaultHostProvider, configHelper);
+  }
+
+  @Test
+  public void testDelegatesWhenHostIsNotOverridden() throws Exception {
+    expect(defaultHostProvider.getHostNames(CLUSTER_1, COMPONENT_WITHOUT_OVERRIDDEN_HOST)).andReturn(resolvedUris).anyTimes();
+    replayAll();
+    assertThat(hostProvider.getHostNames(CLUSTER_1, COMPONENT_WITHOUT_OVERRIDDEN_HOST), is(resolvedUris));
+    verifyAll();
+  }
+
+  @Test
+  public void testGetsUriFromConfigWhenHostIsOverridden() throws Exception {
+    expect(configHelper.getEffectiveConfigProperties(CLUSTER_1, null)).andReturn(config()).anyTimes();
+    replayAll();
+    assertThat(hostProvider.getHostNames(CLUSTER_1, COMPONENT_WITH_OVERRIDDEN_HOST), is(resolvedUris));
+    verifyAll();
+  }
+
+  private Map<String, MetricsUri> overrideHosts() {
+    MetricsUri uri = new MetricsUri();
+    uri.setHttpUri("${hdfs-site/dfs.namenode.http-address}");
+    return new HashMap<String, MetricsUri>() {{
+      put(COMPONENT_WITH_OVERRIDDEN_HOST, uri);
+    }};
+  }
+
+  private Map<String, Map<String, String>> config() {
+    return new HashMap<String, Map<String, String>>() {{
+      put("hdfs-site", new HashMap<String, String>() {{
+        put("dfs.namenode.http-address", RESOLVED_HOST);
+      }});
+    }};
+  }
+}
\ No newline at end of file
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/JMXHostProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/JMXHostProviderTest.java
index 644fe1d..cc178da 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/JMXHostProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/JMXHostProviderTest.java
@@ -37,13 +37,8 @@ import org.apache.ambari.server.controller.MaintenanceStateHelper;
 import org.apache.ambari.server.controller.ServiceComponentHostRequest;
 import org.apache.ambari.server.controller.ServiceComponentRequest;
 import org.apache.ambari.server.controller.ServiceRequest;
-import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
-import org.apache.ambari.server.controller.spi.NoSuchResourceException;
 import org.apache.ambari.server.controller.spi.Resource;
-import org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
 import org.apache.ambari.server.controller.spi.ResourceProvider;
-import org.apache.ambari.server.controller.spi.SystemException;
-import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.orm.GuiceJpaInitializer;
 import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
 import org.apache.ambari.server.orm.OrmTestHelper;
@@ -448,10 +443,7 @@ public class JMXHostProviderTest {
 
 
   @Test
-  public void testJMXPortMapInitAtServiceLevelVersion1() throws
-      NoSuchParentResourceException,
-      ResourceAlreadyExistsException, UnsupportedPropertyException,
-      SystemException, AmbariException, NoSuchResourceException, NoSuchFieldException, IllegalAccessException {
+  public void testJMXPortMapInitAtServiceLevelVersion1() throws Exception {
 
     createHDFSServiceConfigs(true);
 
@@ -459,19 +451,16 @@ public class JMXHostProviderTest {
     providerModule.registerResourceProvider(Resource.Type.Service);
     providerModule.registerResourceProvider(Resource.Type.Configuration);
     // Non default port addresses
-    Assert.assertEquals("70070", providerModule.getPort("c1", "NAMENODE", "localhost"));
-    Assert.assertEquals("70075", providerModule.getPort("c1", "DATANODE", "localhost"));
+    Assert.assertEquals("70070", providerModule.getPort("c1", "NAMENODE", "localhost", false));
+    Assert.assertEquals("70075", providerModule.getPort("c1", "DATANODE", "localhost", false));
     // Default port addresses
-    Assert.assertEquals(null, providerModule.getPort("c1", "JOBTRACKER", "localhost"));
-    Assert.assertEquals(null, providerModule.getPort("c1", "TASKTRACKER", "localhost"));
-    Assert.assertEquals(null, providerModule.getPort("c1", "HBASE_MASTER", "localhost"));
+    Assert.assertEquals(null, providerModule.getPort("c1", "JOBTRACKER", "localhost", false));
+    Assert.assertEquals(null, providerModule.getPort("c1", "TASKTRACKER", "localhost", false));
+    Assert.assertEquals(null, providerModule.getPort("c1", "HBASE_MASTER", "localhost", false));
   }
 
   @Test
-  public void testJMXPortMapInitAtServiceLevelVersion2() throws
-      NoSuchParentResourceException,
-      ResourceAlreadyExistsException, UnsupportedPropertyException,
-      SystemException, AmbariException, NoSuchResourceException, NoSuchFieldException, IllegalAccessException {
+  public void testJMXPortMapInitAtServiceLevelVersion2() throws Exception {
 
     createHDFSServiceConfigs(false);
 
@@ -479,20 +468,16 @@ public class JMXHostProviderTest {
     providerModule.registerResourceProvider(Resource.Type.Service);
     providerModule.registerResourceProvider(Resource.Type.Configuration);
     // Non default port addresses
-    Assert.assertEquals("70071", providerModule.getPort("c1", "NAMENODE", "localhost"));
-    Assert.assertEquals("70075", providerModule.getPort("c1", "DATANODE", "localhost"));
+    Assert.assertEquals("70071", providerModule.getPort("c1", "NAMENODE", "localhost", false));
+    Assert.assertEquals("70075", providerModule.getPort("c1", "DATANODE", "localhost", false));
     // Default port addresses
-    Assert.assertEquals(null, providerModule.getPort("c1", "JOBTRACKER", "localhost"));
-    Assert.assertEquals(null, providerModule.getPort("c1", "TASKTRACKER", "localhost"));
-    Assert.assertEquals(null, providerModule.getPort("c1", "HBASE_MASTER", "localhost"));
+    Assert.assertEquals(null, providerModule.getPort("c1", "JOBTRACKER", "localhost", false));
+    Assert.assertEquals(null, providerModule.getPort("c1", "TASKTRACKER", "localhost", false));
+    Assert.assertEquals(null, providerModule.getPort("c1", "HBASE_MASTER", "localhost", false));
   }
 
   @Test
-  public void testJMXPortMapNameNodeHa() throws
-      NoSuchParentResourceException,
-      ResourceAlreadyExistsException, UnsupportedPropertyException,
-      SystemException, AmbariException, NoSuchResourceException, NoSuchFieldException, IllegalAccessException {
-
+  public void testJMXPortMapNameNodeHa() throws Exception {
     createConfigsNameNodeHa();
 
     JMXHostProviderModule providerModule = new JMXHostProviderModule(controller);
@@ -500,28 +485,24 @@ public class JMXHostProviderTest {
     providerModule.registerResourceProvider(Resource.Type.Configuration);
 
 
-    Assert.assertEquals("50071", providerModule.getPort("nnha", "NAMENODE", "h1"));
-    Assert.assertEquals("50072", providerModule.getPort("nnha", "NAMENODE", "h2"));
+    Assert.assertEquals("50071", providerModule.getPort("nnha", "NAMENODE", "h1", false));
+    Assert.assertEquals("50072", providerModule.getPort("nnha", "NAMENODE", "h2", false));
   }
 
   @Test
-  public void testJMXPortMapInitAtClusterLevel() throws
-      NoSuchParentResourceException,
-      ResourceAlreadyExistsException, UnsupportedPropertyException,
-      SystemException, AmbariException, NoSuchResourceException, NoSuchFieldException, IllegalAccessException {
-
+  public void testJMXPortMapInitAtClusterLevel() throws Exception {
     createConfigs();
 
     JMXHostProviderModule providerModule = new JMXHostProviderModule(controller);
     providerModule.registerResourceProvider(Resource.Type.Cluster);
     providerModule.registerResourceProvider(Resource.Type.Configuration);
     // Non default port addresses
-    Assert.assertEquals("70070", providerModule.getPort("c1", "NAMENODE", "localhost"));
-    Assert.assertEquals("70075", providerModule.getPort("c1", "DATANODE", "localhost"));
+    Assert.assertEquals("70070", providerModule.getPort("c1", "NAMENODE", "localhost", false));
+    Assert.assertEquals("70075", providerModule.getPort("c1", "DATANODE", "localhost", false));
     // Default port addresses
-    Assert.assertEquals(null, providerModule.getPort("c1", "JOBTRACKER", "localhost"));
-    Assert.assertEquals(null, providerModule.getPort("c1", "TASKTRACKER", "localhost"));
-    Assert.assertEquals(null, providerModule.getPort("c1", "HBASE_MASTER", "localhost"));
+    Assert.assertEquals(null, providerModule.getPort("c1", "JOBTRACKER", "localhost", false));
+    Assert.assertEquals(null, providerModule.getPort("c1", "TASKTRACKER", "localhost", false));
+    Assert.assertEquals(null, providerModule.getPort("c1", "HBASE_MASTER", "localhost", false));
   }
 
   @Test
@@ -552,10 +533,7 @@ public class JMXHostProviderTest {
   }
 
   @Test
-  public void testJMXHttpsPort() throws
-      NoSuchParentResourceException,
-      ResourceAlreadyExistsException, UnsupportedPropertyException,
-      SystemException, AmbariException, NoSuchResourceException, NoSuchFieldException, IllegalAccessException {
+  public void testJMXHttpsPort() throws Exception {
     createConfigs();
     JMXHostProviderModule providerModule = new JMXHostProviderModule(controller);
     providerModule.registerResourceProvider(Resource.Type.Cluster);
@@ -567,10 +545,7 @@ public class JMXHostProviderTest {
   }
 
   @Test
-  public void testJMXHistoryServerHttpsPort() throws
-      NoSuchParentResourceException,
-      ResourceAlreadyExistsException, UnsupportedPropertyException,
-      SystemException, AmbariException, NoSuchResourceException, NoSuchFieldException, IllegalAccessException {
+  public void testJMXHistoryServerHttpsPort() throws Exception {
     createConfigs();
     JMXHostProviderModule providerModule = new JMXHostProviderModule(controller);
     providerModule.registerResourceProvider(Resource.Type.Cluster);
@@ -581,10 +556,7 @@ public class JMXHostProviderTest {
   }
 
   @Test
-  public void testJMXJournalNodeHttpsPort() throws
-      NoSuchParentResourceException,
-      ResourceAlreadyExistsException, UnsupportedPropertyException,
-      SystemException, AmbariException, NoSuchResourceException, NoSuchFieldException, IllegalAccessException {
+  public void testJMXJournalNodeHttpsPort() throws Exception {
     createConfigs();
     JMXHostProviderModule providerModule = new JMXHostProviderModule(controller);
     providerModule.registerResourceProvider(Resource.Type.Cluster);
@@ -594,10 +566,7 @@ public class JMXHostProviderTest {
   }
 
   @Test
-  public void testJMXDataNodeHttpsPort() throws
-      NoSuchParentResourceException,
-      ResourceAlreadyExistsException, UnsupportedPropertyException,
-      SystemException, AmbariException, NoSuchResourceException, NoSuchFieldException, IllegalAccessException {
+  public void testJMXDataNodeHttpsPort() throws Exception {
     createConfigs();
     JMXHostProviderModule providerModule = new JMXHostProviderModule(controller);
     providerModule.registerResourceProvider(Resource.Type.Cluster);
@@ -607,10 +576,7 @@ public class JMXHostProviderTest {
   }
 
   @Test
-  public void testJMXHbaseMasterHttps() throws
-      NoSuchParentResourceException,
-      ResourceAlreadyExistsException, UnsupportedPropertyException,
-      SystemException, AmbariException, NoSuchResourceException, NoSuchFieldException, IllegalAccessException {
+  public void testJMXHbaseMasterHttps() throws Exception {
     createConfigs();
     JMXHostProviderModule providerModule = new JMXHostProviderModule(controller);
     providerModule.registerResourceProvider(Resource.Type.Cluster);
@@ -620,18 +586,14 @@ public class JMXHostProviderTest {
   }
 
   @Test
-  public void testJMXPortMapUpdate() throws
-      NoSuchParentResourceException,
-      ResourceAlreadyExistsException, UnsupportedPropertyException,
-      SystemException, AmbariException, NoSuchResourceException, NoSuchFieldException, IllegalAccessException {
-
+  public void testJMXPortMapUpdate() throws Exception {
     createConfigs();
 
     JMXHostProviderModule providerModule = new JMXHostProviderModule(controller);
     providerModule.registerResourceProvider(Resource.Type.Cluster);
     providerModule.registerResourceProvider(Resource.Type.Configuration);
     // Non default port addresses
-    Assert.assertEquals("8088", providerModule.getPort("c1", "RESOURCEMANAGER", "localhost"));
+    Assert.assertEquals("8088", providerModule.getPort("c1", "RESOURCEMANAGER", "localhost", false));
 
     Map<String, String> yarnConfigs = new HashMap<>();
     yarnConfigs.put(RESOURCEMANAGER_PORT, "localhost:50030");
@@ -642,15 +604,15 @@ public class JMXHostProviderTest {
     ClusterRequest crReq = new ClusterRequest(1L, "c1", null, null);
     crReq.setDesiredConfig(Collections.singletonList(cr2));
     controller.updateClusters(Collections.singleton(crReq), null);
-    Assert.assertEquals("50030", providerModule.getPort("c1", "RESOURCEMANAGER", "localhost"));
-    Assert.assertEquals("11111", providerModule.getPort("c1", "NODEMANAGER", "localhost"));
+    Assert.assertEquals("50030", providerModule.getPort("c1", "RESOURCEMANAGER", "localhost", false));
+    Assert.assertEquals("11111", providerModule.getPort("c1", "NODEMANAGER", "localhost", false));
 
     //Unrelated ports
-    Assert.assertEquals("70070", providerModule.getPort("c1", "NAMENODE", "localhost"));
-    Assert.assertEquals(null, providerModule.getPort("c1", "JOBTRACKER", "localhost"));
+    Assert.assertEquals("70070", providerModule.getPort("c1", "NAMENODE", "localhost", false));
+    Assert.assertEquals(null, providerModule.getPort("c1", "JOBTRACKER", "localhost", false));
 
     //test another host and component without property
-    Assert.assertNull(providerModule.getPort("c1", "HBASE_REGIONSERVER", "remotehost1"));
+    Assert.assertNull(providerModule.getPort("c1", "HBASE_REGIONSERVER", "remotehost1", false));
   }
 
   private static class JMXHostProviderModule extends AbstractProviderModule {
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 37f8a1c..809dc89 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
@@ -55,7 +55,6 @@ import org.apache.ambari.server.security.authorization.AuthorizationException;
 import org.apache.ambari.server.security.authorization.AuthorizationHelperInitializer;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
-import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.services.MetricsRetrievalService;
 import org.apache.ambari.server.utils.SynchronousThreadPoolExecutor;
 import org.junit.After;
@@ -628,18 +627,12 @@ public class JMXPropertyProviderTest {
       return null;
     }
 
-    @Override public Host getHost(final String clusterName, final String hostName) {
-      return null;
-    }
-
     @Override
-    public String getPort(String clusterName, String componentName, String hostName, boolean httpsEnabled) throws SystemException {
+    public String getPort(String clusterName, String componentName, String hostName, boolean httpsEnabled) {
       return getPort(clusterName, componentName, hostName);
     }
 
-    @Override
-    public String getPort(String clusterName, String componentName, String hostName) throws
-      SystemException {
+    public String getPort(String clusterName, String componentName, String hostName) {
 
       if (unknownPort) {
         return null;
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/alert/AlertUriTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/alert/MetricsUriTest.java
similarity index 91%
rename from ambari-server/src/test/java/org/apache/ambari/server/state/alert/AlertUriTest.java
rename to ambari-server/src/test/java/org/apache/ambari/server/state/alert/MetricsUriTest.java
index 295e364..282103f 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/alert/AlertUriTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/alert/MetricsUriTest.java
@@ -26,17 +26,17 @@ import java.util.Map;
 import org.apache.ambari.server.AmbariException;
 import org.junit.Test;
 
-public class AlertUriTest {
+public class MetricsUriTest {
   @Test
   public void testChoosesHttpByDefault() throws Exception {
-    AlertUri uri = new AlertUri();
+    MetricsUri uri = new MetricsUri();
     uri.setHttpUri("${config1/http-host}/path");
     assertThat(resolved(uri), is("http://http-host/path"));
   }
 
   @Test
   public void testChoosesHttpsBasedOnProperties() throws Exception {
-    AlertUri uri = new AlertUri();
+    MetricsUri uri = new MetricsUri();
     uri.setHttpUri("${config1/http-host}/path");
     uri.setHttpsUri("${config1/https-host}/path");
     uri.setHttpsProperty("${config1/use-http}");
@@ -54,7 +54,7 @@ public class AlertUriTest {
       }};
   }
 
-  private String resolved(AlertUri uri) throws AmbariException {
+  private String resolved(MetricsUri uri) throws AmbariException {
     return uri.resolve(config()).toString();
   }
 }
\ No newline at end of file
diff --git a/ambari-web/app/controllers/global/update_controller.js b/ambari-web/app/controllers/global/update_controller.js
index fb568ed..6a2458c 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -478,7 +478,7 @@ App.UpdateController = Em.Controller.extend({
       atsHandlerParam = isATSInstalled ? 'ServiceComponentInfo/component_name=APP_TIMELINE_SERVER|' : '',
       haComponents = App.get('isHaEnabled') ? 'ServiceComponentInfo/component_name=JOURNALNODE|ServiceComponentInfo/component_name=ZKFC|' : '',
       realUrl = '/components/?' + flumeHandlerParam + atsHandlerParam + haComponents +
-        'ServiceComponentInfo/category=MASTER&fields=' +
+        'ServiceComponentInfo/category.in(MASTER,CLIENT)&fields=' +
         'ServiceComponentInfo/service_name,' +
         'host_components/HostRoles/display_name,' +
         'host_components/HostRoles/host_name,' +
@@ -523,6 +523,7 @@ App.UpdateController = Em.Controller.extend({
     } else if (/^2.2/.test(App.get('currentStackVersionNumber'))) {
       serviceSpecificParams.STORM = 'metrics/api/v1/cluster/summary,metrics/api/v1/topology/summary';
     }
+    serviceSpecificParams.ONEFS = 'metrics/dfs/*,';
 
     App.cache.services.forEach(function (service) {
       var urlParams = serviceSpecificParams[service.ServiceInfo.service_name];
diff --git a/ambari-web/app/mappers/service_metrics_mapper.js b/ambari-web/app/mappers/service_metrics_mapper.js
index 4d319fc..cf19581 100644
--- a/ambari-web/app/mappers/service_metrics_mapper.js
+++ b/ambari-web/app/mappers/service_metrics_mapper.js
@@ -76,6 +76,23 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
     nfs_gateways_installed: 'nfs_gateways_installed',
     nfs_gateways_total: 'nfs_gateways_total'
   },
+  onefsConfig: {
+    metrics_not_available: 'metrics_not_available',
+    name_node_start_time: 'metrics.runtime.StartTime',
+    capacity_used: 'metrics.dfs.FSNamesystem.CapacityUsed',
+    capacity_total: 'metrics.dfs.FSNamesystem.CapacityTotal',
+    capacity_remaining: 'metrics.dfs.FSNamesystem.CapacityRemaining',
+    dfs_corrupt_blocks: 'metrics.dfs.FSNamesystem.CorruptBlocks',
+    dfs_under_replicated_blocks: 'metrics.dfs.FSNamesystem.UnderReplicatedBlocks',
+    dfs_missing_blocks: 'metrics.dfs.FSNamesystem.MissingBlocks',
+    live_data_nodes: 'live_data_nodes',
+    dead_data_nodes: 'dead_data_nodes',
+    decommission_data_nodes: 'decommission_data_nodes',
+    dfs_total_files: 'metrics.dfs.namenode.TotalFiles',
+    jvm_memory_heap_used: 'metrics.jvm.memHeapUsedM',
+    jvm_memory_heap_max: 'metrics.jvm.memHeapCommittedM',
+    upgrade_status: 'metrics.dfs.namenode.UpgradeFinalized'
+  },
   yarnConfig: {
     resource_manager_start_time: 'resourceManagerComponent.host_components[0].metrics.runtime.StartTime',
     jvm_memory_heap_used: 'resourceManagerComponent.host_components[0].metrics.jvm.HeapMemoryUsed',
@@ -295,6 +312,10 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
       finalJson = this.hdfsMapper(item);
       finalJson.rand = Math.random();
       App.store.safeLoad(App.HDFSService, finalJson);
+    } else if (item && item.ServiceInfo && item.ServiceInfo.service_name == "ONEFS") {
+      finalJson = this.onefsMapper(item);
+      finalJson.rand = Math.random();
+      App.store.safeLoad(App.ONEFSService, finalJson);
     } else if (item && item.ServiceInfo && item.ServiceInfo.service_name == "HBASE") {
       finalJson = this.hbaseMapper(item);
       finalJson.rand = Math.random();
@@ -418,6 +439,34 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
       finalJson.quick_links = quickLinks[item.ServiceInfo.service_name];
   },
 
+  onefsMapper: function (item) {
+    var finalConfig = jQuery.extend({}, this.config);
+    item.components.forEach(function (component) {
+      if (this.isHostComponentPresent(component, 'ONEFS_CLIENT')) {
+        item.metrics = component.metrics;
+        item.decommission_data_nodes = [];
+        item.dead_data_nodes = [];
+        item.live_data_nodes = [];
+        if (component.metrics && component.metrics.dfs && component.metrics.dfs.namenode) {
+          item.metrics_not_available = false;
+          for (var host in App.parseJSON(component.metrics.dfs.namenode.DecomNodes)) {
+            item.decommission_data_nodes.push('DATANODE' + '_' + host);
+          }
+          for (var host in App.parseJSON(component.metrics.dfs.namenode.DeadNodes)) {
+            item.dead_data_nodes.push('DATANODE' + '_' + host);
+          }
+          for (var host in App.parseJSON(component.metrics.dfs.namenode.LiveNodes)) {
+            item.live_data_nodes.push('DATANODE' + '_' + host);
+          }
+        } else {
+          item.metrics_not_available = true;
+        }
+        finalConfig = jQuery.extend(finalConfig, this.onefsConfig);
+      }
+    }, this);
+    return this.parseIt(item, finalConfig);
+  },
+
   hdfsMapper: function (item) {
     let finalConfig = jQuery.extend({}, this.config);
     // Change the JSON so that it is easy to map
diff --git a/ambari-web/app/models.js b/ambari-web/app/models.js
index 3b86782..7ebf9af 100644
--- a/ambari-web/app/models.js
+++ b/ambari-web/app/models.js
@@ -40,6 +40,7 @@ require('models/quicklinks/quick_links_config');
 require('models/service');
 require('models/service_audit');
 require('models/service/hdfs');
+require('models/service/onefs');
 require('models/service/yarn');
 require('models/service/mapreduce2');
 require('models/service/hbase');
diff --git a/ambari-web/app/models/service.js b/ambari-web/app/models/service.js
index f9bedb1..fa7d30c 100644
--- a/ambari-web/app/models/service.js
+++ b/ambari-web/app/models/service.js
@@ -254,6 +254,7 @@ App.Service.Health = {
  */
 App.Service.extendedModel = {
   'HDFS': 'HDFSService',
+  'ONEFS' : 'ONEFSService',
   'HBASE': 'HBaseService',
   'YARN': 'YARNService',
   'MAPREDUCE2': 'MapReduce2Service',
diff --git a/ambari-web/app/models/service/onefs.js b/ambari-web/app/models/service/onefs.js
new file mode 100644
index 0000000..a9d20ee
--- /dev/null
+++ b/ambari-web/app/models/service/onefs.js
@@ -0,0 +1,43 @@
+/**
+ * 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.
+ */
+
+var App = require('app');
+
+App.ONEFSService = App.Service.extend({
+  nameNodeStartTime: DS.attr('number'),
+  jvmMemoryHeapUsed: DS.attr('number'),
+  jvmMemoryHeapMax: DS.attr('number'),
+  capacityUsed: DS.attr('number'),
+  capacityTotal: DS.attr('number'),
+  capacityRemaining: DS.attr('number'),
+  capacityNonDfsUsed: DS.attr('number'),
+  dfsTotalBlocks: DS.attr('number'),
+  dfsCorruptBlocks: DS.attr('number'),
+  dfsMissingBlocks: DS.attr('number'),
+  dfsUnderReplicatedBlocks: DS.attr('number'),
+  dfsTotalFiles: DS.attr('number'),
+  metricsNotAvailable: DS.attr('boolean'),
+  decommissionDataNodes: DS.hasMany('App.HostComponent'),
+  liveDataNodes: DS.hasMany('App.HostComponent'),
+  deadDataNodes: DS.hasMany('App.HostComponent'),
+  upgradeStatus: DS.attr('string'),
+  nfsGatewaysStarted: DS.attr('number', {defaultValue: 0}),
+  nfsGatewaysInstalled: DS.attr('number', {defaultValue: 0}),
+  nfsGatewaysTotal: DS.attr('number', {defaultValue: 0})
+});
+
+App.ONEFSService.FIXTURES = [];
diff --git a/ambari-web/app/views/main/service/info/summary.js b/ambari-web/app/views/main/service/info/summary.js
index 193f96d..40f4721 100644
--- a/ambari-web/app/views/main/service/info/summary.js
+++ b/ambari-web/app/views/main/service/info/summary.js
@@ -78,6 +78,7 @@ App.MainServiceInfoSummaryView = Em.View.extend({
     return {
       HBASE: App.MainDashboardServiceHbaseView,
       HDFS: App.MainDashboardServiceHdfsView,
+      ONEFS: App.MainDashboardServiceHdfsView,
       STORM: App.MainDashboardServiceStormView,
       YARN: App.MainDashboardServiceYARNView,
       RANGER: App.MainDashboardServiceRangerView,
diff --git a/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/metrics.json b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/metrics.json
index daba529..c0647f3 100644
--- a/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/metrics.json
+++ b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/metrics.json
@@ -2,6 +2,111 @@
   "ONEFS_CLIENT" : {
     "Component" : [
       {
+        "type" : "jmx",
+        "jmx_source_uri": {
+          "http": "${hdfs-site/dfs.namenode.http-address}",
+          "https": "${hdfs-site/dfs.namenode.https-address}",
+          "https_property": "${hdfs-site/dfs.http.policy}",
+          "https_property_value": "HTTPS_ONLY",
+          "connection_timeout": 5.0
+        },
+        "metrics": {
+          "default": {
+            "metrics/runtime/StartTime": {
+              "metric": "java.lang:type=Runtime.StartTime",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/dfs/namenode/TotalFiles": {
+              "metric": "Hadoop:service=NameNode,name=NameNodeInfo.TotalFiles",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/dfs/namenode/UpgradeFinalized": {
+              "metric": "Hadoop:service=NameNode,name=NameNodeInfo.UpgradeFinalized",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/dfs/namenode/DecomNodes": {
+              "metric": "Hadoop:service=NameNode,name=NameNodeInfo.DecomNodes",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/dfs/namenode/LiveNodes": {
+              "metric": "Hadoop:service=NameNode,name=NameNodeInfo.LiveNodes",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/dfs/namenode/DeadNodes": {
+              "metric": "Hadoop:service=NameNode,name=NameNodeInfo.DeadNodes",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/jvm/gcCount": {
+              "metric": "Hadoop:service=NameNode,name=JvmMetrics.GcCount",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/jvm/memHeapUsedM": {
+              "metric": "Hadoop:service=NameNode,name=JvmMetrics.MemHeapUsedM",
+              "unit": "MB",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/jvm/memHeapCommittedM": {
+              "metric": "Hadoop:service=NameNode,name=JvmMetrics.MemHeapCommittedM",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/jvm/GcTimeMillisConcurrentMarkSweep": {
+              "metric": "Hadoop:service=NameNode,name=JvmMetrics.GcTimeMillisConcurrentMarkSweep",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/jvm/GcCountConcurrentMarkSweep": {
+              "metric": "Hadoop:service=NameNode,name=JvmMetrics.GcCountConcurrentMarkSweep",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/dfs/FSNamesystem/CapacityNonDFSUsed": {
+              "metric": "Hadoop:service=NameNode,name=FSNamesystem.CapacityNonDFSUsed",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/dfs/FSNamesystem/MissingBlocks": {
+              "metric": "Hadoop:service=NameNode,name=FSNamesystem.MissingBlocks",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/dfs/FSNamesystem/CorruptBlocks": {
+              "metric": "Hadoop:service=NameNode,name=FSNamesystem.CorruptBlocks",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/dfs/FSNamesystem/UnderReplicatedBlocks": {
+              "metric": "Hadoop:service=NameNode,name=FSNamesystem.UnderReplicatedBlocks",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/dfs/FSNamesystem/CapacityTotal": {
+              "metric": "Hadoop:service=NameNode,name=FSNamesystem.CapacityTotal",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/dfs/FSNamesystem/CapacityUsed": {
+              "metric": "Hadoop:service=NameNode,name=FSNamesystem.CapacityUsed",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/dfs/FSNamesystem/CapacityRemaining": {
+              "metric": "Hadoop:service=NameNode,name=FSNamesystem.CapacityRemaining",
+              "pointInTime": true,
+              "temporal": false
+            }
+          }
+        }
+      },
+      {
         "type" : "ganglia",
         "properties" : {
           "overridden_host" : "${core-site/fs.defaultFS}"

-- 
To stop receiving notification emails like this one, please contact
amagyar@apache.org.

[ambari] 03/04: AMBARI-22755. Show OneFS JMX metrics on the UI (amagyar)

Posted by am...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

amagyar pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git

commit a6dd77afacbbc348aaa0f6c3b2c666f40269f3fe
Author: Attila Magyar <am...@hortonworks.com>
AuthorDate: Mon Mar 12 13:51:51 2018 +0100

    AMBARI-22755. Show OneFS JMX metrics on the UI (amagyar)
---
 .../server/controller/internal/ConfigBasedJmxHostProvider.java | 10 +++++-----
 .../controller/internal/StackDefinedPropertyProvider.java      |  6 +++---
 .../java/org/apache/ambari/server/state/alert/AmsSource.java   |  4 ++--
 .../org/apache/ambari/server/state/alert/MetricSource.java     |  4 ++--
 .../org/apache/ambari/server/state/alert/ServerSource.java     |  4 ++--
 .../server/state/alert/{MetricsUri.java => UriInfo.java}       |  6 +++---
 .../java/org/apache/ambari/server/state/alert/WebSource.java   |  4 ++--
 .../org/apache/ambari/server/state/stack/MetricDefinition.java |  6 +++---
 .../controller/internal/ConfigBasedJmxHostProviderTest.java    |  8 ++++----
 .../state/alert/{MetricsUriTest.java => UriInfoTest.java}      |  8 ++++----
 10 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProvider.java
index 17ac1fe..ff513c5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProvider.java
@@ -30,17 +30,17 @@ import java.util.Set;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.controller.jmx.JMXHostProvider;
 import org.apache.ambari.server.state.ConfigHelper;
-import org.apache.ambari.server.state.alert.MetricsUri;
+import org.apache.ambari.server.state.alert.UriInfo;
 
 /**
  * I'm a special {@link JMXHostProvider} that resolves JMX URIs based on cluster configuration.
  */
 public class ConfigBasedJmxHostProvider implements JMXHostProvider {
-  private final Map<String, MetricsUri> overriddenJmxUris;
+  private final Map<String, UriInfo> overriddenJmxUris;
   private final JMXHostProvider defaultProvider;
   private final ConfigHelper configHelper;
 
-  public ConfigBasedJmxHostProvider(Map<String, MetricsUri> overriddenJmxUris, JMXHostProvider defaultProvider, ConfigHelper configHelper) {
+  public ConfigBasedJmxHostProvider(Map<String, UriInfo> overriddenJmxUris, JMXHostProvider defaultProvider, ConfigHelper configHelper) {
     this.overriddenJmxUris = overriddenJmxUris;
     this.defaultProvider = defaultProvider;
     this.configHelper = configHelper;
@@ -58,7 +58,7 @@ public class ConfigBasedJmxHostProvider implements JMXHostProvider {
       .orElseGet(() -> defaultProvider.getHostNames(clusterName, componentName));
   }
 
-  private URI resolve(MetricsUri uri, String clusterName) {
+  private URI resolve(UriInfo uri, String clusterName) {
     try {
       return uri.resolve(config(clusterName));
     } catch (AmbariException e) {
@@ -85,7 +85,7 @@ public class ConfigBasedJmxHostProvider implements JMXHostProvider {
     return defaultProvider.getJMXRpcMetricTag(clusterName, componentName, port);
   }
 
-  private Optional<MetricsUri> overridenJmxUri(String component) {
+  private Optional<UriInfo> overridenJmxUri(String component) {
     return Optional.ofNullable(overriddenJmxUris.get(component));
   }
 
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProvider.java
index 34936a9..99ad46f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProvider.java
@@ -50,7 +50,7 @@ import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.ConfigHelper;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.StackId;
-import org.apache.ambari.server.state.alert.MetricsUri;
+import org.apache.ambari.server.state.alert.UriInfo;
 import org.apache.ambari.server.state.stack.Metric;
 import org.apache.ambari.server.state.stack.MetricDefinition;
 import org.slf4j.Logger;
@@ -158,7 +158,7 @@ public class StackDefinedPropertyProvider implements PropertyProvider {
 
     List<PropertyProvider> additional = new ArrayList<>();
     Map<String, String> overriddenHosts = new HashMap<>();
-    Map<String, MetricsUri> overriddenJmxUris = new HashMap<>();
+    Map<String, UriInfo> overriddenJmxUris = new HashMap<>();
 
     try {
       for (Resource r : resources) {
@@ -250,7 +250,7 @@ public class StackDefinedPropertyProvider implements PropertyProvider {
     return resources;
   }
 
-  private JMXHostProvider jmxHostProvider(Map<String, MetricsUri> overriddenJmxUris, JMXHostProvider defaultProvider, ConfigHelper configHelper) {
+  private JMXHostProvider jmxHostProvider(Map<String, UriInfo> overriddenJmxUris, JMXHostProvider defaultProvider, ConfigHelper configHelper) {
     return overriddenJmxUris.isEmpty() ? defaultProvider : new ConfigBasedJmxHostProvider(overriddenJmxUris, defaultProvider, configHelper);
   }
 
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AmsSource.java b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AmsSource.java
index 3a3ec2f..f739115 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AmsSource.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AmsSource.java
@@ -34,7 +34,7 @@ import com.google.gson.annotations.SerializedName;
 public class AmsSource extends Source {
 
   @SerializedName("uri")
-  private MetricsUri uri = null;
+  private UriInfo uri = null;
 
   @SerializedName("ams")
   private AmsInfo amsInfo = null;
@@ -51,7 +51,7 @@ public class AmsSource extends Source {
    * @return the uri info, which may include port information
    */
   @JsonProperty("uri")
-  public MetricsUri getUri() {
+  public UriInfo getUri() {
     return uri;
   }
 
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricSource.java b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricSource.java
index 8107383..ff7565e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricSource.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricSource.java
@@ -43,7 +43,7 @@ import com.google.gson.annotations.SerializedName;
 public class MetricSource extends Source {
 
   @SerializedName("uri")
-  private MetricsUri uri = null;
+  private UriInfo uri = null;
 
   @SerializedName("jmx")
   private JmxInfo jmxInfo = null;
@@ -71,7 +71,7 @@ public class MetricSource extends Source {
    * @return the uri info, which may include port information
    */
   @JsonProperty("uri")
-  public MetricsUri getUri() {
+  public UriInfo getUri() {
     return uri;
   }
 
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/ServerSource.java b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/ServerSource.java
index 19e7ae6..642428e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/ServerSource.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/ServerSource.java
@@ -34,7 +34,7 @@ public class ServerSource extends ParameterizedSource {
   private String m_class;
 
   @SerializedName("uri")
-  private MetricsUri uri = null;
+  private UriInfo uri = null;
 
   @SerializedName("jmx")
   private MetricSource.JmxInfo jmxInfo = null;
@@ -52,7 +52,7 @@ public class ServerSource extends ParameterizedSource {
     return jmxInfo;
   }
 
-  public MetricsUri getUri() {
+  public UriInfo getUri() {
     return uri;
   }
 
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricsUri.java b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/UriInfo.java
similarity index 98%
rename from ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricsUri.java
rename to ambari-server/src/main/java/org/apache/ambari/server/state/alert/UriInfo.java
index 0e52fd6..a2f1497 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricsUri.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/UriInfo.java
@@ -29,7 +29,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
 import com.google.gson.annotations.SerializedName;
 
 /**
- * The {@link MetricsUri} class is used to represent a complex URI structure where
+ * The {@link UriInfo} class is used to represent a complex URI structure where
  * there can be both a plaintext and SSL URI. This is used in cases where the
  * alert definition needs a way to expose which URL (http or https) should be
  * used to gather data. Currently, only {@link MetricSource} uses this, but it
@@ -37,7 +37,7 @@ import com.google.gson.annotations.SerializedName;
  * URI.
  */
 @JsonInclude(JsonInclude.Include.NON_EMPTY)
-public class MetricsUri {
+public class UriInfo {
   /**
    * The HTTP URI to use.
    */
@@ -374,7 +374,7 @@ public class MetricsUri {
       return false;
     }
 
-    MetricsUri other = (MetricsUri) obj;
+    UriInfo other = (UriInfo) obj;
     if (m_httpUri == null) {
       if (other.m_httpUri != null) {
         return false;
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/WebSource.java b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/WebSource.java
index 9accae3..16d8aad 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/WebSource.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/WebSource.java
@@ -33,13 +33,13 @@ import com.google.gson.annotations.SerializedName;
 public class WebSource extends Source {
 
   @SerializedName("uri")
-  private MetricsUri uri = null;
+  private UriInfo uri = null;
 
   /**
    * @return the uri info, which may include port information
    */
   @JsonProperty("uri")
-  public MetricsUri getUri() {
+  public UriInfo getUri() {
     return uri;
   }
 
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/MetricDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/MetricDefinition.java
index 08902d8..ed3c2a2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/MetricDefinition.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/MetricDefinition.java
@@ -24,7 +24,7 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Optional;
 
-import org.apache.ambari.server.state.alert.MetricsUri;
+import org.apache.ambari.server.state.alert.UriInfo;
 import org.codehaus.jackson.annotate.JsonIgnore;
 import org.codehaus.jackson.annotate.JsonProperty;
 
@@ -39,7 +39,7 @@ public class MetricDefinition {
   private Map<String, String> properties = null;
   private Map<String, Map<String, Metric>> metrics = null;
   @SerializedName("jmx_source_uri")
-  private MetricsUri jmxSourceUri;
+  private UriInfo jmxSourceUri;
 
   public MetricDefinition(String type, Map<String, String> properties, Map<String, Map<String, Metric>> metrics) {
     this.type = type;
@@ -88,7 +88,7 @@ public class MetricDefinition {
       : Optional.ofNullable(properties.get(OVERRIDDEN_HOST_PROP));
   }
 
-  public Optional<MetricsUri> getJmxSourceUri() {
+  public Optional<UriInfo> getJmxSourceUri() {
     return !"jmx".equalsIgnoreCase(type) ? Optional.empty() : Optional.ofNullable(jmxSourceUri);
   }
 }
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProviderTest.java
index ca4b4e4..3e86b63 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProviderTest.java
@@ -32,7 +32,7 @@ import java.util.Set;
 
 import org.apache.ambari.server.controller.jmx.JMXHostProvider;
 import org.apache.ambari.server.state.ConfigHelper;
-import org.apache.ambari.server.state.alert.MetricsUri;
+import org.apache.ambari.server.state.alert.UriInfo;
 import org.easymock.EasyMockRule;
 import org.easymock.EasyMockSupport;
 import org.easymock.Mock;
@@ -75,10 +75,10 @@ public class ConfigBasedJmxHostProviderTest extends EasyMockSupport {
     verifyAll();
   }
 
-  private Map<String, MetricsUri> overrideHosts() {
-    MetricsUri uri = new MetricsUri();
+  private Map<String, UriInfo> overrideHosts() {
+    UriInfo uri = new UriInfo();
     uri.setHttpUri("${hdfs-site/dfs.namenode.http-address}");
-    return new HashMap<String, MetricsUri>() {{
+    return new HashMap<String, UriInfo>() {{
       put(COMPONENT_WITH_OVERRIDDEN_HOST, uri);
     }};
   }
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/alert/MetricsUriTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/alert/UriInfoTest.java
similarity index 91%
rename from ambari-server/src/test/java/org/apache/ambari/server/state/alert/MetricsUriTest.java
rename to ambari-server/src/test/java/org/apache/ambari/server/state/alert/UriInfoTest.java
index 282103f..c37b2ca 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/alert/MetricsUriTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/alert/UriInfoTest.java
@@ -26,17 +26,17 @@ import java.util.Map;
 import org.apache.ambari.server.AmbariException;
 import org.junit.Test;
 
-public class MetricsUriTest {
+public class UriInfoTest {
   @Test
   public void testChoosesHttpByDefault() throws Exception {
-    MetricsUri uri = new MetricsUri();
+    UriInfo uri = new UriInfo();
     uri.setHttpUri("${config1/http-host}/path");
     assertThat(resolved(uri), is("http://http-host/path"));
   }
 
   @Test
   public void testChoosesHttpsBasedOnProperties() throws Exception {
-    MetricsUri uri = new MetricsUri();
+    UriInfo uri = new UriInfo();
     uri.setHttpUri("${config1/http-host}/path");
     uri.setHttpsUri("${config1/https-host}/path");
     uri.setHttpsProperty("${config1/use-http}");
@@ -54,7 +54,7 @@ public class MetricsUriTest {
       }};
   }
 
-  private String resolved(MetricsUri uri) throws AmbariException {
+  private String resolved(UriInfo uri) throws AmbariException {
     return uri.resolve(config()).toString();
   }
 }
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
amagyar@apache.org.

[ambari] 02/04: AMBARI-22755. Show OneFS JMX metrics on the UI (amagyar)

Posted by am...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

amagyar pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git

commit 0c142208035d3d5f7837a5d3f16cd2c52fc7708f
Author: Attila Magyar <am...@hortonworks.com>
AuthorDate: Thu Mar 8 13:14:49 2018 +0100

     AMBARI-22755. Show OneFS JMX metrics on the UI (amagyar)
---
 .../ambari/server/controller/internal/ConfigBasedJmxHostProvider.java   | 2 +-
 .../server/controller/internal/OverriddenMetricsHostProviderTest.java   | 2 +-
 .../internal/RootServiceComponentConfigurationResourceProviderTest.java | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProvider.java
index 62b292f..17ac1fe 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProvider.java
@@ -20,7 +20,7 @@
 
 package org.apache.ambari.server.controller.internal;
 
-import static edu.emory.mathcs.backport.java.util.Collections.singleton;
+import static java.util.Collections.singleton;
 
 import java.net.URI;
 import java.util.Map;
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/OverriddenMetricsHostProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/OverriddenMetricsHostProviderTest.java
index cf4b131..3026b29 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/OverriddenMetricsHostProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/OverriddenMetricsHostProviderTest.java
@@ -17,7 +17,7 @@
  */
 package org.apache.ambari.server.controller.internal;
 
-import static edu.emory.mathcs.backport.java.util.Collections.emptyMap;
+import static java.util.Collections.emptyMap;
 import static org.easymock.EasyMock.expect;
 import static org.hamcrest.core.Is.is;
 import static org.junit.Assert.assertThat;
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationResourceProviderTest.java
index 6dbdd65..8f9ac7e 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationResourceProviderTest.java
@@ -28,6 +28,7 @@ import static org.easymock.EasyMock.newCapture;
 import java.io.File;
 import java.nio.charset.Charset;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -74,7 +75,6 @@ import com.google.inject.AbstractModule;
 import com.google.inject.Guice;
 import com.google.inject.Injector;
 
-import edu.emory.mathcs.backport.java.util.Collections;
 import junit.framework.Assert;
 import junit.framework.AssertionFailedError;
 

-- 
To stop receiving notification emails like this one, please contact
amagyar@apache.org.