ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vbrodets...@apache.org
Subject git commit: AMBARI-6358. HBase service page shows alerts of HBase Master CPU utilization with error Data inaccessible(vbrodetskyi)
Date Wed, 02 Jul 2014 19:58:28 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-1.6.1 b38012920 -> dcef98015


AMBARI-6358. HBase service page shows alerts of HBase Master CPU utilization with error Data
inaccessible(vbrodetskyi)


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

Branch: refs/heads/branch-1.6.1
Commit: dcef980152869407592b271522159aa15c349840
Parents: b380129
Author: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Authored: Wed Jul 2 21:17:32 2014 +0300
Committer: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Committed: Wed Jul 2 21:17:32 2014 +0300

----------------------------------------------------------------------
 .../NAGIOS/package/files/check_hbase_cpu.php    | 116 +++++++++++++++++++
 .../package/scripts/nagios_server_config.py     |   1 +
 .../services/NAGIOS/package/scripts/params.py   |   2 +-
 .../package/templates/hadoop-commands.cfg.j2    |   5 +
 .../package/templates/hadoop-services.cfg.j2    |  11 +-
 .../NAGIOS/package/files/check_hbase_cpu.php    | 116 +++++++++++++++++++
 .../package/scripts/nagios_server_config.py     |   1 +
 .../services/NAGIOS/package/scripts/params.py   |   1 +
 .../package/templates/hadoop-commands.cfg.j2    |   4 +
 .../package/templates/hadoop-services.cfg.j2    |  11 +-
 .../stacks/1.3.2/NAGIOS/test_nagios_server.py   |   4 +
 .../stacks/2.0.6/NAGIOS/test_nagios_server.py   |   4 +
 12 files changed, 265 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/dcef9801/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/files/check_hbase_cpu.php
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/files/check_hbase_cpu.php
b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/files/check_hbase_cpu.php
new file mode 100644
index 0000000..91a7c64
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/files/check_hbase_cpu.php
@@ -0,0 +1,116 @@
+<?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.
+ */
+
+  include "hdp_nagios_init.php";
+
+  $options = getopt ("h:p:w:c:k:r:t:u:e");
+  if (!array_key_exists('h', $options) || !array_key_exists('p', $options) || !array_key_exists('w',
$options)
+      || !array_key_exists('c', $options)) {
+    usage();
+    exit(3);
+  }
+
+  $hosts=$options['h'];
+  $port=$options['p'];
+  $warn=$options['w']; $warn = preg_replace('/%$/', '', $warn);
+  $crit=$options['c']; $crit = preg_replace('/%$/', '', $crit);
+  $keytab_path=$options['k'];
+  $principal_name=$options['r'];
+  $kinit_path_local=$options['t'];
+  $security_enabled=$options['u'];
+  $ssl_enabled=$options['e'];
+
+  /* Kinit if security enabled */
+  $status = kinit_if_needed($security_enabled, $kinit_path_local, $keytab_path, $principal_name);
+  $retcode = $status[0];
+  $output = $status[1];
+
+  if ($output != 0) {
+    echo "CRITICAL: Error doing kinit for nagios. $output";
+    exit (2);
+  }
+
+  $protocol = ($ssl_enabled == "true" ? "https" : "http");
+
+  $jmx_response_available = false;
+  $jmx_response;
+
+  foreach (preg_split('/,/', $hosts) as $host) {
+    /* Get the json document */
+
+    $ch = curl_init();
+    $username = rtrim(`id -un`, "\n");
+    curl_setopt_array($ch, array( CURLOPT_URL => $protocol."://".$host.":".$port."/jmx?qry=java.lang:type=OperatingSystem",
+                                  CURLOPT_RETURNTRANSFER => true,
+                                  CURLOPT_HTTPAUTH => CURLAUTH_ANY,
+                                  CURLOPT_USERPWD => "$username:",
+                                  CURLOPT_SSL_VERIFYPEER => FALSE ));
+    $json_string = curl_exec($ch);
+    $info = curl_getinfo($ch);
+    if (intval($info['http_code']) == 401){
+      logout();
+      $json_string = curl_exec($ch);
+    }
+    $info = curl_getinfo($ch);
+    curl_close($ch);
+    $json_array = json_decode($json_string, true);
+
+    $object = $json_array['beans'][0];
+
+    if (count($object) > 0) {
+      $jmx_response_available = true;
+      $jmx_response = $object;
+    }
+  }
+
+  if ($jmx_response_available === false) {
+    echo "CRITICAL: Data inaccessible, Status code = ". $info['http_code'] ."\n";
+    exit(2);
+  }
+
+  $cpu_load = $jmx_response['SystemCpuLoad'];
+
+  if (!isset($jmx_response['SystemCpuLoad']) || $cpu_load < 0.0) {
+    echo "WARNING: Data unavailable, SystemCpuLoad is not set\n";
+    exit(1);
+  }
+
+  $cpu_count = $jmx_response['AvailableProcessors'];
+
+  $cpu_percent = $cpu_load*100;
+
+  $out_msg = $cpu_count . " CPU, load " . number_format($cpu_percent, 1, '.', '') . '%';
+
+  if ($cpu_percent > $crit) {
+    echo $out_msg . ' > ' . $crit . "% : CRITICAL\n";
+    exit(2);
+  }
+  if ($cpu_percent > $warn) {
+    echo $out_msg . ' > ' . $warn . "% : WARNING\n";
+    exit(1);
+  }
+
+  echo $out_msg . ' < ' . $warn . "% : OK\n";
+  exit(0);
+
+  /* print usage */
+  function usage () {
+    echo "Usage: $0 -h <host> -p port -w <warn%> -c <crit%> -k keytab_path
-r principal_name -t kinit_path -u security_enabled -e ssl_enabled\n";
+  }
+?>

