ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject git commit: AMBARI-8118. HostComponent requests that include Nagios are not performant (ncole)
Date Mon, 03 Nov 2014 18:49:33 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-1.7.0 662896818 -> de94405b2


AMBARI-8118.  HostComponent requests that include Nagios are not performant (ncole)


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

Branch: refs/heads/branch-1.7.0
Commit: de94405b244322a0de6e67f399398bafade0e574
Parents: 6628968
Author: Nate Cole <ncole@hortonworks.com>
Authored: Mon Nov 3 12:23:58 2014 -0500
Committer: Nate Cole <ncole@hortonworks.com>
Committed: Mon Nov 3 13:49:19 2014 -0500

----------------------------------------------------------------------
 .../internal/HostComponentResourceProvider.java |  2 -
 .../internal/HttpProxyPropertyProvider.java     | 10 +-
 .../internal/HttpPropertyProviderTest.java      | 98 ++------------------
 3 files changed, 7 insertions(+), 103 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/de94405b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
index 732203a..4600538 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
@@ -122,8 +122,6 @@ public class HostComponentResourceProvider extends AbstractControllerResourcePro
             PropertyHelper.getPropertyId("HostRoles", "host_name"),
             PropertyHelper.getPropertyId("HostRoles", "component_name"));
 
-    HOST_COMPONENT_PROPERTIES_PROVIDER.put("NAGIOS_SERVER", httpPropertyProvider);
-
     HOST_COMPONENT_PROPERTIES_PROVIDER.put("RESOURCEMANAGER", httpPropertyProvider);
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/de94405b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HttpProxyPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HttpProxyPropertyProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HttpProxyPropertyProvider.java
index ca2bd52..302a54b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HttpProxyPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HttpProxyPropertyProvider.java
@@ -58,7 +58,6 @@ public class HttpProxyPropertyProvider extends BaseProvider implements PropertyP
   private static final Map<String, String> PROPERTIES_TO_FILTER = new HashMap<String,
String>();
 
   private static final String COMPONENT_RESOURCEMANAGER = "RESOURCEMANAGER";
-  private static final String COMPONENT_NAGIOS_SERVER = "NAGIOS_SERVER";
   private static final String CONFIG_YARN_SITE = "yarn-site";
   private static final String CONFIG_CORE_SITE = "core-site";
   private static final String PROPERTY_YARN_HTTP_POLICY = "yarn.http.policy";
