You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sm...@apache.org on 2013/04/24 19:19:14 UTC

svn commit: r1471547 - in /incubator/ambari/trunk: ./ ambari-agent/src/main/puppet/modules/hdp-nagios/manifests/ ambari-agent/src/main/puppet/modules/hdp-nagios/templates/ ambari-agent/src/main/puppet/modules/hdp/manifests/ ambari-server/src/main/java/...

Author: smohanty
Date: Wed Apr 24 17:19:14 2013
New Revision: 1471547

URL: http://svn.apache.org/r1471547
Log:
AMBARI-2012. Check Ambari-agent process - nagios alert is only being configured on the nagios-server host. (smohanty)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-nagios/manifests/params.pp
    incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/hadoop-services.cfg.erb
    incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/manifests/configfile.pp
    incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp
    incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
    incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java
    incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/utils/TestStageUtils.java

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1471547&r1=1471546&r2=1471547&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Wed Apr 24 17:19:14 2013
@@ -786,6 +786,9 @@ Trunk (unreleased changes):
 
  BUG FIXES
 
+ AMBARI-2012. Check Ambari-agent process - nagios alert is only being
+ configured on the nagios-server host. (smohanty)
+
  AMBARI-2001. Filtering on Jobs table does not work under certain situations.
  (yusaku)
 

Modified: incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-nagios/manifests/params.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-nagios/manifests/params.pp?rev=1471547&r1=1471546&r2=1471547&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-nagios/manifests/params.pp (original)
+++ incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-nagios/manifests/params.pp Wed Apr 24 17:19:14 2013
@@ -76,6 +76,7 @@ class hdp-nagios::params() inherits hdp:
     snamenode => {host_member_info => 'snamenode_host'},
     slaves => {host_member_info => 'slave_hosts'},
     tasktracker-servers => {host_member_info => 'mapred_tt_hosts'},
+    agent-servers => {host_member_info => 'all_hosts'},
     nagios-server => {host_member_info => 'nagios_server_host'},
     jobtracker  => {host_member_info => 'jtnode_host'},
     ganglia-server => {host_member_info => 'ganglia_server_host'},