http://git-wip-us.apache.org/repos/asf/ambari/blob/dcef9801/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/scripts/nagios_server_config.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/scripts/nagios_server_config.py
b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/scripts/nagios_server_config.py
index 4089b2e..b6c7144 100644
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/scripts/nagios_server_config.py
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/scripts/nagios_server_config.py
@@ -50,6 +50,7 @@ def nagios_server_config():
 
   nagios_server_check( 'check_cpu.pl')
   nagios_server_check( 'check_cpu.php')
+  nagios_server_check( 'check_hbase_cpu.php')
   nagios_server_check( 'check_datanode_storage.php')
   nagios_server_check( 'check_aggregate.php')
   nagios_server_check( 'check_hdfs_blocks.php')

http://git-wip-us.apache.org/repos/asf/ambari/blob/dcef9801/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/scripts/params.py
b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/scripts/params.py
index ac955cd..6d43bcc 100644
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/scripts/params.py
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/scripts/params.py
@@ -124,8 +124,8 @@ _zookeeper_hosts = default("/clusterHostInfo/zookeeper_hosts", None)
 _flume_hosts = default("/clusterHostInfo/flume_hosts", None)
 _nagios_server_host = default("/clusterHostInfo/nagios_server_host",None)
 _ganglia_server_host = default("/clusterHostInfo/ganglia_server_host",None)
-
 hbase_master_hosts = default("/clusterHostInfo/hbase_master_hosts",None)
+hbase_master_hosts_in_str = ','.join(hbase_master_hosts)
 _hive_server_host = default("/clusterHostInfo/hive_server_host",None)
 _oozie_server = default("/clusterHostInfo/oozie_server",None)
 _webhcat_server_host = default("/clusterHostInfo/webhcat_server_host",None)

http://git-wip-us.apache.org/repos/asf/ambari/blob/dcef9801/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/templates/hadoop-commands.cfg.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/templates/hadoop-commands.cfg.j2
b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/templates/hadoop-commands.cfg.j2
index fe7495f..fa2010b 100644
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/templates/hadoop-commands.cfg.j2
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/templates/hadoop-commands.cfg.j2
@@ -44,6 +44,11 @@ define command {
         command_name    check_cpu
         command_line    $USER1$/check_wrapper.sh php $USER1$/check_cpu.php -h $HOSTADDRESS$
-p $ARG1$ -w $ARG2$ -c $ARG3$ -e $ARG4$ -k $ARG5$ -r $ARG6$ -t $ARG7$ -u $ARG8$
        }
+
+define command {
+        command_name    check_hbase_cpu
+        command_line    $USER1$/check_wrapper.sh php $USER1$/check_hbase_cpu.php -h $ARG1$
-p $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$ -k $ARG6$ -r $ARG7$ -t $ARG8$ -u $ARG9$
+       }
 {% endif %}
 
 # Check data node storage full 