@@ -67,11 +66,8 @@ public class HttpProxyPropertyProvider extends BaseProvider implements
PropertyP
   private static final String PROPERTY_HADOOP_SSL_ENABLED_VALUE_TRUE = "true";
 
   static {
-    URL_TEMPLATES.put(COMPONENT_NAGIOS_SERVER, "http://%s/ambarinagios/nagios/nagios_alerts.php?q1=alerts&"
+
-            "alert_type=all");
     URL_TEMPLATES.put(COMPONENT_RESOURCEMANAGER, "http://%s:8088/ws/v1/cluster/info");
     
-    MAPPINGS.put(COMPONENT_NAGIOS_SERVER, PropertyHelper.getPropertyId("HostRoles", "nagios_alerts"));
     MAPPINGS.put(COMPONENT_RESOURCEMANAGER, PropertyHelper.getPropertyId("HostRoles", "ha_state"));
 
     PROPERTIES_TO_FILTER.put(COMPONENT_RESOURCEMANAGER, "clusterInfo/haState");
@@ -143,11 +139,7 @@ public class HttpProxyPropertyProvider extends BaseProvider implements
PropertyP
   private String getTemplate(String componentName, String clusterName) throws SystemException
{
     String template = URL_TEMPLATES.get(componentName);
 
-    if (componentName.equals(COMPONENT_NAGIOS_SERVER)) {
-      if (configuration.isNagiosSSL()) {
-        template = template.replace("http", "https");
-      }
-    } else if (componentName.equals(COMPONENT_RESOURCEMANAGER)) {
+    if (componentName.equals(COMPONENT_RESOURCEMANAGER)) {
       try {
         Cluster cluster = this.clusters.getCluster(clusterName);
         Map<String, String> yarnConfigProperties = cluster.getDesiredConfigByType(CONFIG_YARN_SITE).getProperties();

http://git-wip-us.apache.org/repos/asf/ambari/blob/de94405b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HttpPropertyProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HttpPropertyProviderTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HttpPropertyProviderTest.java
index bf3550f..2cc788a 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HttpPropertyProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HttpPropertyProviderTest.java
@@ -18,19 +18,20 @@
 package org.apache.ambari.server.controller.internal;
 
 
+import static org.easymock.EasyMock.createNiceMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Arrays;
-import java.util.HashMap;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
+import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 
-import com.google.inject.Injector;
 import org.apache.ambari.server.configuration.ComponentSSLConfiguration;
 import org.apache.ambari.server.configuration.ComponentSSLConfigurationTest;
 import org.apache.ambari.server.controller.spi.Request;
@@ -45,9 +46,7 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
+import com.google.inject.Injector;
 
 @RunWith(Parameterized.class)
 public class HttpPropertyProviderTest {
@@ -127,91 +126,6 @@ public class HttpPropertyProviderTest {
   }
 
   @Test
-  public void testReadNagiosServer() throws Exception {
-
-    TestStreamProvider streamProvider = new TestStreamProvider(false);
-
-    Resource resource = doPopulate("NAGIOS_SERVER", Collections.<String>emptySet(),
streamProvider);
-    
-    Assert.assertNotNull("Expected non-null for 'nagios_alerts'",
-      resource.getPropertyValue(PROPERTY_ID_NAGIOS_ALERTS));
-
-    Assert.assertEquals(configuration.isNagiosSSL(), streamProvider.getLastSpec().startsWith("https"));
-  }
-  
-  @Test
-  public void testReadNotRequested() throws Exception {
-   
-   Set<String> propertyIds = new HashSet<String>();
-   propertyIds.add(PropertyHelper.getPropertyId("HostRoles", "state"));
-   propertyIds.add(PROPERTY_ID_COMPONENT_NAME);
-   
-   Resource resource = doPopulate("NAGIOS_SERVER", propertyIds, new TestStreamProvider(false));
-   
-   Assert.assertNull("Expected null for 'nagios_alerts'",
-     resource.getPropertyValue(PROPERTY_ID_NAGIOS_ALERTS));    
-  }
-  
-  @Test
-  public void testReadWithRequested() throws Exception {
-    
-   Set<String> propertyIds = new HashSet<String>();
-   propertyIds.add(PropertyHelper.getPropertyId("HostRoles", "nagios_alerts"));
-   propertyIds.add(PROPERTY_ID_COMPONENT_NAME);
-   
-   Resource resource = doPopulate("NAGIOS_SERVER", propertyIds, new TestStreamProvider(false));
-   
-   Assert.assertNotNull("Expected non-null for 'nagios_alerts'",
-     resource.getPropertyValue(PROPERTY_ID_NAGIOS_ALERTS));        
-  }
-  
-  @Test
-  public void testReadWithRequestedFail() throws Exception {
-    
-   Set<String> propertyIds = new HashSet<String>();
-   propertyIds.add(PropertyHelper.getPropertyId("HostRoles", "nagios_alerts"));
-   propertyIds.add(PROPERTY_ID_COMPONENT_NAME);
-   
-   Resource resource = doPopulate("NAGIOS_SERVER", propertyIds, new TestStreamProvider(true));
-
-   Assert.assertNull("Expected null for 'nagios_alerts'",
-       resource.getPropertyValue(PROPERTY_ID_NAGIOS_ALERTS));        
-  }
-
-  @SuppressWarnings("rawtypes")
-  @Test
-  public void testReadWithRequestedJson() throws Exception {
-
-    Set<String> propertyIds = new HashSet<String>();
-    propertyIds.add(PropertyHelper.getPropertyId("HostRoles", "nagios_alerts"));
-    propertyIds.add(PROPERTY_ID_COMPONENT_NAME);
-    Resource resource = doPopulate("NAGIOS_SERVER", propertyIds, new TestStreamProvider(false));
-    Object propertyValue = resource.getPropertyValue(PROPERTY_ID_NAGIOS_ALERTS);
-
-    Assert.assertNotNull("Expected non-null for 'nagios_alerts'", propertyValue);
-    Assert.assertTrue("Expected Map for parsed JSON", propertyValue instanceof Map);
-    
-    Object alertsEntry = ((Map) propertyValue).get("alerts");
-    Object hostcountsEntry = ((Map) propertyValue).get("hostcounts");
-    
-    Assert.assertNotNull("Expected non-null for 'alerts' entry", alertsEntry);
-    Assert.assertNotNull("Expected non-null for 'hostcounts' entry", hostcountsEntry);
-    Assert.assertTrue("Expected List type for 'alerts' entry", alertsEntry instanceof List);
-    Assert.assertTrue("Expected Map type for 'hostcounts' entry", hostcountsEntry instanceof
Map);
-    
-    List alertsList = (List) alertsEntry;
-    Map hostcountsMap = (Map) hostcountsEntry;
-    
-    Assert.assertEquals("Expected number of entries in 'alerts' is 1", 1, alertsList.size());
-    Assert.assertTrue("Expected Map type for 'alerts' element", alertsList.get(0) instanceof
Map);
-    Assert.assertEquals("Body", ((Map) alertsList.get(0)).get("Alert Body"));
-    
-    Assert.assertEquals("Expected number of entries in 'hostcounts' is 2", 2, hostcountsMap.size());
-    Assert.assertEquals("1", hostcountsMap.get("up_hosts"));
-    Assert.assertEquals("0", hostcountsMap.get("down_hosts"));
-  }
-
-  @Test
   public void testReadGangliaServer() throws Exception {
     
     Resource resource = doPopulate("GANGLIA_SERVER", Collections.<String>emptySet(),
new TestStreamProvider(false));


Mime
View raw message