You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sw...@apache.org on 2013/08/23 03:02:34 UTC

git commit: AMBARI-3000. HDFS Block Health Nagios check is not working. (swagle)

Updated Branches:
  refs/heads/trunk b4186eb2b -> 81bc7d830


AMBARI-3000. HDFS Block Health Nagios check is not working. (swagle)


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

Branch: refs/heads/trunk
Commit: 81bc7d830c71c7e4b8be2d341916cc99754d0c23
Parents: b4186eb
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Thu Aug 22 17:50:39 2013 -0700
Committer: Siddharth Wagle <sw...@hortonworks.com>
Committed: Thu Aug 22 18:02:27 2013 -0700

----------------------------------------------------------------------
 .../puppet/modules/hdp-nagios/files/check_hdfs_blocks.php   | 9 +++++----
 .../src/main/puppet/modules/hdp-nagios/manifests/params.pp  | 6 ++++++
 .../modules/hdp-nagios/templates/hadoop-commands.cfg.erb    | 2 +-
 .../modules/hdp-nagios/templates/hadoop-services.cfg.erb    | 2 +-
 4 files changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/81bc7d83/ambari-agent/src/main/puppet/modules/hdp-nagios/files/check_hdfs_blocks.php
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/puppet/modules/hdp-nagios/files/check_hdfs_blocks.php b/ambari-agent/src/main/puppet/modules/hdp-nagios/files/check_hdfs_blocks.php
index bc34fe8..8f1310c 100644
--- a/ambari-agent/src/main/puppet/modules/hdp-nagios/files/check_hdfs_blocks.php
+++ b/ambari-agent/src/main/puppet/modules/hdp-nagios/files/check_hdfs_blocks.php
@@ -22,9 +22,9 @@
  * check_jmx -H hostaddress -p port -w 1% -c 1%
  */
 
-  $options = getopt ("h:p:w:c:");
+  $options = getopt ("h:p:w:c:s:");
   if (!array_key_exists('h', $options) || !array_key_exists('p', $options) || !array_key_exists('w', $options)
-      || !array_key_exists('c', $options)) {
+      || !array_key_exists('c', $options) || !array_key_exists('s', $options)) {
     usage();
     exit(3);
   }
@@ -33,9 +33,10 @@
   $port=$options['p'];
   $warn=$options['w']; $warn = preg_replace('/%$/', '', $warn);
   $crit=$options['c']; $crit = preg_replace('/%$/', '', $crit);
+  $nn_jmx_property=$options['s'];
 
   /* Get the json document */
-  $json_string = file_get_contents("http://".$host.":".$port."/jmx?qry=Hadoop:service=NameNode,name=FSNamesystemMetrics");
+  $json_string = file_get_contents("http://".$host.":".$port."/jmx?qry=Hadoop:service=NameNode,name=".$nn_jmx_property);
   $json_array = json_decode($json_string, true);
   $m_percent = 0;
   $c_percent = 0;
@@ -67,6 +68,6 @@
 
   /* print usage */
   function usage () {
-    echo "Usage: $0 -h <host> -p port -w <warn%> -c <crit%>\n";
+    echo "Usage: $0 -h <host> -p port -w <warn%> -c <crit%> -s <namenode bean name>\n";
   }
 ?>

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/81bc7d83/ambari-agent/src/main/puppet/modules/hdp-nagios/manifests/params.pp
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/puppet/modules/hdp-nagios/manifests/params.pp b/ambari-agent/src/main/puppet/modules/hdp-nagios/manifests/params.pp
index 29a3ff8..2107899 100644
--- a/ambari-agent/src/main/puppet/modules/hdp-nagios/manifests/params.pp
+++ b/ambari-agent/src/main/puppet/modules/hdp-nagios/manifests/params.pp
@@ -22,6 +22,12 @@ class hdp-nagios::params() inherits hdp::params
 {   
   $conf_dir = hdp_default("nagios_conf_dir","/etc/nagios")
 
+  if (hdp_get_major_stack_version($hdp::params::stack_version) >= 2) {
+    $nn_metrics_property = "FSNamesystem"
+  } else {
+    $nn_metrics_property = "FSNamesystemMetrics"
+  }
+
   if hdp_is_empty($hdp::params::services_names[httpd]) {
     hdp_fail("There is no service name for service httpd")
   } else {

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/81bc7d83/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/hadoop-commands.cfg.erb
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/hadoop-commands.cfg.erb b/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/hadoop-commands.cfg.erb
index 4dbc398..75e989b 100644
--- a/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/hadoop-commands.cfg.erb
+++ b/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/hadoop-commands.cfg.erb
@@ -36,7 +36,7 @@ define command {
 
 define command{
         command_name    check_hdfs_blocks
-        command_line    php $USER1$/check_hdfs_blocks.php -h $HOSTADDRESS$ -p $ARG1$ -w $ARG2$ -c $ARG3$
+        command_line    php $USER1$/check_hdfs_blocks.php -h $HOSTADDRESS$ -p $ARG1$ -w $ARG2$ -c $ARG3$ -s $ARG4$
        }
 
 define command{

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/81bc7d83/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/hadoop-services.cfg.erb
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/hadoop-services.cfg.erb b/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/hadoop-services.cfg.erb
index 97ff763..32d64e4 100644
--- a/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/hadoop-services.cfg.erb
+++ b/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/hadoop-services.cfg.erb
@@ -275,7 +275,7 @@ define service {
         use                     hadoop-service
         service_description     HDFS::Blocks health
         servicegroups           HDFS
-        check_command           check_hdfs_blocks!<%=scope.function_hdp_template_var("::hdp::namenode_port")%>!0%!0%
+        check_command           check_hdfs_blocks!<%=scope.function_hdp_template_var("::hdp::namenode_port")%>!0%!0%!<%=scope.function_hdp_template_var("::hdp-nagios::params::nn_metrics_property")%>
         normal_check_interval   2
         retry_check_interval    1 
         max_check_attempts      1