http://git-wip-us.apache.org/repos/asf/ambari/blob/dcef9801/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/templates/hadoop-services.cfg.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/templates/hadoop-services.cfg.j2
b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/templates/hadoop-services.cfg.j2
index d6e1d7b..fea7777 100644
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/templates/hadoop-services.cfg.j2
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/templates/hadoop-services.cfg.j2
@@ -488,20 +488,21 @@ define service {
 #         retry_check_interval    1
 #         max_check_attempts      3
 # #}
-{%  for hbasemaster in hbase_master_hosts %}
 {% if check_cpu_on %}
 define service {
-        host_name               {{ hbasemaster }}
+        hostgroup_name          nagios-server
         use                     hadoop-service
-        service_description     HBASEMASTER::HBase Master CPU utilization on {{ hbasemaster
}}
+        service_description     HBASEMASTER::HBase Master CPU utilization
         servicegroups           HBASE
 #        check_command           check_cpu!200%!250%
-        check_command           check_cpu!{{ hbase_master_port }}!200%!250%!{{ str(hadoop_ssl_enabled).lower()
}}!{{ nagios_keytab_path }}!{{ nagios_principal_name }}!{{ kinit_path_local }}!{{ str(security_enabled).lower()
}}
+        check_command           check_hbase_cpu!{{ hbase_master_hosts_in_str }}!{{ hbase_master_port
}}!200%!250%!{{ str(hadoop_ssl_enabled).lower() }}!{{ nagios_keytab_path }}!{{ nagios_principal_name
}}!{{ kinit_path_local }}!{{ str(security_enabled).lower() }}
         normal_check_interval   5
-        retry_check_interval    2 
+        retry_check_interval    2
         max_check_attempts      5
 }
 {%  endif %}
+
+{%  for hbasemaster in hbase_master_hosts %}
 define service {
         host_name               {{ hbasemaster }}
         use                     hadoop-service

http://git-wip-us.apache.org/repos/asf/ambari/blob/dcef9801/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/files/check_hbase_cpu.php
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/files/check_hbase_cpu.php
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/files/check_hbase_cpu.php
new file mode 100644
index 0000000..91a7c64
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/files/check_hbase_cpu.php
@@ -0,0 +1,116 @@
+<?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.
+ */
+
+  include "hdp_nagios_init.php";
+
+  $options = getopt ("h:p:w:c:k:r:t:u:e");
+  if (!array_key_exists('h', $options) || !array_key_exists('p', $options) || !array_key_exists('w',
$options)
+      || !array_key_exists('c', $options)) {
+    usage();
+    exit(3);
+  }
+
+  $hosts=$options['h'];
+  $port=$options['p'];
+  $warn=$options['w']; $warn = preg_replace('/%$/', '', $warn);
+  $crit=$options['c']; $crit = preg_replace('/%$/', '', $crit);
+  $keytab_path=$options['k'];
+  $principal_name=$options['r'];
+  $kinit_path_local=$options['t'];
+  $security_enabled=$options['u'];
+  $ssl_enabled=$options['e'];
+
+  /* Kinit if security enabled */
+  $status = kinit_if_needed($security_enabled, $kinit_path_local, $keytab_path, $principal_name);
+  $retcode = $status[0];
+  $output = $status[1];
+
+  if ($output != 0) {
+    echo "CRITICAL: Error doing kinit for nagios. $output";
+    exit (2);
+  }
+
+  $protocol = ($ssl_enabled == "true" ? "https" : "http");
+
+  $jmx_response_available = false;
+  $jmx_response;
+
+  foreach (preg_split('/,/', $hosts) as $host) {
+    /* Get the json document */
+
+    $ch = curl_init();
+    $username = rtrim(`id -un`, "\n");
+    curl_setopt_array($ch, array( CURLOPT_URL => $protocol."://".$host.":".$port."/jmx?qry=java.lang:type=OperatingSystem",
+                                  CURLOPT_RETURNTRANSFER => true,
+                                  CURLOPT_HTTPAUTH => CURLAUTH_ANY,
+                                  CURLOPT_USERPWD => "$username:",
+                                  CURLOPT_SSL_VERIFYPEER => FALSE ));
+    $json_string = curl_exec($ch);
+    $info = curl_getinfo($ch);
+    if (intval($info['http_code']) == 401){
+      logout();
+      $json_string = curl_exec($ch);
+    }
+    $info = curl_getinfo($ch);
+    curl_close($ch);
+    $json_array = json_decode($json_string, true);
+
+    $object = $json_array['beans'][0];
+
+    if (count($object) > 0) {
+      $jmx_response_available = true;
+      $jmx_response = $object;
+    }
+  }
+
+  if ($jmx_response_available === false) {
+    echo "CRITICAL: Data inaccessible, Status code = ". $info['http_code'] ."\n";
+    exit(2);
+  }
+
+  $cpu_load = $jmx_response['SystemCpuLoad'];
+
+  if (!isset($jmx_response['SystemCpuLoad']) || $cpu_load < 0.0) {
+    echo "WARNING: Data unavailable, SystemCpuLoad is not set\n";
+    exit(1);
+  }
+
+  $cpu_count = $jmx_response['AvailableProcessors'];
+
+  $cpu_percent = $cpu_load*100;
+
+  $out_msg = $cpu_count . " CPU, load " . number_format($cpu_percent, 1, '.', '') . '%';
+
+  if ($cpu_percent > $crit) {
+    echo $out_msg . ' > ' . $crit . "% : CRITICAL\n";
+    exit(2);
+  }
+  if ($cpu_percent > $warn) {
+    echo $out_msg . ' > ' . $warn . "% : WARNING\n";
+    exit(1);
+  }
+
+  echo $out_msg . ' < ' . $warn . "% : OK\n";
+  exit(0);
+
+  /* print usage */
+  function usage () {
+    echo "Usage: $0 -h <host> -p port -w <warn%> -c <crit%> -k keytab_path
-r principal_name -t kinit_path -u security_enabled -e ssl_enabled\n";
+  }
+?>

http://git-wip-us.apache.org/repos/asf/ambari/blob/dcef9801/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/nagios_server_config.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/nagios_server_config.py
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/nagios_server_config.py
index 57e5045..95bdd9f 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/nagios_server_config.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/nagios_server_config.py
@@ -50,6 +50,7 @@ def nagios_server_config():
 
   nagios_server_check( 'check_cpu.pl')
   nagios_server_check( 'check_cpu.php')
+  nagios_server_check( 'check_hbase_cpu.php')
   nagios_server_check( 'check_datanode_storage.php')
   nagios_server_check( 'check_aggregate.php')
   nagios_server_check( 'check_hdfs_blocks.php')

http://git-wip-us.apache.org/repos/asf/ambari/blob/dcef9801/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/params.py
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/params.py
index e833bca..7fa32fa 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/params.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/params.py
@@ -200,6 +200,7 @@ _supervisor_hosts = default("/clusterHostInfo/supervisor_hosts",None)
 _storm_ui_host = default("/clusterHostInfo/storm_ui_server_hosts",None)
 _storm_rest_api_hosts = default("/clusterHostInfo/storm_rest_api_hosts",None)
 hbase_master_hosts = default("/clusterHostInfo/hbase_master_hosts",None)
+hbase_master_hosts_in_str = ','.join(hbase_master_hosts)
 _hive_server_host = default("/clusterHostInfo/hive_server_host",None)
 _oozie_server = default("/clusterHostInfo/oozie_server",None)
 _webhcat_server_host = default("/clusterHostInfo/webhcat_server_host",None)

http://git-wip-us.apache.org/repos/asf/ambari/blob/dcef9801/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/templates/hadoop-commands.cfg.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/templates/hadoop-commands.cfg.j2
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/templates/hadoop-commands.cfg.j2
index fa38a06..caf0ff4 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/templates/hadoop-commands.cfg.j2
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/templates/hadoop-commands.cfg.j2
@@ -44,6 +44,10 @@ define command {
         command_name    check_cpu
         command_line    $USER1$/check_wrapper.sh php $USER1$/check_cpu.php -h $HOSTADDRESS$
-p $ARG1$ -w $ARG2$ -c $ARG3$ -e $ARG4$ -k $ARG5$ -r $ARG6$ -t $ARG7$ -u $ARG8$
        }
+define command {
+        command_name    check_hbase_cpu
+        command_line    $USER1$/check_wrapper.sh php $USER1$/check_hbase_cpu.php -h $ARG1$
-p $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$ -k $ARG6$ -r $ARG7$ -t $ARG8$ -u $ARG9$
+       }
 {% endif %}
 
 # Check data node storage full 

http://git-wip-us.apache.org/repos/asf/ambari/blob/dcef9801/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/templates/hadoop-services.cfg.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/templates/hadoop-services.cfg.j2
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/templates/hadoop-services.cfg.j2
index 8b47e56..35bdaec 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/templates/hadoop-services.cfg.j2
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/templates/hadoop-services.cfg.j2
@@ -656,20 +656,21 @@ define service {
 #         retry_check_interval    1
 #         max_check_attempts      3
 # #}
-{%  for hbasemaster in hbase_master_hosts  %}
 {% if check_cpu_on %}
 define service {
-        host_name               {{ hbasemaster }}
+        hostgroup_name          nagios-server
         use                     hadoop-service
-        service_description     HBASEMASTER::HBase Master CPU utilization on {{ hbasemaster
}}
+        service_description     HBASEMASTER::HBase Master CPU utilization
         servicegroups           HBASE
 #        check_command           check_cpu!200%!250%
-        check_command           check_cpu!{{ hbase_master_port }}!200%!250%!{{ str(hadoop_ssl_enabled).lower()
}}!{{ nagios_keytab_path }}!{{ nagios_principal_name }}!{{ kinit_path_local }}!{{ str(security_enabled).lower()
}}
+        check_command           check_hbase_cpu!{{ hbase_master_hosts_in_str }}!{{ hbase_master_port
}}!200%!250%!{{ str(hadoop_ssl_enabled).lower() }}!{{ nagios_keytab_path }}!{{ nagios_principal_name
}}!{{ kinit_path_local }}!{{ str(security_enabled).lower() }}
         normal_check_interval   5
-        retry_check_interval    2 
+        retry_check_interval    2
         max_check_attempts      5
 }
 {%  endif %}
+
+{%  for hbasemaster in hbase_master_hosts  %}
 define service {
         host_name               {{ hbasemaster }}
         use                     hadoop-service

http://git-wip-us.apache.org/repos/asf/ambari/blob/dcef9801/ambari-server/src/test/python/stacks/1.3.2/NAGIOS/test_nagios_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/1.3.2/NAGIOS/test_nagios_server.py b/ambari-server/src/test/python/stacks/1.3.2/NAGIOS/test_nagios_server.py
index b57b68f..f3b0f7a 100644
--- a/ambari-server/src/test/python/stacks/1.3.2/NAGIOS/test_nagios_server.py
+++ b/ambari-server/src/test/python/stacks/1.3.2/NAGIOS/test_nagios_server.py
@@ -168,6 +168,10 @@ class TestNagiosServer(RMFTestCase):
                               content=StaticFile('check_cpu.php'),
                               mode=0755
     )
+    self.assertResourceCalled('File', '/usr/lib64/nagios/plugins/check_hbase_cpu.php',
+                              content=StaticFile('check_hbase_cpu.php'),
+                              mode=0755
+    )
     self.assertResourceCalled('File',
                               '/usr/lib64/nagios/plugins/check_datanode_storage.php',
                               content=StaticFile('check_datanode_storage.php'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/dcef9801/ambari-server/src/test/python/stacks/2.0.6/NAGIOS/test_nagios_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/NAGIOS/test_nagios_server.py b/ambari-server/src/test/python/stacks/2.0.6/NAGIOS/test_nagios_server.py
index ae5eaf4..6ae0b24 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/NAGIOS/test_nagios_server.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/NAGIOS/test_nagios_server.py
@@ -168,6 +168,10 @@ class TestNagiosServer(RMFTestCase):
                               content=StaticFile('check_cpu.php'),
                               mode=0755
     )
+    self.assertResourceCalled('File', '/usr/lib64/nagios/plugins/check_hbase_cpu.php',
+                              content=StaticFile('check_hbase_cpu.php'),
+                              mode=0755
+    )
     self.assertResourceCalled('File',
                               '/usr/lib64/nagios/plugins/check_datanode_storage.php',
                               content=StaticFile('check_datanode_storage.php'),


Mime
View raw message