You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vi...@apache.org on 2012/06/06 22:50:48 UTC

svn commit: r1347114 - in /incubator/ambari/branches/ambari-186: ./ hmc/puppet/modules/hdp-nagios/files/ hmc/puppet/modules/hdp-nagios/manifests/server/ hmc/puppet/modules/hdp-nagios/templates/

Author: vikram
Date: Wed Jun  6 20:50:48 2012
New Revision: 1347114

URL: http://svn.apache.org/viewvc?rev=1347114&view=rev
Log:
AMBARI-363. Nagios should monitor puppet agents  (Contributed by Suhas)

Added:
    incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-nagios/files/check_puppet_agent_status.php
    incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-nagios/templates/hadoop-servicegroups.cfg.erb
Modified:
    incubator/ambari/branches/ambari-186/CHANGES.txt
    incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-nagios/manifests/server/config.pp
    incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-nagios/templates/hadoop-commands.cfg.erb
    incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-nagios/templates/hadoop-services.cfg.erb

Modified: incubator/ambari/branches/ambari-186/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/CHANGES.txt?rev=1347114&r1=1347113&r2=1347114&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/CHANGES.txt (original)
+++ incubator/ambari/branches/ambari-186/CHANGES.txt Wed Jun  6 20:50:48 2012
@@ -6,6 +6,8 @@ characters wide.
 
 Release 0.1.x - unreleased
 
+  AMBARI-363. Nagios should monitor puppet agents (Suhas via Vikram)  
+
   AMBARI-362. Create lock file as part of rpm install (Vikram)
 
   AMBARI-361. Display client nodes as part of cluster topology display (Yusaku via Vikram)

Added: incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-nagios/files/check_puppet_agent_status.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-nagios/files/check_puppet_agent_status.php?rev=1347114&view=auto
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-nagios/files/check_puppet_agent_status.php (added)
+++ incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-nagios/files/check_puppet_agent_status.php Wed Jun  6 20:50:48 2012
@@ -0,0 +1,60 @@
+#!/usr/bin/php
+<?php
+/*
+ * 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.
+ */
+
+ /* This plugin check if puppet agent is alive */
+
+  $options = getopt ("h:");
+  if (!array_key_exists('h', $options)) {
+    usage();
+    exit(3);
+  }
+
+  $host=$options['h'];
+
+  /* Give puppet kick --ping to check if agent is working */
+  $out_arr = array();
+  $cmd = "puppet kick -f --host $host --ping 2>/dev/null";
+  exec ($cmd, $out_arr, $err);
+  if ($err == 0 && check_error($out_arr, "status is success", 0) == 0) {
+    // success
+    echo "OK: Puppet agent is active on [$host]" . "\n";
+    exit(0);
+  } else {
+    // Fail
+    echo "WARN: Puppet agent is down on [$host]" . "\n";
+    exit(1);
+  }
+
+  /* check error function */
+  function check_error ($output, $pattern, $ret) {
+    $ret1=($ret+1)%2;
+    for ($i=0; $i<count($output); $i++) {
+      if (preg_match ("/$pattern/", $output[$i])) {
+        return $ret;
+      }
+    }
+    return $ret1;
+  }
+
+  /* print usage */
+  function usage () {
+    echo "Usage: $0 -h <host>\n";
+  }
+?>

Modified: incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-nagios/manifests/server/config.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-nagios/manifests/server/config.pp?rev=1347114&r1=1347113&r2=1347114&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-nagios/manifests/server/config.pp (original)
+++ incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-nagios/manifests/server/config.pp Wed Jun  6 20:50:48 2012
@@ -19,6 +19,7 @@ class hdp-nagios::server::config()
   hdp-nagios::server::check { 'check_rpcq_latency.php': }
   hdp-nagios::server::check { 'check_webui.sh': }
   hdp-nagios::server::check { 'check_name_dir_status.php': }
+  hdp-nagios::server::check { 'check_puppet_agent_status.php': }
   hdp-nagios::server::check { 'check_oozie_status.sh': }
   hdp-nagios::server::check { 'check_templeton_status.sh': }
   hdp-nagios::server::check { 'check_hive_metastore_status.sh': }

Modified: incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-nagios/templates/hadoop-commands.cfg.erb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-nagios/templates/hadoop-commands.cfg.erb?rev=1347114&r1=1347113&r2=1347114&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-nagios/templates/hadoop-commands.cfg.erb (original)
+++ incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-nagios/templates/hadoop-commands.cfg.erb Wed Jun  6 20:50:48 2012
@@ -46,6 +46,16 @@ define command{
        }
 
 define command{
+        command_name    check_puppet_agent_status
+        command_line    $USER1$/check_puppet_agent_status.php -h $HOSTADDRESS$
+       }
+
+define command{
+        command_name    check_puppet_agent_status
+        command_line    $USER1$/check_puppet_agent_status.php -h $HOSTADDRESS$
+       }
+
+define command{
         command_name    check_oozie_status
         command_line    $USER1$/check_oozie_status.sh $HOSTADDRESS$ $ARG1$ $ARG2$
        }

Added: incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-nagios/templates/hadoop-servicegroups.cfg.erb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-nagios/templates/hadoop-servicegroups.cfg.erb?rev=1347114&view=auto
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-nagios/templates/hadoop-servicegroups.cfg.erb (added)
+++ incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-nagios/templates/hadoop-servicegroups.cfg.erb Wed Jun  6 20:50:48 2012
@@ -0,0 +1,40 @@
+define servicegroup {
+  servicegroup_name  HDFS
+  alias  HDFS Checks
+}
+define servicegroup {
+  servicegroup_name  MAPREDUCE
+  alias  MAPREDUCE Checks
+}
+define servicegroup {
+  servicegroup_name  HBASE
+  alias  HBASE Checks
+}
+define servicegroup {
+  servicegroup_name  OOZIE
+  alias  OOZIE Checks
+}
+define servicegroup {
+  servicegroup_name  TEMPLETON
+  alias  TEMPLETON Checks
+}
+define servicegroup {
+  servicegroup_name  NAGIOS
+  alias  NAGIOS Checks
+}
+define servicegroup {
+  servicegroup_name  GANGLIA
+  alias  GANGLIA Checks
+}
+define servicegroup {
+  servicegroup_name  HIVE-METASTORE
+  alias  HIVE-METASTORE Checks
+}
+define servicegroup {
+  servicegroup_name  ZOOKEEPER
+  alias  ZOOKEEPER Checks
+}
+define servicegroup {
+  servicegroup_name  PUPPET
+  alias  Puppet Agent Checks
+}

Modified: incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-nagios/templates/hadoop-services.cfg.erb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-nagios/templates/hadoop-services.cfg.erb?rev=1347114&r1=1347113&r2=1347114&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-nagios/templates/hadoop-services.cfg.erb (original)
+++ incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp-nagios/templates/hadoop-services.cfg.erb Wed Jun  6 20:50:48 2012
@@ -9,6 +9,17 @@ define service {
 }
 
 define service {        
+        hostgroup_name          all-servers
+        use                     hadoop-service
+        service_description     PUPPET::Puppet agent down
+        servicegroups           PUPPET
+        check_command           check_puppet_agent_status
+        normal_check_interval   0.25
+        retry_check_interval    0.25
+        max_check_attempts      4
+}
+
+define service {        
         hostgroup_name          nagios-server        
         use                     hadoop-service
         service_description     NAGIOS::Nagios status log staleness