You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by hi...@apache.org on 2012/08/24 00:53:54 UTC

svn commit: r1376754 - in /incubator/ambari/trunk: CHANGES.txt mon_dashboard/src/addOns/nagios/scripts/nagios_alerts.php

Author: hitesh
Date: Thu Aug 23 22:53:54 2012
New Revision: 1376754

URL: http://svn.apache.org/viewvc?rev=1376754&view=rev
Log:
AMBARI-678. Enable nagios add-on to send back information for puppet agents being down (Contributed by hitesh)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/mon_dashboard/src/addOns/nagios/scripts/nagios_alerts.php

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1376754&r1=1376753&r2=1376754&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Thu Aug 23 22:53:54 2012
@@ -12,6 +12,9 @@ Trunk (unreleased changes)
 
   NEW FEATURES
 
+    AMBARI-678. Enable nagios add-on to send back information for puppet agents
+    being down (hitesh)
+  
     AMBARI-656. Separate keytab for HTTP principal. (jitendra)
 
     AMBARI-655. Move hbase directory creation in hdfs to namenode puppet 

Modified: incubator/ambari/trunk/mon_dashboard/src/addOns/nagios/scripts/nagios_alerts.php
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/mon_dashboard/src/addOns/nagios/scripts/nagios_alerts.php?rev=1376754&r1=1376753&r2=1376754&view=diff
==============================================================================
--- incubator/ambari/trunk/mon_dashboard/src/addOns/nagios/scripts/nagios_alerts.php (original)
+++ incubator/ambari/trunk/mon_dashboard/src/addOns/nagios/scripts/nagios_alerts.php Thu Aug 23 22:53:54 2012
@@ -98,6 +98,7 @@ function hdp_mon_generate_response( $res
   define ("HIVE_METASTORE_SERVICE_CHECK", "HIVE-METASTORE::HIVE-METASTORE status check");
   define ("OOZIE_SERVICE_CHECK", "OOZIE::Oozie status check");
   define ("TEMPLETON_SERVICE_CHECK", "TEMPLETON::Templeton status check");
+  define ("PUPPET_SERVICE_CHECK", "PUPPET::Puppet agent down");
 
   /* If SUSE, status file is under /var/lib/nagios */
   if (file_exists("/etc/SuSE-release")) {
@@ -158,6 +159,7 @@ function hdp_mon_generate_response( $res
   function query_service_states ($status_file_content) {
     $num_matches = preg_match_all("/servicestatus \{([\S\s]*?)\}/", $status_file_content, $matches, PREG_PATTERN_ORDER);
     $services_object = array ();
+    $services_object["PUPPET"] = 0;
     foreach ($matches[0] as $object) {
       if (getParameter($object, "service_description") == HDFS_SERVICE_CHECK) {
         $services_object["HDFS"] = getParameter($object, "last_hard_state");
@@ -211,6 +213,16 @@ function hdp_mon_generate_response( $res
         }
         continue;
       }
+      if (getParameter($object, "service_description") == PUPPET_SERVICE_CHECK) {
+        $state = getParameter($object, "last_hard_state");
+        if ($state >= 1) {
+          $services_object["PUPPET"]++;
+        }
+        continue;
+      }
+    }
+    if ($services_object["PUPPET"] >= 1) {
+      $services_object["PUPPET"] = 1;
     }
     return $services_object;
   }
@@ -366,6 +378,7 @@ function hdp_mon_generate_response( $res
       case "HIVE-METASTORE":
       case "OOZIE":
       case "TEMPLETON":
+      case "PUPPET":
         break;
       default:
         $pieces[0] = "UNKNOWN";