Modified: incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/hadoop-services.cfg.erb
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/hadoop-services.cfg.erb?rev=1471547&r1=1471546&r2=1471547&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/hadoop-services.cfg.erb (original)
+++ incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/hadoop-services.cfg.erb Wed Apr 24 17:19:14 2013
@@ -78,7 +78,7 @@ define service {
 
 # AMBARI AGENT Checks
 define service {
-        hostgroup_name          nagios-server
+        hostgroup_name          agent-servers
         use                     hadoop-service
         service_description     AMBARI::Check ambari-agent process
         servicegroups           AMBARI

Modified: incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/manifests/configfile.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/manifests/configfile.pp?rev=1471547&r1=1471546&r2=1471547&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/manifests/configfile.pp (original)
+++ incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/manifests/configfile.pp Wed Apr 24 17:19:14 2013
@@ -31,6 +31,7 @@ define hdp::configfile(
   $snamenode_host = $hdp::params::snamenode_host,
   $slave_hosts = $hdp::params::slave_hosts,
   $mapred_tt_hosts = $hdp::params::mapred_tt_hosts,
+  $all_hosts = $hdp::params::all_hosts,
   $hbase_rs_hosts = $hdp::params::hbase_rs_hosts,
   $zookeeper_hosts = $hdp::params::zookeeper_hosts,
   $hbase_master_hosts = $hdp::params::hbase_master_hosts,

Modified: incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp?rev=1471547&r1=1471546&r2=1471547&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp (original)
+++ incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp Wed Apr 24 17:19:14 2013
@@ -71,6 +71,8 @@ class hdp::params()
   #if mapred_tt_hosts not given it is assumed that tasktracker servers on same nodes as slaves
   $mapred_tt_hosts = hdp_default("mapred_tt_hosts", $slave_hosts)
 
+  $all_hosts = hdp_default("all_hosts")
+
   $hive_server_host = hdp_default("hive_server_host", "")
   $oozie_server =  hdp_default("oozie_server", "")
   $webhcat_server_host = hdp_default("webhcat_server_host", "")

Modified: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java?rev=1471547&r1=1471546&r2=1471547&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java (original)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java Wed Apr 24 17:19:14 2013
@@ -922,7 +922,8 @@ public class AmbariManagementControllerI
 
     // Generate cluster host info
     execCmd.setClusterHostInfo(
-        StageUtils.getClusterHostInfo(cluster, hostsMap, injector));
+        StageUtils.getClusterHostInfo(
+            clusters.getHostsForCluster(cluster.getClusterName()), cluster, hostsMap, injector));
 
     Host host = clusters.getHost(scHost.getHostName());
 
@@ -2194,7 +2195,8 @@ public class AmbariManagementControllerI
         // Generate cluster host info
         stage.getExecutionCommandWrapper(clientHost, smokeTestRole)
             .getExecutionCommand()
-            .setClusterHostInfo(StageUtils.getClusterHostInfo(cluster, hostsMap, injector));
+            .setClusterHostInfo(StageUtils.getClusterHostInfo(
+                clusters.getHostsForCluster(cluster.getClusterName()), cluster, hostsMap, injector));
       }
 
       RoleGraph rg = new RoleGraph(rco);
@@ -4018,7 +4020,7 @@ public class AmbariManagementControllerI
 
     // Generate cluster host info
     execCmd.setClusterHostInfo(
-      StageUtils.getClusterHostInfo(clusters.getCluster(clusterName), hostsMap, injector));
+      StageUtils.getClusterHostInfo(clusters.getHostsForCluster(clusterName), cluster, hostsMap, injector));
   }
 
   private void addDecommissionDatanodeAction(

Modified: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java?rev=1471547&r1=1471546&r2=1471547&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java (original)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java Wed Apr 24 17:19:14 2013
@@ -34,6 +34,7 @@ import javax.xml.bind.JAXBException;
 
 import com.google.gson.Gson;
 import com.google.inject.Injector;
+import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.Role;
 import org.apache.ambari.server.RoleCommand;
 import org.apache.ambari.server.actionmanager.Stage;
@@ -41,6 +42,8 @@ import org.apache.ambari.server.agent.Ex
 import org.apache.ambari.server.configuration.Configuration;
 import org.apache.ambari.server.controller.HostsMap;
 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.ServiceComponent;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostInstallEvent;
 import org.apache.commons.logging.Log;
@@ -181,7 +184,9 @@ public class StageUtils {
   }
 
 
-  public static Map<String, List<String>> getClusterHostInfo(Cluster cluster, HostsMap hostsMap, Injector injector) {
+  public static Map<String, List<String>> getClusterHostInfo(
+      Map<String, Host> allHosts, Cluster cluster, HostsMap hostsMap,
+      Injector injector) throws AmbariException {
     Map<String, List<String>> info = new HashMap<String, List<String>>();
     if (cluster.getServices() != null) {
       for (String serviceName : cluster.getServices().keySet()) {
@@ -220,6 +225,14 @@ public class StageUtils {
         }
       }
     }
+
+    // Add a list of all host for agent and host monitoring
+    List<String> allHostNames = new ArrayList<String>();
+    for (Host host : allHosts.values()) {
+      allHostNames.add(host.getHostName());
+    }
+    info.put("all_hosts", allHostNames);
+
     return info;
   }
 

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/utils/TestStageUtils.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/utils/TestStageUtils.java?rev=1471547&r1=1471546&r2=1471547&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/utils/TestStageUtils.java (original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/utils/TestStageUtils.java Wed Apr 24 17:19:14 2013
@@ -188,26 +188,31 @@ public class TestStageUtils {
     fsm.addHost("h1");
     fsm.addHost("h2");
     fsm.addHost("h3");
+    fsm.addHost("h4");
     fsm.getCluster("c1").setDesiredStackVersion(new StackId("HDP-0.1"));
     fsm.getHost("h1").setOsType("centos5");
     fsm.getHost("h2").setOsType("centos5");
     fsm.getHost("h3").setOsType("centos5");
+    fsm.getHost("h4").setOsType("centos5");
     fsm.getHost("h1").persist();
     fsm.getHost("h2").persist();
     fsm.getHost("h3").persist();
+    fsm.getHost("h4").persist();
     fsm.mapHostToCluster("h1", "c1");
     fsm.mapHostToCluster("h2", "c1");
     fsm.mapHostToCluster("h3", "c1");
+    fsm.mapHostToCluster("h4", "c1");
     String [] hostList = {"h1", "h2", "h3" };
     addHdfsService(fsm.getCluster("c1"), hostList, injector);
     addHbaseService(fsm.getCluster("c1"), hostList, injector);
     addMapreduceService(fsm.getCluster("c1"), hostList, injector);
-    Map<String, List<String>> info = StageUtils.getClusterHostInfo(fsm
-        .getCluster("c1"), new HostsMap(injector.getInstance(Configuration.class)), injector);
+    Map<String, List<String>> info = StageUtils.getClusterHostInfo(fsm.getHostsForCluster("c1"),
+        fsm.getCluster("c1"), new HostsMap(injector.getInstance(Configuration.class)), injector);
     assertEquals(2, info.get("slave_hosts").size());
     assertEquals(2, info.get("mapred_tt_hosts").size());
     assertEquals(2, info.get("hbase_rs_hosts").size());
     assertEquals(1, info.get("hbase_master_hosts").size());
+    assertEquals(4, info.get("all_hosts").size());
     assertEquals("h1", info.get("hbase_master_hosts").get(0));
 
     assertFalse(info.get("ambari_db_rca_url").get(0).contains(Configuration.HOSTNAME_MACRO));