You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2013/12/24 16:46:37 UTC
[1/3] AMBARI-4153. Nagios on HDP1. Using resource management lib
(aonishuk)
Updated Branches:
refs/heads/trunk b3659b0f3 -> 95fb387b9
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/nagios.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/nagios.j2 b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/nagios.j2
new file mode 100644
index 0000000..01e21ac
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/nagios.j2
@@ -0,0 +1,146 @@
+#!/bin/sh
+# $Id$
+# Nagios Startup script for the Nagios monitoring daemon
+#
+# chkconfig: - 85 15
+# description: Nagios is a service monitoring system
+# processname: nagios
+# config: /etc/nagios/nagios.cfg
+# pidfile: /var/nagios/nagios.pid
+#
+### BEGIN INIT INFO
+# Provides: nagios
+# Required-Start: $local_fs $syslog $network
+# Required-Stop: $local_fs $syslog $network
+# Short-Description: start and stop Nagios monitoring server
+# Description: Nagios is is a service monitoring system
+### END INIT INFO
+
+#
+#
+# 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.
+#
+#
+#
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+prefix="/usr"
+exec_prefix="/usr"
+exec="/usr/sbin/nagios"
+prog="nagios"
+config="/etc/nagios/nagios.cfg"
+pidfile="{{nagios_pid_file}}"
+user="{{nagios_user}}"
+
+[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
+
+lockfile=/var/lock/subsys/$prog
+
+start() {
+ [ -x $exec ] || exit 5
+ [ -f $config ] || exit 6
+ echo -n $"Starting $prog: "
+ daemon --user=$user $exec -d $config
+ retval=$?
+ echo
+ [ $retval -eq 0 ] && touch $lockfile
+ return $retval
+}
+
+stop() {
+ echo -n $"Stopping $prog: "
+ killproc -d 10 $exec
+ retval=$?
+ echo
+ [ $retval -eq 0 ] && rm -f $lockfile
+ return $retval
+}
+
+
+restart() {
+ stop
+ start
+}
+
+reload() {
+ echo -n $"Reloading $prog: "
+ killproc $exec -HUP
+ RETVAL=$?
+ echo
+}
+
+force_reload() {
+ restart
+}
+
+check_config() {
+ $nice runuser -s /bin/bash - $user -c "$corelimit >/dev/null 2>&1 ; $exec -v $config > /dev/null 2>&1"
+ RETVAL=$?
+ if [ $RETVAL -ne 0 ] ; then
+ echo -n $"Configuration validation failed"
+ failure
+ echo
+ exit 1
+
+ fi
+}
+
+
+case "$1" in
+ start)
+ status $prog && exit 0
+ check_config
+ $1
+ ;;
+ stop)
+ status $prog|| exit 0
+ $1
+ ;;
+ restart)
+ check_config
+ $1
+ ;;
+ reload)
+ status $prog || exit 7
+ check_config
+ $1
+ ;;
+ force-reload)
+ check_config
+ force_reload
+ ;;
+ status)
+ status $prog
+ ;;
+ condrestart|try-restart)
+ status $prog|| exit 0
+ check_config
+ restart
+ ;;
+ configtest)
+ echo -n $"Checking config for $prog: "
+ check_config && success
+ echo
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
+ exit 2
+esac
+exit $?
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/resource.cfg.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/resource.cfg.j2 b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/resource.cfg.j2
new file mode 100644
index 0000000..23c7a56
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/resource.cfg.j2
@@ -0,0 +1,33 @@
+###########################################################################
+#
+# RESOURCE.CFG - Sample Resource File for Nagios 3.2.3
+#
+# Last Modified: 09-10-2003
+#
+# You can define $USERx$ macros in this file, which can in turn be used
+# in command definitions in your host config file(s). $USERx$ macros are
+# useful for storing sensitive information such as usernames, passwords,
+# etc. They are also handy for specifying the path to plugins and
+# event handlers - if you decide to move the plugins or event handlers to
+# a different directory in the future, you can just update one or two
+# $USERx$ macros, instead of modifying a lot of command definitions.
+#
+# The CGIs will not attempt to read the contents of resource files, so
+# you can set restrictive permissions (600 or 660) on them.
+#
+# Nagios supports up to 32 $USERx$ macros ($USER1$ through $USER32$)
+#
+# Resource files may also be used to store configuration directives for
+# external data sources like MySQL...
+#
+###########################################################################
+
+# Sets $USER1$ to be the path to the plugins
+$USER1$={{plugins_dir}}
+
+# Sets $USER2$ to be the path to event handlers
+#$USER2$={{eventhandlers_dir}}
+
+# Store some usernames and passwords (hidden from the CGIs)
+#$USER3$=someuser
+#$USER4$=somepassword
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/SQOOP/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/SQOOP/package/scripts/service_check.py b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/SQOOP/package/scripts/service_check.py
index 107d012..b872be6 100644
--- a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/SQOOP/package/scripts/service_check.py
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/SQOOP/package/scripts/service_check.py
@@ -26,7 +26,7 @@ class SqoopServiceCheck(Script):
import params
env.set_params(params)
if params.security_enabled:
- Execute(format("{kinit_path_local} -kt {smoke_user_keytab} {smoke_test_user}"))
+ Execute(format("{kinit_path_local} -kt {smoke_user_keytab} {smokeuser}"))
Execute("sqoop version",
user = params.smokeuser,
logoutput = True
[3/3] git commit: AMBARI-4153. Nagios on HDP1. Using resource
management lib (aonishuk)
Posted by ao...@apache.org.
AMBARI-4153. Nagios on HDP1. Using resource management lib (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/95fb387b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/95fb387b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/95fb387b
Branch: refs/heads/trunk
Commit: 95fb387b9f7f3960f8c7280311ebc32a0023f9e3
Parents: b3659b0
Author: Andrew Onischuk <ao...@hortonworks.com>
Authored: Tue Dec 24 07:42:46 2013 -0800
Committer: Andrew Onischuk <ao...@hortonworks.com>
Committed: Tue Dec 24 07:46:19 2013 -0800
----------------------------------------------------------------------
.../HDP/1.3._/services/NAGIOS/metainfo.xml | 89 +-
.../NAGIOS/package/files/check_aggregate.php | 243 ++++
.../services/NAGIOS/package/files/check_cpu.pl | 114 ++
.../package/files/check_datanode_storage.php | 100 ++
.../NAGIOS/package/files/check_hdfs_blocks.php | 115 ++
.../package/files/check_hdfs_capacity.php | 109 ++
.../files/check_hive_metastore_status.sh | 45 +
.../NAGIOS/package/files/check_hue_status.sh | 31 +
.../files/check_mapred_local_dir_used.sh | 34 +
.../package/files/check_name_dir_status.php | 93 ++
.../NAGIOS/package/files/check_namenodes_ha.sh | 82 ++
.../package/files/check_nodemanager_health.sh | 44 +
.../NAGIOS/package/files/check_oozie_status.sh | 45 +
.../NAGIOS/package/files/check_rpcq_latency.php | 104 ++
.../package/files/check_templeton_status.sh | 45 +
.../NAGIOS/package/files/check_webui.sh | 87 ++
.../NAGIOS/package/files/hdp_nagios_init.php | 81 ++
.../NAGIOS/package/scripts/functions.py | 31 +
.../services/NAGIOS/package/scripts/nagios.py | 97 ++
.../NAGIOS/package/scripts/nagios_server.py | 87 ++
.../package/scripts/nagios_server_config.py | 91 ++
.../NAGIOS/package/scripts/nagios_service.py | 36 +
.../services/NAGIOS/package/scripts/params.py | 168 +++
.../NAGIOS/package/scripts/status_params.py | 26 +
.../NAGIOS/package/templates/contacts.cfg.j2 | 91 ++
.../package/templates/hadoop-commands.cfg.j2 | 114 ++
.../package/templates/hadoop-hostgroups.cfg.j2 | 15 +
.../package/templates/hadoop-hosts.cfg.j2 | 16 +
.../templates/hadoop-servicegroups.cfg.j2 | 80 ++
.../package/templates/hadoop-services.cfg.j2 | 737 ++++++++++
.../NAGIOS/package/templates/nagios.cfg.j2 | 1349 ++++++++++++++++++
.../NAGIOS/package/templates/nagios.conf.j2 | 62 +
.../services/NAGIOS/package/templates/nagios.j2 | 146 ++
.../NAGIOS/package/templates/resource.cfg.j2 | 33 +
.../SQOOP/package/scripts/service_check.py | 2 +-
35 files changed, 4634 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/metainfo.xml
index 76471cf..9af461e 100644
--- a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/metainfo.xml
@@ -16,15 +16,90 @@
limitations under the License.
-->
<metainfo>
- <user>root</user>
- <comment>Nagios Monitoring and Alerting system</comment>
- <version>3.5.0</version>
-
- <components>
+ <schemaVersion>2.0</schemaVersion>
+ <services>
+ <service>
+ <name>NAGIOS</name>
+ <comment>Nagios Monitoring and Alerting system</comment>
+ <version>3.5.0</version>
+ <components>
<component>
<name>NAGIOS_SERVER</name>
<category>MASTER</category>
+ <commandScript>
+ <script>scripts/nagios_server.py</script>
+ <scriptType>PYTHON</scriptType>
+ <timeout>600</timeout>
+ </commandScript>
</component>
- </components>
-
+ </components>
+ <osSpecifics>
+ <osSpecific>
+ <osType>any</osType>
+ <packages>
+ <package>
+ <type>rpm</type>
+ <name>perl</name>
+ </package>
+ <package>
+ <type>rpm</type>
+ <name>perl-Net-SNMP</name>
+ </package>
+ <package>
+ <type>rpm</type>
+ <name>nagios-plugins-1.4.9</name>
+ </package>
+ <package>
+ <type>rpm</type>
+ <name>nagios-3.5.0-99</name>
+ </package>
+ <package>
+ <type>rpm</type>
+ <name>nagios-www-3.5.0-99</name>
+ </package>
+ <package>
+ <type>rpm</type>
+ <name>nagios-devel-3.5.0-99</name>
+ </package>
+ <package>
+ <type>rpm</type>
+ <name>fping</name>
+ </package>
+ <package>
+ <type>rpm</type>
+ <name>hdp_mon_nagios_addons</name>
+ </package>
+ </packages>
+ </osSpecific>
+ <osSpecific>
+ <osType>suse</osType>
+ <package>
+ <type>rpm</type>
+ <name>php5-json</name>
+ </package>
+ </osSpecific>
+ <osSpecific>
+ <osType>centos5</osType>
+ <package>
+ <type>rpm</type>
+ <name>php-pecl-json.x86_64</name>
+ </package>
+ </osSpecific>
+ <osSpecific>
+ <osType>redhat5</osType>
+ <package>
+ <type>rpm</type>
+ <name>php-pecl-json.x86_64</name>
+ </package>
+ </osSpecific>
+ <osSpecific>
+ <osType>oraclelinux5</osType>
+ <package>
+ <type>rpm</type>
+ <name>php-pecl-json.x86_64</name>
+ </package>
+ </osSpecific>
+ </osSpecifics>
+ </service>
+ </services>
</metainfo>
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_aggregate.php
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_aggregate.php b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_aggregate.php
new file mode 100644
index 0000000..f4063fb
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_aggregate.php
@@ -0,0 +1,243 @@
+<?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.
+ */
+
+ $options = getopt ("f:s:n:w:c:t:");
+ if (!array_key_exists('t', $options) || !array_key_exists('f', $options) || !array_key_exists('w', $options)
+ || !array_key_exists('c', $options) || !array_key_exists('s', $options)) {
+ usage();
+ exit(3);
+ }
+ $status_file=$options['f'];
+ $status_code=$options['s'];
+ $type=$options['t'];
+ $warn=$options['w']; $warn = preg_replace('/%$/', '', $warn);
+ $crit=$options['c']; $crit = preg_replace('/%$/', '', $crit);
+ if ($type == "service" && !array_key_exists('n', $options)) {
+ echo "Service description not provided -n option\n";
+ exit(3);
+ }
+ if ($type == "service") {
+ $service_name=$options['n'];
+ /* echo "DESC: " . $service_name . "\n"; */
+ }
+
+ $result = array();
+ $status_file_content = file_get_contents($status_file);
+
+ $counts;
+ if ($type == "service") {
+ $counts=query_alert_count($status_file_content, $service_name, $status_code);
+ } else {
+ $counts=query_host_count($status_file_content, $status_code);
+ }
+
+ if ($counts['total'] == 0) {
+ $percent = 0;
+ } else {
+ $percent = ($counts['actual']/$counts['total'])*100;
+ }
+ if ($percent >= $crit) {
+ echo "CRITICAL: total:<" . $counts['total'] . ">, affected:<" . $counts['actual'] . ">\n";
+ exit (2);
+ }
+ if ($percent >= $warn) {
+ echo "WARNING: total:<" . $counts['total'] . ">, affected:<" . $counts['actual'] . ">\n";
+ exit (1);
+ }
+ echo "OK: total:<" . $counts['total'] . ">, affected:<" . $counts['actual'] . ">\n";
+ exit(0);
+
+
+ # Functions
+ /* print usage */
+ function usage () {
+ echo "Usage: $0 -f <status_file_path> -t type(host/service) -s <status_codes> -n <service description> -w <warn%> -c <crit%>\n";
+ }
+
+ /* Query host count */
+ function query_host_count ($status_file_content, $status_code) {
+ $num_matches = preg_match_all("/hoststatus \{([\S\s]*?)\}/", $status_file_content, $matches, PREG_PATTERN_ORDER);
+ $hostcounts_object = array ();
+ $total_hosts = 0;
+ $hosts = 0;
+ foreach ($matches[0] as $object) {
+ $total_hosts++;
+ if (getParameter($object, "current_state") == $status_code) {
+ $hosts++;
+ }
+ }
+ $hostcounts_object['total'] = $total_hosts;
+ $hostcounts_object['actual'] = $hosts;
+ return $hostcounts_object;
+ }
+
+ /* Query Alert counts */
+ function query_alert_count ($status_file_content, $service_name, $status_code) {
+ $num_matches = preg_match_all("/servicestatus \{([\S\s]*?)\}/", $status_file_content, $matches, PREG_PATTERN_ORDER);
+ $alertcounts_objects = array ();
+ $total_alerts=0;
+ $alerts=0;
+ foreach ($matches[0] as $object) {
+ if (getParameter($object, "service_description") == $service_name) {
+ $total_alerts++;
+ if (getParameter($object, "current_state") >= $status_code) {
+ $alerts++;
+ }
+ }
+ }
+ $alertcounts_objects['total'] = $total_alerts;
+ $alertcounts_objects['actual'] = $alerts;
+ return $alertcounts_objects;
+ }
+
+ function get_service_type($service_description)
+ {
+ $pieces = explode("::", $service_description);
+ switch ($pieces[0]) {
+ case "NAMENODE":
+ $pieces[0] = "HDFS";
+ break;
+ case "JOBTRACKER":
+ $pieces[0] = "MAPREDUCE";
+ break;
+ case "HBASEMASTER":
+ $pieces[0] = "HBASE";
+ break;
+ case "SYSTEM":
+ case "HDFS":
+ case "MAPREDUCE":
+ case "HBASE":
+ break;
+ default:
+ $pieces[0] = "UNKNOWN";
+ }
+ return $pieces[0];
+ }
+
+ function getParameter($object, $key)
+ {
+ $pattern="/\s" . $key . "[\s= ]*([\S, ]*)\n/";
+ $num_mat = preg_match($pattern, $object, $matches);
+ $value = "";
+ if ($num_mat) {
+ $value = $matches[1];
+ }
+ return $value;
+ }
+
+function indent($json) {
+
+ $result = '';
+ $pos = 0;
+ $strLen = strlen($json);
+ $indentStr = ' ';
+ $newLine = "\n";
+ $prevChar = '';
+ $outOfQuotes = true;
+
+ for ($i=0; $i<=$strLen; $i++) {
+
+ // Grab the next character in the string.
+ $char = substr($json, $i, 1);
+
+ // Are we inside a quoted string?
+ if ($char == '"' && $prevChar != '\\') {
+ $outOfQuotes = !$outOfQuotes;
+
+ // If this character is the end of an element,
+ // output a new line and indent the next line.
+ } else if(($char == '}' || $char == ']') && $outOfQuotes) {
+ $result .= $newLine;
+ $pos --;
+ for ($j=0; $j<$pos; $j++) {
+ $result .= $indentStr;
+ }
+ }
+
+ // Add the character to the result string.
+ $result .= $char;
+
+ // If the last character was the beginning of an element,
+ // output a new line and indent the next line.
+ if (($char == ',' || $char == '{' || $char == '[') && $outOfQuotes) {
+ $result .= $newLine;
+ if ($char == '{' || $char == '[') {
+ $pos ++;
+ }
+
+ for ($j = 0; $j < $pos; $j++) {
+ $result .= $indentStr;
+ }
+ }
+
+ $prevChar = $char;
+ }
+
+ return $result;
+}
+
+/* JSON documment format */
+/*
+{
+ "programstatus":{
+ "last_command_check":"1327385743"
+ },
+ "hostcounts":{
+ "up_nodes":"",
+ "down_nodes":""
+ },
+ "hoststatus":[
+ {
+ "host_name"="ip-10-242-191-48.ec2.internal",
+ "current_state":"0",
+ "last_hard_state":"0",
+ "plugin_output":"PING OK - Packet loss = 0%, RTA = 0.04 ms",
+ "last_check":"1327385564",
+ "current_attempt":"1",
+ "last_hard_state_change":"1327362079",
+ "last_time_up":"1327385574",
+ "last_time_down":"0",
+ "last_time_unreachable":"0",
+ "is_flapping":"0",
+ "last_check":"1327385574",
+ "servicestatus":[
+ ]
+ }
+ ],
+ "servicestatus":[
+ {
+ "service_type":"HDFS", {HBASE, MAPREDUCE, HIVE, ZOOKEEPER}
+ "service_description":"HDFS Current Load",
+ "host_name"="ip-10-242-191-48.ec2.internal",
+ "current_attempt":"1",
+ "current_state":"0",
+ "plugin_output":"PING OK - Packet loss = 0%, RTA = 0.04 ms",
+ "last_hard_state_change":"1327362079",
+ "last_time_ok":"1327385479",
+ "last_time_warning":"0",
+ "last_time_unknown":"0",
+ "last_time_critical":"0",
+ "last_check":"1327385574",
+ "is_flapping":"0"
+ }
+ ]
+}
+*/
+
+?>
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_cpu.pl
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_cpu.pl b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_cpu.pl
new file mode 100644
index 0000000..a5680f7
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_cpu.pl
@@ -0,0 +1,114 @@
+#!/usr/bin/perl -w
+#
+#
+# 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.
+#
+#
+use strict;
+use Net::SNMP;
+use Getopt::Long;
+
+# Variable
+my $base_proc = "1.3.6.1.2.1.25.3.3.1";
+my $proc_load = "1.3.6.1.2.1.25.3.3.1.2";
+my $o_host = undef;
+my $o_community = undef;
+my $o_warn= undef;
+my $o_crit= undef;
+my $o_timeout = 15;
+my $o_port = 161;
+
+sub Usage {
+ print "Usage: $0 -H <host> -C <snmp_community> -w <warn level> -c <crit level>\n";
+}
+
+Getopt::Long::Configure ("bundling");
+GetOptions(
+ 'H:s' => \$o_host,
+ 'C:s' => \$o_community,
+ 'c:s' => \$o_crit,
+ 'w:s' => \$o_warn
+ );
+if (!defined $o_host || !defined $o_community || !defined $o_crit || !defined $o_warn) {
+ Usage();
+ exit 3;
+}
+$o_warn =~ s/\%//g;
+$o_crit =~ s/\%//g;
+alarm ($o_timeout);
+$SIG{'ALRM'} = sub {
+ print "Unable to contact host: $o_host\n";
+ exit 3;
+};
+
+# Connect to host
+my ($session,$error);
+($session, $error) = Net::SNMP->session(
+ -hostname => $o_host,
+ -community => $o_community,
+ -port => $o_port,
+ -timeout => $o_timeout
+ );
+if (!defined($session)) {
+ printf("Error opening session: %s.\n", $error);
+ exit 3;
+}
+
+my $exit_val=undef;
+my $resultat = (Net::SNMP->VERSION < 4) ?
+ $session->get_table($base_proc)
+ : $session->get_table(Baseoid => $base_proc);
+
+if (!defined($resultat)) {
+ printf("ERROR: Description table : %s.\n", $session->error);
+ $session->close;
+ exit 3;
+}
+
+$session->close;
+
+my ($cpu_used,$ncpu)=(0,0);
+foreach my $key ( keys %$resultat) {
+ if ($key =~ /$proc_load/) {
+ $cpu_used += $$resultat{$key};
+ $ncpu++;
+ }
+}
+
+if ($ncpu==0) {
+ print "Can't find CPU usage information : UNKNOWN\n";
+ exit 3;
+}
+
+$cpu_used /= $ncpu;
+
+print "$ncpu CPU, ", $ncpu==1 ? "load" : "average load";
+printf(" %.1f%%",$cpu_used);
+$exit_val=0;
+
+if ($cpu_used > $o_crit) {
+ print " > $o_crit% : CRITICAL\n";
+ $exit_val=2;
+} else {
+ if ($cpu_used > $o_warn) {
+ print " > $o_warn% : WARNING\n";
+ $exit_val=1;
+ }
+}
+print " < $o_warn% : OK\n" if ($exit_val eq 0);
+exit $exit_val;
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_datanode_storage.php
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_datanode_storage.php b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_datanode_storage.php
new file mode 100644
index 0000000..dee22b4
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_datanode_storage.php
@@ -0,0 +1,100 @@
+<?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 makes call to master node, get the jmx-json document
+ * check the storage capacity remaining on local datanode storage
+ */
+
+ include "hdp_nagios_init.php";
+
+ $options = getopt ("h:p:w:c:e:k:r:t:s:");
+ if (!array_key_exists('h', $options) || !array_key_exists('p', $options) || !array_key_exists('w', $options)
+ || !array_key_exists('c', $options)) {
+ usage();
+ exit(3);
+ }
+
+ $host=$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['s'];
+ $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");
+
+ /* Get the json document */
+ $ch = curl_init();
+ $username = rtrim(`id -un`, "\n");
+ curl_setopt_array($ch, array( CURLOPT_URL => $protocol."://".$host.":".$port."/jmx?qry=Hadoop:service=DataNode,name=FSDatasetState-*",
+ 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];
+ $cap_remain = $object['Remaining']; /* Total capacity - any extenal files created in data directories by non-hadoop app */
+ $cap_total = $object['Capacity']; /* Capacity used by all data partitions minus space reserved for M/R */
+ if (count($object) == 0) {
+ echo "CRITICAL: Data inaccessible, Status code = ". $info['http_code'] ."\n";
+ exit(2);
+ }
+ $percent_full = ($cap_total - $cap_remain)/$cap_total * 100;
+
+ $out_msg = "Capacity:[" . $cap_total .
+ "], Remaining Capacity:[" . $cap_remain .
+ "], percent_full:[" . $percent_full . "]";
+
+ if ($percent_full > $crit) {
+ echo "CRITICAL: " . $out_msg . "\n";
+ exit (2);
+ }
+ if ($percent_full > $warn) {
+ echo "WARNING: " . $out_msg . "\n";
+ exit (1);
+ }
+ echo "OK: " . $out_msg . "\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 -s security enabled -e ssl enabled\n";
+ }
+?>
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_hdfs_blocks.php
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_hdfs_blocks.php b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_hdfs_blocks.php
new file mode 100644
index 0000000..19347b4
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_hdfs_blocks.php
@@ -0,0 +1,115 @@
+<?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 makes call to master node, get the jmx-json document
+ * check the corrupt or missing blocks % is > threshod
+ * check_jmx -H hostaddress -p port -w 1% -c 1%
+ */
+
+ include "hdp_nagios_init.php";
+
+ $options = getopt ("h:p:w:c:s:e:k:r:t:u:");
+ if (!array_key_exists('h', $options) || !array_key_exists('p', $options) || !array_key_exists('w', $options)
+ || !array_key_exists('c', $options) || !array_key_exists('s', $options)) {
+ usage();
+ exit(3);
+ }
+
+ $hosts=$options['h'];
+ $port=$options['p'];
+ $warn=$options['w']; $warn = preg_replace('/%$/', '', $warn);
+ $crit=$options['c']; $crit = preg_replace('/%$/', '', $crit);
+ $nn_jmx_property=$options['s'];
+ $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");
+
+
+ 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=Hadoop:service=NameNode,name=".$nn_jmx_property,
+ 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);
+ $m_percent = 0;
+ $c_percent = 0;
+ $object = $json_array['beans'][0];
+ $missing_blocks = $object['MissingBlocks'];
+ $corrupt_blocks = $object['CorruptBlocks'];
+ $total_blocks = $object['BlocksTotal'];
+ if (count($object) == 0) {
+ echo "CRITICAL: Data inaccessible, Status code = ". $info['http_code'] ."\n";
+ exit(2);
+ }
+ if($total_blocks == 0) {
+ $m_percent = 0;
+ $c_percent = 0;
+ } else {
+ $m_percent = ($missing_blocks/$total_blocks)*100;
+ $c_percent = ($corrupt_blocks/$total_blocks)*100;
+ break;
+ }
+ }
+ $out_msg = "corrupt_blocks:<" . $corrupt_blocks .
+ ">, missing_blocks:<" . $missing_blocks .
+ ">, total_blocks:<" . $total_blocks . ">";
+
+ if ($m_percent > $crit || $c_percent > $crit) {
+ echo "CRITICAL: " . $out_msg . "\n";
+ exit (2);
+ }
+ if ($m_percent > $warn || $c_percent > $warn) {
+ echo "WARNING: " . $out_msg . "\n";
+ exit (1);
+ }
+ echo "OK: " . $out_msg . "\n";
+ exit(0);
+
+ /* print usage */
+ function usage () {
+ echo "Usage: $0 -h <host> -p port -w <warn%> -c <crit%> -s <namenode bean name> -k keytab path -r principal name -t kinit path -s security enabled -e ssl enabled\n";
+ }
+?>
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_hdfs_capacity.php
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_hdfs_capacity.php b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_hdfs_capacity.php
new file mode 100644
index 0000000..af72723
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_hdfs_capacity.php
@@ -0,0 +1,109 @@
+<?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 makes call to master node, get the jmx-json document
+ * check the % HDFS capacity used >= warn and critical limits.
+ * check_jmx -H hostaddress -p port -w 1 -c 1
+ */
+
+ include "hdp_nagios_init.php";
+
+ $options = getopt ("h:p:w:c:e:k:r:t:s:");
+ 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['s'];
+ $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");
+
+
+ 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=Hadoop:service=NameNode,name=FSNamesystemState",
+ 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);
+ $percent = 0;
+ $object = $json_array['beans'][0];
+ $CapacityUsed = $object['CapacityUsed'];
+ $CapacityRemaining = $object['CapacityRemaining'];
+ if (count($object) == 0) {
+ echo "CRITICAL: Data inaccessible, Status code = ". $info['http_code'] ."\n";
+ exit(2);
+ }
+ $CapacityTotal = $CapacityUsed + $CapacityRemaining;
+ if($CapacityTotal == 0) {
+ $percent = 0;
+ } else {
+ $percent = ($CapacityUsed/$CapacityTotal)*100;
+ break;
+ }
+ }
+ $out_msg = "DFSUsedGB:<" . round ($CapacityUsed/(1024*1024*1024),1) .
+ ">, DFSTotalGB:<" . round($CapacityTotal/(1024*1024*1024),1) . ">";
+
+ if ($percent >= $crit) {
+ echo "CRITICAL: " . $out_msg . "\n";
+ exit (2);
+ }
+ if ($percent >= $warn) {
+ echo "WARNING: " . $out_msg . "\n";
+ exit (1);
+ }
+ echo "OK: " . $out_msg . "\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 -s security enabled -e ssl enabled\n";
+ }
+?>
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_hive_metastore_status.sh
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_hive_metastore_status.sh b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_hive_metastore_status.sh
new file mode 100644
index 0000000..640c077
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_hive_metastore_status.sh
@@ -0,0 +1,45 @@
+#!/usr/bin/env bash
+#
+#
+# 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.
+#
+#
+#The uri is of the form thrift://<hostname>:<port>
+HOST=$1
+PORT=$2
+JAVA_HOME=$3
+SEC_ENABLED=$4
+if [[ "$SEC_ENABLED" == "true" ]]; then
+ NAGIOS_KEYTAB=$5
+ NAGIOS_USER=$6
+ KINIT_PATH=$7
+ out1=`${KINIT_PATH} -kt ${NAGIOS_KEYTAB} ${NAGIOS_USER} 2>&1`
+ if [[ "$?" -ne 0 ]]; then
+ echo "CRITICAL: Error doing kinit for nagios [$out1]";
+ exit 2;
+ fi
+fi
+HCAT_URL=-Dhive.metastore.uris="thrift://$HOST:$PORT"
+export JAVA_HOME=$JAVA_HOME
+out=`hcat $HCAT_URL -e "show databases" 2>&1`
+if [[ "$?" -ne 0 ]]; then
+ echo "CRITICAL: Error accessing Hive Metastore status [$out]";
+ exit 2;
+fi
+echo "OK: Hive Metastore status OK";
+exit 0;
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_hue_status.sh
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_hue_status.sh b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_hue_status.sh
new file mode 100644
index 0000000..076d9b3
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_hue_status.sh
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+#
+#
+# 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.
+#
+#
+
+status=`/etc/init.d/hue status 2>&1`
+
+if [[ "$?" -ne 0 ]]; then
+ echo "WARNING: Hue is stopped";
+ exit 1;
+fi
+
+echo "OK: Hue is running";
+exit 0;
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_mapred_local_dir_used.sh
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_mapred_local_dir_used.sh b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_mapred_local_dir_used.sh
new file mode 100644
index 0000000..15c85eb
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_mapred_local_dir_used.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+#
+#
+# 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.
+#
+#
+MAPRED_LOCAL_DIRS=$1
+CRITICAL=`echo $2 | cut -d % -f 1`
+IFS=","
+for mapred_dir in $MAPRED_LOCAL_DIRS
+do
+ percent=`df -hl $mapred_dir | awk '{percent=$5;} END{print percent}' | cut -d % -f 1`
+ if [ $percent -ge $CRITICAL ]; then
+ echo "CRITICAL: MapReduce local dir is full."
+ exit 2
+ fi
+done
+echo "OK: MapReduce local dir space is available."
+exit 0
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_name_dir_status.php
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_name_dir_status.php b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_name_dir_status.php
new file mode 100644
index 0000000..186166d
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_name_dir_status.php
@@ -0,0 +1,93 @@
+<?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 makes call to namenode, get the jmx-json document
+ * check the NameDirStatuses to find any offline (failed) directories
+ * check_jmx -H hostaddress -p port -k keytab path -r principal name -t kinit path -s security enabled
+ */
+
+ include "hdp_nagios_init.php";
+
+ $options = getopt("h:p:e:k:r:t:s:");
+ //Check only for mandatory options
+ if (!array_key_exists('h', $options) || !array_key_exists('p', $options)) {
+ usage();
+ exit(3);
+ }
+
+ $host=$options['h'];
+ $port=$options['p'];
+ $keytab_path=$options['k'];
+ $principal_name=$options['r'];
+ $kinit_path_local=$options['t'];
+ $security_enabled=$options['s'];
+ $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");
+
+ /* Get the json document */
+ $ch = curl_init();
+ $username = rtrim(`id -un`, "\n");
+ curl_setopt_array($ch, array( CURLOPT_URL => $protocol."://".$host.":".$port."/jmx?qry=Hadoop:service=NameNode,name=NameNodeInfo",
+ 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 ($object['NameDirStatuses'] == "") {
+ echo "WARNING: NameNode directory status not available via ".$protocol."://".$host.":".$port."/jmx url, code " . $info['http_code'] ."\n";
+ exit(1);
+ }
+ $NameDirStatuses = json_decode($object['NameDirStatuses'], true);
+ $failed_dir_count = count($NameDirStatuses['failed']);
+ $out_msg = "CRITICAL: Offline NameNode directories: ";
+ if ($failed_dir_count > 0) {
+ foreach ($NameDirStatuses['failed'] as $key => $value) {
+ $out_msg = $out_msg . $key . ":" . $value . ", ";
+ }
+ echo $out_msg . "\n";
+ exit (2);
+ }
+ echo "OK: All NameNode directories are active" . "\n";
+ exit(0);
+
+ /* print usage */
+ function usage () {
+ echo "Usage: $0 -h <host> -p port -k keytab path -r principal name -t kinit path -s security enabled -e ssl enabled";
+ }
+?>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_namenodes_ha.sh
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_namenodes_ha.sh b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_namenodes_ha.sh
new file mode 100644
index 0000000..50b075a
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_namenodes_ha.sh
@@ -0,0 +1,82 @@
+#!/usr/bin/env bash
+#
+#
+# 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.
+#
+#
+
+IFS=',' read -a namenodes <<< "$1"
+port=$2
+totalNN=${#namenodes[@]}
+activeNN=()
+standbyNN=()
+unavailableNN=()
+
+for nn in "${namenodes[@]}"
+do
+ status=$(curl -m 5 -s http://$nn:$port/jmx?qry=Hadoop:service=NameNode,name=FSNamesystem | grep -i "tag.HAState" | grep -o -E "standby|active")
+ if [ "$status" == "active" ]; then
+ activeNN[${#activeNN[*]}]="$nn"
+ elif [ "$status" == "standby" ]; then
+ standbyNN[${#standbyNN[*]}]="$nn"
+ elif [ "$status" == "" ]; then
+ unavailableNN[${#unavailableNN[*]}]="$nn"
+ fi
+done
+
+message=""
+critical=false
+
+if [ ${#activeNN[@]} -gt 1 ]; then
+ critical=true
+ message=$message" Only one NN can have HAState=active;"
+elif [ ${#activeNN[@]} == 0 ]; then
+ critical=true
+ message=$message" No Active NN available;"
+elif [ ${#standbyNN[@]} == 0 ]; then
+ critical=true
+ message=$message" No Standby NN available;"
+fi
+
+NNstats=" Active<"
+for nn in "${activeNN[@]}"
+do
+ NNstats="$NNstats$nn;"
+done
+NNstats=${NNstats%\;}
+NNstats=$NNstats">, Standby<"
+for nn in "${standbyNN[@]}"
+do
+ NNstats="$NNstats$nn;"
+done
+NNstats=${NNstats%\;}
+NNstats=$NNstats">, Unavailable<"
+for nn in "${unavailableNN[@]}"
+do
+ NNstats="$NNstats$nn;"
+done
+NNstats=${NNstats%\;}
+NNstats=$NNstats">"
+
+if [ $critical == false ]; then
+ echo "OK: NameNode HA healthy;"$NNstats
+ exit 0
+fi
+
+echo "CRITICAL:"$message$NNstats
+exit 2
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_nodemanager_health.sh
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_nodemanager_health.sh b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_nodemanager_health.sh
new file mode 100644
index 0000000..020b41d
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_nodemanager_health.sh
@@ -0,0 +1,44 @@
+#!/usr/bin/env bash
+#
+#
+# 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.
+#
+#
+HOST=$1
+PORT=$2
+NODEMANAGER_URL="http://$HOST:$PORT/ws/v1/node/info"
+SEC_ENABLED=$3
+export PATH="/usr/bin:$PATH"
+if [[ "$SEC_ENABLED" == "true" ]]; then
+ NAGIOS_KEYTAB=$4
+ NAGIOS_USER=$5
+ KINIT_PATH=$6
+ out1=`${KINIT_PATH} -kt ${NAGIOS_KEYTAB} ${NAGIOS_USER} 2>&1`
+ if [[ "$?" -ne 0 ]]; then
+ echo "CRITICAL: Error doing kinit for nagios [$out1]";
+ exit 2;
+ fi
+fi
+
+RESPONSE=`curl --negotiate -u : -s $NODEMANAGER_URL`
+if [[ "$RESPONSE" == *'"nodeHealthy":true'* ]]; then
+ echo "OK: NodeManager healthy";
+ exit 0;
+fi
+echo "CRITICAL: NodeManager unhealthy";
+exit 2;
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_oozie_status.sh
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_oozie_status.sh b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_oozie_status.sh
new file mode 100644
index 0000000..820ee99
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_oozie_status.sh
@@ -0,0 +1,45 @@
+#!/usr/bin/env bash
+#
+#
+# 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.
+#
+#
+# OOZIE_URL is of the form http://<hostname>:<port>/oozie
+HOST=`echo $1 | tr '[:upper:]' '[:lower:]'`
+PORT=$2
+JAVA_HOME=$3
+SEC_ENABLED=$4
+if [[ "$SEC_ENABLED" == "true" ]]; then
+ NAGIOS_KEYTAB=$5
+ NAGIOS_USER=$6
+ KINIT_PATH=$7
+ out1=`${KINIT_PATH} -kt ${NAGIOS_KEYTAB} ${NAGIOS_USER} 2>&1`
+ if [[ "$?" -ne 0 ]]; then
+ echo "CRITICAL: Error doing kinit for nagios [$out1]";
+ exit 2;
+ fi
+fi
+OOZIE_URL="http://$HOST:$PORT/oozie"
+export JAVA_HOME=$JAVA_HOME
+out=`oozie admin -oozie ${OOZIE_URL} -status 2>&1`
+if [[ "$?" -ne 0 ]]; then
+ echo "CRITICAL: Error accessing Oozie Server status [$out]";
+ exit 2;
+fi
+echo "OK: Oozie Server status [$out]";
+exit 0;
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_rpcq_latency.php
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_rpcq_latency.php b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_rpcq_latency.php
new file mode 100644
index 0000000..463f69b
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_rpcq_latency.php
@@ -0,0 +1,104 @@
+<?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 makes call to master node, get the jmx-json document
+ * It checks the rpc wait time in the queue, RpcQueueTime_avg_time
+ * check_rpcq_latency -h hostaddress -p port -t ServiceName -w 1 -c 1
+ * Warning and Critical values are in seconds
+ * Service Name = JobTracker, NameNode, JobHistoryServer
+ */
+
+ include "hdp_nagios_init.php";
+
+ $options = getopt ("h:p:w:c:n:e:k:r:t: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('n', $options)) {
+ usage();
+ exit(3);
+ }
+
+ $host=$options['h'];
+ $port=$options['p'];
+ $master=$options['n'];
+ $warn=$options['w'];
+ $crit=$options['c'];
+ $keytab_path=$options['k'];
+ $principal_name=$options['r'];
+ $kinit_path_local=$options['t'];
+ $security_enabled=$options['s'];
+ $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");
+
+
+ /* Get the json document */
+ $ch = curl_init();
+ $username = rtrim(`id -un`, "\n");
+ curl_setopt_array($ch, array( CURLOPT_URL => $protocol."://".$host.":".$port."/jmx?qry=Hadoop:service=".$master.",name=RpcActivityForPort*",
+ 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) {
+ echo "CRITICAL: Data inaccessible, Status code = ". $info['http_code'] ."\n";
+ exit(2);
+ }
+ $RpcQueueTime_avg_time = round($object['RpcQueueTime_avg_time'], 2);
+ $RpcProcessingTime_avg_time = round($object['RpcProcessingTime_avg_time'], 2);
+
+ $out_msg = "RpcQueueTime_avg_time:<" . $RpcQueueTime_avg_time .
+ "> Secs, RpcProcessingTime_avg_time:<" . $RpcProcessingTime_avg_time .
+ "> Secs";
+
+ if ($RpcQueueTime_avg_time >= $crit) {
+ echo "CRITICAL: " . $out_msg . "\n";
+ exit (2);
+ }
+ if ($RpcQueueTime_avg_time >= $warn) {
+ echo "WARNING: " . $out_msg . "\n";
+ exit (1);
+ }
+ echo "OK: " . $out_msg . "\n";
+ exit(0);
+
+ /* print usage */
+ function usage () {
+ echo "Usage: $0 -h <host> -p port -n <JobTracker/NameNode/JobHistoryServer> -w <warn_in_sec> -c <crit_in_sec> -k keytab path -r principal name -t kinit path -s security enabled -e ssl enabled\n";
+ }
+?>
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_templeton_status.sh
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_templeton_status.sh b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_templeton_status.sh
new file mode 100644
index 0000000..7fbc4c4
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_templeton_status.sh
@@ -0,0 +1,45 @@
+#!/usr/bin/env bash
+#
+#
+# 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.
+#
+#
+# out='{"status":"ok","version":"v1"}<status_code:200>'
+HOST=$1
+PORT=$2
+VERSION=$3
+SEC_ENABLED=$4
+if [[ "$SEC_ENABLED" == "true" ]]; then
+ NAGIOS_KEYTAB=$5
+ NAGIOS_USER=$6
+ KINIT_PATH=$7
+ out1=`${KINIT_PATH} -kt ${NAGIOS_KEYTAB} ${NAGIOS_USER} 2>&1`
+ if [[ "$?" -ne 0 ]]; then
+ echo "CRITICAL: Error doing kinit for nagios [$out1]";
+ exit 2;
+ fi
+fi
+regex="^.*\"status\":\"ok\".*<status_code:200>$"
+out=`curl --negotiate -u : -s -w '<status_code:%{http_code}>' http://$HOST:$PORT/templeton/$VERSION/status 2>&1`
+if [[ $out =~ $regex ]]; then
+ out=`echo "$out" | sed -e 's/{/[/g' | sed -e 's/}/]/g'`
+ echo "OK: WebHCat Server status [$out]";
+ exit 0;
+fi
+echo "CRITICAL: Error accessing WebHCat Server, status [$out]";
+exit 2;
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_webui.sh
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_webui.sh b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_webui.sh
new file mode 100644
index 0000000..b23045e
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/check_webui.sh
@@ -0,0 +1,87 @@
+#!/bin/bash
+#
+#
+# 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.
+#
+#
+checkurl () {
+ url=$1
+ curl $url -o /dev/null
+ echo $?
+}
+
+service=$1
+host=$2
+port=$3
+
+if [[ -z "$service" || -z "$host" ]]; then
+ echo "UNKNOWN: Invalid arguments; Usage: check_webui.sh service_name host_name";
+ exit 3;
+fi
+
+case "$service" in
+
+jobtracker)
+ jtweburl="http://$host:$port"
+ if [[ `checkurl "$jtweburl"` -ne 0 ]]; then
+ echo "WARNING: Jobtracker web UI not accessible : $jtweburl";
+ exit 1;
+ fi
+ ;;
+namenode)
+ nnweburl="http://$host:$port"
+ if [[ `checkurl "$nnweburl"` -ne 0 ]] ; then
+ echo "WARNING: NameNode Web UI not accessible : $nnweburl";
+ exit 1;
+ fi
+ ;;
+jobhistory)
+ jhweburl="http://$host:$port/jobhistoryhome.jsp"
+ if [[ `checkurl "$jhweburl"` -ne 0 ]]; then
+ echo "WARNING: HistoryServer Web UI not accessible : $jhweburl";
+ exit 1;
+ fi
+ ;;
+hbase)
+ hbaseweburl="http://$host:$port/master-status"
+ if [[ `checkurl "$hbaseweburl"` -ne 0 ]]; then
+ echo "WARNING: HBase Master Web UI not accessible : $hbaseweburl";
+ exit 1;
+ fi
+ ;;
+resourcemanager)
+ rmweburl="http://$host:$port/cluster"
+ if [[ `checkurl "$rmweburl"` -ne 0 ]]; then
+ echo "WARNING: ResourceManager Web UI not accessible : $rmweburl";
+ exit 1;
+ fi
+ ;;
+historyserver2)
+ hsweburl="http://$host:$port/jobhistory"
+ if [[ `checkurl "$hsweburl"` -ne 0 ]]; then
+ echo "WARNING: HistoryServer Web UI not accessible : $hsweburl";
+ exit 1;
+ fi
+ ;;
+*) echo "UNKNOWN: Invalid service name [$service], valid options [jobtracker|jobhistory|hbase|namenode|resourcemanager|historyserver2]"
+ exit 3
+ ;;
+esac
+
+echo "OK: Successfully accessed $service Web UI"
+exit 0;
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/hdp_nagios_init.php
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/hdp_nagios_init.php b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/hdp_nagios_init.php
new file mode 100644
index 0000000..487eb43
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/files/hdp_nagios_init.php
@@ -0,0 +1,81 @@
+<?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.
+ */
+
+/* Common functions called from other alerts
+ *
+ */
+
+ /*
+ * Function for kinit. Checks if security enabled and klist for this principal doesn't returns nothing,
+ * make kinit call in this case.
+ */
+ function kinit_if_needed($security_enabled, $kinit_path_local, $keytab_path, $principal_name) {
+ if($security_enabled === 'true') {
+
+ $is_logined = is_logined($principal_name);
+
+ if (!$is_logined)
+ $status = kinit($kinit_path_local, $keytab_path, $principal_name);
+ else
+ $status = array(0, '');
+ } else {
+ $status = array(0, '');
+ }
+
+ return $status;
+ }
+
+
+ /*
+ * Checks if user is logined on kerberos
+ */
+ function is_logined($principal_name) {
+ $check_cmd = "klist|grep $principal_name 1> /dev/null 2>/dev/null ; [[ $? != 0 ]] && echo 1";
+ $check_output = shell_exec($check_cmd);
+
+ if ($check_output)
+ return false;
+ else
+ return true;
+ }
+
+ /*
+ * Runs kinit command.
+ */
+ function kinit($kinit_path_local, $keytab_path, $principal_name) {
+ $init_cmd = "$kinit_path_local -kt $keytab_path $principal_name 2>&1";
+ $kinit_output = shell_exec($init_cmd);
+ if ($kinit_output)
+ $status = array(1, $kinit_output);
+ else
+ $status = array(0, '');
+
+ return $status;
+ }
+
+ function logout() {
+ if (shell_exec("rm -f /tmp/krb5cc_".trim(shell_exec('id -u'))) == "" )
+ $status = true;
+ else
+ $status = false;
+
+ return $status;
+ }
+
+ ?>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/functions.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/functions.py b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/functions.py
new file mode 100644
index 0000000..964225e
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/functions.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+"""
+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.
+
+Ambari Agent
+
+"""
+from resource_management.libraries.script.config_dictionary import UnknownConfiguration
+
+def get_port_from_url(address):
+ if not is_empty(address):
+ return address.split(':')[-1]
+ else:
+ return address
+
+def is_empty(var):
+ return isinstance(var, UnknownConfiguration)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/nagios.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/nagios.py b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/nagios.py
new file mode 100644
index 0000000..af09e87
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/nagios.py
@@ -0,0 +1,97 @@
+#!/usr/bin/env python
+"""
+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.
+
+Ambari Agent
+
+"""
+
+from resource_management import *
+from nagios_server_config import nagios_server_config
+
+def nagios():
+ import params
+
+ File( params.nagios_httpd_config_file,
+ owner = params.nagios_user,
+ group = params.nagios_group,
+ content = Template("nagios.conf.j2"),
+ mode = 0644
+ )
+
+ # enable snmpd
+ Execute( "service snmpd start; chkconfig snmpd on",
+ path = "/usr/local/bin/:/bin/:/sbin/"
+ )
+
+ Directory( params.conf_dir,
+ owner = params.nagios_user,
+ group = params.nagios_group
+ )
+
+ Directory( [params.plugins_dir, params.nagios_obj_dir])
+
+ Directory( params.nagios_pid_dir,
+ owner = params.nagios_user,
+ group = params.nagios_group,
+ mode = 0755,
+ recursive = True
+ )
+
+ Directory( [params.nagios_var_dir, params.check_result_path, params.nagios_rw_dir],
+ owner = params.nagios_user,
+ group = params.nagios_group,
+ recursive = True
+ )
+
+ Directory( [params.nagios_log_dir, params.nagios_log_archives_dir],
+ owner = params.nagios_user,
+ group = params.nagios_group,
+ mode = 0755
+ )
+
+ nagios_server_config()
+
+ set_web_permisssions()
+
+ File( format("{conf_dir}/command.cfg"),
+ owner = params.nagios_user,
+ group = params.nagios_group
+ )
+
+
+def set_web_permisssions():
+ import params
+
+ cmd = format("{htpasswd_cmd} -c -b /etc/nagios/htpasswd.users {nagios_web_login} {nagios_web_password}")
+ test = format("grep {nagios_web_login} /etc/nagios/htpasswd.users")
+ Execute( cmd,
+ not_if = test
+ )
+
+ File( "/etc/nagios/htpasswd.users",
+ owner = params.nagios_user,
+ group = params.nagios_group,
+ mode = 0640
+ )
+
+ if System.get_instance().platform == "suse":
+ command = format("usermod -G {nagios_group} wwwrun")
+ else:
+ command = format("usermod -a -G {nagios_group} apache")
+
+ Execute( command)
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/nagios_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/nagios_server.py b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/nagios_server.py
new file mode 100644
index 0000000..02685c7
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/nagios_server.py
@@ -0,0 +1,87 @@
+#!/usr/bin/env python
+"""
+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.
+
+Ambari Agent
+
+"""
+
+import sys
+from resource_management import *
+from nagios import nagios
+from nagios_service import nagios_service
+
+
+class NagiosServer(Script):
+ def install(self, env):
+ remove_conflicting_packages()
+ self.install_packages(env)
+ self.configure(env)
+
+ def configure(self, env):
+ import params
+ env.set_params(params)
+ nagios()
+
+
+ def start(self, env):
+ import params
+ env.set_params(params)
+
+ self.configure(env) # done for updating configs after Security enabled
+ nagios_service(action='start')
+
+
+ def stop(self, env):
+ import params
+ env.set_params(params)
+
+ nagios_service(action='stop')
+
+
+ def status(self, env):
+ import status_params
+ env.set_params(status_params)
+ check_process_status(status_params.nagios_pid_file)
+
+def remove_conflicting_packages():
+ Package( 'hdp_mon_nagios_addons',
+ action = "remove"
+ )
+
+ Package( 'nagios-plugins',
+ action = "remove"
+ )
+
+ Execute( "rpm -e --allmatches --nopostun nagios",
+ path = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
+ ignore_failures = True
+ )
+
+def main():
+ command_type = sys.argv[1] if len(sys.argv)>1 else "install"
+ print "Running "+command_type
+ command_data_file = '/var/lib/ambari-agent/data/command-3.json'
+ basedir = '/root/ambari/ambari-server/src/main/resources/stacks/HDP/2.0._/services/NAGIOS/package'
+ stroutfile = '/1.txt'
+ sys.argv = ["", command_type, command_data_file, basedir, stroutfile]
+
+ NagiosServer().execute()
+
+if __name__ == "__main__":
+ #main()
+ NagiosServer().execute()
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/nagios_server_config.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/nagios_server_config.py b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/nagios_server_config.py
new file mode 100644
index 0000000..b3e639c
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/nagios_server_config.py
@@ -0,0 +1,91 @@
+#!/usr/bin/env python
+"""
+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.
+
+Ambari Agent
+
+"""
+
+from resource_management import *
+
+def nagios_server_config():
+ import params
+
+ nagios_server_configfile( 'nagios.cfg',
+ config_dir = params.conf_dir,
+ group = params.nagios_group
+ )
+ nagios_server_configfile( 'resource.cfg',
+ config_dir = params.conf_dir,
+ group = params.nagios_group
+ )
+ nagios_server_configfile( 'hadoop-hosts.cfg')
+ nagios_server_configfile( 'hadoop-hostgroups.cfg')
+ nagios_server_configfile( 'hadoop-servicegroups.cfg')
+ nagios_server_configfile( 'hadoop-services.cfg')
+ nagios_server_configfile( 'hadoop-commands.cfg')
+ nagios_server_configfile( 'contacts.cfg')
+
+ if System.get_instance().platform != "suse":
+ nagios_server_configfile( 'nagios',
+ config_dir = '/etc/init.d/',
+ mode = 0755,
+ owner = 'root',
+ group = 'root'
+ )
+
+ nagios_server_check( 'check_cpu.pl')
+ nagios_server_check( 'check_datanode_storage.php')
+ nagios_server_check( 'check_aggregate.php')
+ nagios_server_check( 'check_hdfs_blocks.php')
+ nagios_server_check( 'check_hdfs_capacity.php')
+ nagios_server_check( 'check_rpcq_latency.php')
+ nagios_server_check( 'check_webui.sh')
+ nagios_server_check( 'check_name_dir_status.php')
+ nagios_server_check( 'check_oozie_status.sh')
+ nagios_server_check( 'check_templeton_status.sh')
+ nagios_server_check( 'check_hive_metastore_status.sh')
+ nagios_server_check( 'check_hue_status.sh')
+ nagios_server_check( 'check_mapred_local_dir_used.sh')
+ nagios_server_check( 'check_nodemanager_health.sh')
+ nagios_server_check( 'check_namenodes_ha.sh')
+ nagios_server_check( 'hdp_nagios_init.php')
+
+
+def nagios_server_configfile(
+ name,
+ owner = None,
+ group = None,
+ config_dir = None,
+ mode = None
+):
+ import params
+ owner = params.nagios_user if not owner else owner
+ group = params.user_group if not group else group
+ config_dir = params.nagios_obj_dir if not config_dir else config_dir
+
+ TemplateConfig( format("{config_dir}/{name}"),
+ owner = owner,
+ group = group,
+ mode = mode
+ )
+
+def nagios_server_check(name):
+ File( format("{plugins_dir}/{name}"),
+ content = StaticFile(name),
+ mode = 0755
+ )
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/nagios_service.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/nagios_service.py b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/nagios_service.py
new file mode 100644
index 0000000..cc411b5
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/nagios_service.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+"""
+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.
+
+Ambari Agent
+
+"""
+
+from resource_management import *
+
+def nagios_service(action='start'): # start or stop
+ import params
+
+ if action == 'start':
+ command = "service nagios start"
+ elif action == 'stop':
+ command = format("service nagios stop && rm -f {nagios_pid_file}")
+
+ Execute( command,
+ path = "/usr/local/bin/:/bin/:/sbin/"
+ )
+ MonitorWebserver("restart")
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/params.py
new file mode 100644
index 0000000..e915685
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/params.py
@@ -0,0 +1,168 @@
+#!/usr/bin/env python
+"""
+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.
+
+Ambari Agent
+
+"""
+
+from resource_management import *
+from functions import get_port_from_url
+import status_params
+
+# server configurations
+config = Script.get_config()
+
+conf_dir = "/etc/nagios"
+nagios_var_dir = "/var/nagios"
+nagios_rw_dir = "/var/nagios/rw"
+plugins_dir = "/usr/lib64/nagios/plugins"
+nagios_obj_dir = "/etc/nagios/objects"
+check_result_path = "/var/nagios/spool/checkresults"
+nagios_httpd_config_file = format("/etc/httpd/conf.d/nagios.conf")
+nagios_log_dir = "/var/log/nagios"
+nagios_log_archives_dir = format("{nagios_log_dir}/archives")
+nagios_host_cfg = format("{nagios_obj_dir}/hadoop-hosts.cfg")
+nagios_lookup_daemon_str = "/usr/sbin/nagios"
+nagios_pid_dir = status_params.nagios_pid_dir
+nagios_pid_file = status_params.nagios_pid_file
+nagios_resource_cfg = format("{conf_dir}/resource.cfg")
+nagios_hostgroup_cfg = format("{nagios_obj_dir}/hadoop-hostgroups.cfg")
+nagios_servicegroup_cfg = format("{nagios_obj_dir}/hadoop-servicegroups.cfg")
+nagios_service_cfg = format("{nagios_obj_dir}/hadoop-services.cfg")
+nagios_command_cfg = format("{nagios_obj_dir}/hadoop-commands.cfg")
+eventhandlers_dir = "/usr/lib/nagios/eventhandlers"
+nagios_principal_name = default("nagios_principal_name", "nagios")
+hadoop_ssl_enabled = False
+
+namenode_metadata_port = "8020"
+oozie_server_port = "11000"
+# different to HDP2
+namenode_port = get_port_from_url(config['configurations']['hdfs-site']['dfs.http.address'])
+# different to HDP2
+snamenode_port = get_port_from_url(config['configurations']['hdfs-site']["dfs.secondary.http.address"])
+
+hbase_master_rpc_port = "60000"
+rm_port = get_port_from_url(config['configurations']['yarn-site']['yarn.resourcemanager.webapp.address'])
+nm_port = "8042"
+hs_port = get_port_from_url(config['configurations']['mapred-site']['mapreduce.jobhistory.webapp.address'])
+journalnode_port = get_port_from_url(config['configurations']['hdfs-site']['dfs.journalnode.http-address'])
+datanode_port = config['configurations']['hdfs-site']['ambari.dfs.datanode.http.port']
+flume_port = "4159"
+hive_metastore_port = config['configurations']['global']['hive_metastore_port'] #"9083"
+templeton_port = config['configurations']['webhcat-site']['templeton.port'] #"50111"
+hbase_rs_port = "60030"
+
+# this 4 is different for HDP2
+jtnode_port = get_port_from_url(config['configurations']['mapred-site']['mapred.job.tracker.http.address'])
+jobhistory_port = get_port_from_url(config['configurations']['mapred-site']['mapreduce.history.server.http.address'])
+tasktracker_port = "50060"
+mapred_local_dir = config['configurations']['mapred-site']['mapred.local.dir']
+
+# this is different for HDP2
+nn_metrics_property = "FSNamesystemMetrics"
+clientPort = config['configurations']['global']['clientPort'] #ZK
+
+
+java64_home = config['configurations']['global']['java64_home']
+security_enabled = config['configurations']['global']['security_enabled']
+
+nagios_keytab_path = default("nagios_keytab_path", "/etc/security/keytabs/nagios.service.keytab")
+kinit_path_local = get_kinit_path([default("kinit_path_local",None), "/usr/bin", "/usr/kerberos/bin", "/usr/sbin"])
+
+dfs_ha_enabled = False
+dfs_ha_nameservices = default("/configurations/hdfs-site/dfs.nameservices", None)
+dfs_ha_namenode_ids = default(format("hdfs-site/dfs.ha.namenodes.{dfs_ha_nameservices}"), None)
+if dfs_ha_namenode_ids:
+ dfs_ha_namenode_ids_array_len = len(dfs_ha_namenode_ids.split(","))
+ if dfs_ha_namenode_ids_array_len > 1:
+ dfs_ha_enabled = True
+
+ganglia_port = "8651"
+ganglia_collector_slaves_port = "8660"
+ganglia_collector_namenode_port = "8661"
+ganglia_collector_jobtracker_port = "8662"
+ganglia_collector_hbase_port = "8663"
+ganglia_collector_rm_port = "8664"
+ganglia_collector_nm_port = "8660"
+ganglia_collector_hs_port = "8666"
+
+all_ping_ports = config['clusterHostInfo']['all_ping_ports']
+
+if System.get_instance().platform == "suse":
+ nagios_p1_pl = "/usr/lib/nagios/p1.pl"
+ htpasswd_cmd = "htpasswd2"
+else:
+ nagios_p1_pl = "/usr/bin/p1.pl"
+ htpasswd_cmd = "htpasswd"
+
+nagios_user = config['configurations']['global']['nagios_user']
+nagios_group = config['configurations']['global']['nagios_group']
+nagios_web_login = config['configurations']['global']['nagios_web_login']
+nagios_web_password = config['configurations']['global']['nagios_web_password']
+user_group = config['configurations']['global']['user_group']
+nagios_contact = config['configurations']['global']['nagios_contact']
+
+namenode_host = default("/clusterHostInfo/namenode_host", None)
+_snamenode_host = default("/clusterHostInfo/snamenode_host", None)
+_jtnode_host = default("/clusterHostInfo/jtnode_host", None)
+_slave_hosts = default("/clusterHostInfo/slave_hosts", None)
+_journalnode_hosts = default("/clusterHostInfo/journalnode_hosts", None)
+_zkfc_hosts = default("/clusterHostInfo/zkfc_hosts", None)
+_rm_host = default("/clusterHostInfo/rm_host", None)
+_nm_hosts = default("/clusterHostInfo/nm_hosts", None)
+_hs_host = default("/clusterHostInfo/hs_host", None)
+_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)
+_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)
+# can differ on HDP2
+_mapred_tt_hosts = _slave_hosts
+#if hbase_rs_hosts not given it is assumed that region servers on same nodes as slaves
+_hbase_rs_hosts = default("/clusterHostInfo/hbase_rs_hosts", _slave_hosts)
+_hue_server_host = default("/clusterHostInfo/hue_server_host", None)
+all_hosts = config['clusterHostInfo']['all_hosts']
+
+
+hostgroup_defs = {
+ 'namenode' : namenode_host,
+ 'snamenode' : _snamenode_host,
+ 'slaves' : _slave_hosts,
+ # no in HDP2
+ 'tasktracker-servers' : _mapred_tt_hosts,
+ 'agent-servers' : all_hosts,
+ 'nagios-server' : _nagios_server_host,
+ 'jobtracker' : _jtnode_host,
+ 'ganglia-server' : _ganglia_server_host,
+ 'flume-servers' : _flume_hosts,
+ 'zookeeper-servers' : _zookeeper_hosts,
+ 'hbasemasters' : hbase_master_hosts,
+ 'hiveserver' : _hive_server_host,
+ 'region-servers' : _hbase_rs_hosts,
+ 'oozie-server' : _oozie_server,
+ 'webhcat-server' : _webhcat_server_host,
+ 'hue-server' : _hue_server_host,
+ 'resourcemanager' : _rm_host,
+ 'nodemanagers' : _nm_hosts,
+ 'historyserver2' : _hs_host,
+ 'journalnodes' : _journalnode_hosts
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/status_params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/status_params.py b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/status_params.py
new file mode 100644
index 0000000..33b35fe
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/scripts/status_params.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+"""
+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.
+
+"""
+
+from resource_management import *
+
+config = Script.get_config()
+
+nagios_pid_dir = "/var/run/nagios"
+nagios_pid_file = format("{nagios_pid_dir}/nagios.pid")
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/contacts.cfg.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/contacts.cfg.j2 b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/contacts.cfg.j2
new file mode 100644
index 0000000..9dada51
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/contacts.cfg.j2
@@ -0,0 +1,91 @@
+###############################################################################
+# CONTACTS.CFG - SAMPLE CONTACT/CONTACTGROUP DEFINITIONS
+#
+# Last Modified: 05-31-2007
+#
+# NOTES: This config file provides you with some example contact and contact
+# group definitions that you can reference in host and service
+# definitions.
+#
+# You don't need to keep these definitions in a separate file from your
+# other object definitions. This has been done just to make things
+# easier to understand.
+#
+###############################################################################
+
+#
+#
+# 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.
+#
+#
+#
+
+
+###############################################################################
+###############################################################################
+#
+# CONTACTS
+#
+###############################################################################
+###############################################################################
+
+# Just one contact defined by default - the Nagios admin (that's you)
+# This contact definition inherits a lot of default values from the 'generic-contact'
+# template which is defined elsewhere.
+
+define contact{
+ contact_name {{nagios_web_login}} ; Short name of user
+ use generic-contact ; Inherit default values from generic-contact template (defined above)
+ alias Nagios Admin ; Full name of user
+
+ email {{nagios_contact}} ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
+ }
+
+# Contact which writes all Nagios alerts to the system logger.
+define contact{
+ contact_name sys_logger ; Short name of user
+ use generic-contact ; Inherit default values from generic-contact template (defined above)
+ alias System Logger ; Full name of user
+ host_notifications_enabled 1
+ service_notifications_enabled 1
+ service_notification_period 24x7
+ host_notification_period 24x7
+ service_notification_options w,u,c,r,s
+ host_notification_options d,u,r,s
+ can_submit_commands 1
+ retain_status_information 1
+ service_notification_commands service_sys_logger
+ host_notification_commands host_sys_logger
+ }
+
+###############################################################################
+###############################################################################
+#
+# CONTACT GROUPS
+#
+###############################################################################
+###############################################################################
+
+# We only have one contact in this simple configuration file, so there is
+# no need to create more than one contact group.
+
+define contactgroup {
+ contactgroup_name admins
+ alias Nagios Administrators
+ members {{nagios_web_login}},sys_logger
+}
[2/3] AMBARI-4153. Nagios on HDP1. Using resource management lib
(aonishuk)
Posted by ao...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/hadoop-commands.cfg.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/hadoop-commands.cfg.j2 b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/hadoop-commands.cfg.j2
new file mode 100644
index 0000000..e47a09e
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/hadoop-commands.cfg.j2
@@ -0,0 +1,114 @@
+#
+#
+# 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.
+#
+#
+#
+
+{% if env.system.platform != "suse" %}
+# 'check_cpu' check remote cpu load
+define command {
+ command_name check_cpu
+ command_line $USER1$/check_cpu.pl -H $HOSTADDRESS$ -C hadoop -w $ARG1$ -c $ARG2$
+ }
+{% endif %}
+
+# Check data node storage full
+define command {
+ command_name check_datanode_storage
+ command_line php $USER1$/check_datanode_storage.php -h $HOSTADDRESS$ -p $ARG1$ -w $ARG2$ -c $ARG3$ -e $ARG4$ -k $ARG5$ -r $ARG6$ -t $ARG7$ -s $ARG8$
+ }
+
+define command{
+ command_name check_hdfs_blocks
+ command_line php $USER1$/check_hdfs_blocks.php -h $ARG1$ -p $ARG2$ -w $ARG3$ -c $ARG4$ -s $ARG5$ -e $ARG6$ -k $ARG7$ -r $ARG8$ -t $ARG9$ -u $ARG10$
+ }
+
+define command{
+ command_name check_hdfs_capacity
+ command_line php $USER1$/check_hdfs_capacity.php -h $ARG1$ -p $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$ -k $ARG6$ -r $ARG7$ -t $ARG8$ -s $ARG9$
+ }
+
+define command{
+ command_name check_aggregate
+ command_line php $USER1$/check_aggregate.php -f /var/nagios/status.dat -s 1 -t service -n $ARG1$ -w $ARG2$ -c $ARG3$
+ }
+
+define command{
+ command_name check_rpcq_latency
+ command_line php $USER1$/check_rpcq_latency.php -h $HOSTADDRESS$ -p $ARG2$ -n $ARG1$ -w $ARG3$ -c $ARG4$ -e $ARG5$ -k $ARG6$ -r $ARG7$ -t $ARG8$ -s $ARG9$
+ }
+
+define command{
+ command_name check_nagios
+ command_line $USER1$/check_nagios -e $ARG1$ -F $ARG2$ -C $ARG3$
+ }
+
+define command{
+ command_name check_webui
+ command_line $USER1$/check_webui.sh $ARG1$ $HOSTADDRESS$ $ARG2$
+ }
+
+define command{
+ command_name check_name_dir_status
+ command_line php $USER1$/check_name_dir_status.php -h $HOSTADDRESS$ -p $ARG1$ -e $ARG2$ -k $ARG3$ -r $ARG4$ -t $ARG5$ -s $ARG6$
+ }
+
+define command{
+ command_name check_oozie_status
+ command_line $USER1$/check_oozie_status.sh $HOSTADDRESS$ $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$ $ARG7$
+ }
+
+define command{
+ command_name check_templeton_status
+ command_line $USER1$/check_templeton_status.sh $HOSTADDRESS$ $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$ $ARG7$
+ }
+
+define command{
+ command_name check_hive_metastore_status
+ command_line $USER1$/check_hive_metastore_status.sh $HOSTADDRESS$ $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$ $ARG7$
+ }
+define command{
+ command_name check_hue_status
+ command_line $USER1$/check_hue_status.sh
+ }
+
+define command{
+ command_name check_mapred_local_dir_used_space
+ command_line $USER1$/check_mapred_local_dir_used.sh $ARG1$ $ARG2$
+ }
+
+define command{
+ command_name check_namenodes_ha
+ command_line $USER1$/check_namenodes_ha.sh $ARG1$ $ARG2$
+ }
+
+define command{
+ command_name check_nodemanager_health
+ command_line $USER1$/check_nodemanager_health.sh $HOSTADDRESS$ $ARG1$
+ }
+
+define command{
+ command_name host_sys_logger
+ command_line $USER1$/sys_logger.py $HOSTSTATETYPE$ $HOSTATTEMPT$ $HOSTSTATE$ "Host::Ping" "Event Host=$HOSTADDRESS$($HOSTSTATE$), $HOSTOUTPUT$ $LONGHOSTOUTPUT$"
+ }
+
+define command{
+ command_name service_sys_logger
+ command_line $USER1$/sys_logger.py $SERVICESTATETYPE$ $SERVICEATTEMPT$ $SERVICESTATE$ "$SERVICEDESC$" "Event Host=$HOSTADDRESS$ Service Description=$SERVICEDESC$($SERVICESTATE$), $SERVICEOUTPUT$ $LONGSERVICEOUTPUT$"
+ }
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/hadoop-hostgroups.cfg.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/hadoop-hostgroups.cfg.j2 b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/hadoop-hostgroups.cfg.j2
new file mode 100644
index 0000000..2bcbf7c
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/hadoop-hostgroups.cfg.j2
@@ -0,0 +1,15 @@
+{% for name, hosts in hostgroup_defs.iteritems() %}
+{% if hosts %}
+define hostgroup {
+ hostgroup_name {{name}}
+ alias {{name}}
+ members {{','.join(hosts)}}
+}
+{% endif %}
+{% endfor %}
+
+define hostgroup {
+ hostgroup_name all-servers
+ alias All Servers
+ members {{','.join(all_hosts)}}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/hadoop-hosts.cfg.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/hadoop-hosts.cfg.j2 b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/hadoop-hosts.cfg.j2
new file mode 100644
index 0000000..62555d4
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/hadoop-hosts.cfg.j2
@@ -0,0 +1,16 @@
+{% for host in all_hosts %}
+define host {
+ alias {{host}}
+ host_name {{host}}
+ use linux-server
+ address {{host}}
+ check_interval 0.25
+ retry_interval 0.25
+ max_check_attempts 4
+ notifications_enabled 1
+ first_notification_delay 0 # Send notification soon after change in the hard state
+ notification_interval 0 # Send the notification once
+ notification_options d,u,r
+}
+
+{% endfor %}
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/hadoop-servicegroups.cfg.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/hadoop-servicegroups.cfg.j2 b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/hadoop-servicegroups.cfg.j2
new file mode 100644
index 0000000..0101ce6
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/hadoop-servicegroups.cfg.j2
@@ -0,0 +1,80 @@
+{% if hostgroup_defs['namenode'] or
+ hostgroup_defs['snamenode'] or
+ hostgroup_defs['slaves'] %}
+define servicegroup {
+ servicegroup_name HDFS
+ alias HDFS Checks
+}
+{% endif %}
+{%if hostgroup_defs['jobtracker'] or
+ hostgroup_defs['historyserver2']-%}
+define servicegroup {
+ servicegroup_name MAPREDUCE
+ alias MAPREDUCE Checks
+}
+{% endif %}
+{%if hostgroup_defs['resourcemanager'] or
+ hostgroup_defs['nodemanagers'] %}
+define servicegroup {
+ servicegroup_name YARN
+ alias YARN Checks
+}
+{% endif %}
+{%if hostgroup_defs['flume-servers'] %}
+define servicegroup {
+ servicegroup_name FLUME
+ alias FLUME Checks
+}
+{% endif %}
+{%if hostgroup_defs['hbasemasters'] %}
+define servicegroup {
+ servicegroup_name HBASE
+ alias HBASE Checks
+}
+{% endif %}
+{% if hostgroup_defs['oozie-server'] %}
+define servicegroup {
+ servicegroup_name OOZIE
+ alias OOZIE Checks
+}
+{% endif %}
+{% if hostgroup_defs['webhcat-server'] %}
+define servicegroup {
+ servicegroup_name WEBHCAT
+ alias WEBHCAT Checks
+}
+{% endif %}
+{% if hostgroup_defs['nagios-server'] %}
+define servicegroup {
+ servicegroup_name NAGIOS
+ alias NAGIOS Checks
+}
+{% endif %}
+{% if hostgroup_defs['ganglia-server'] %}
+define servicegroup {
+ servicegroup_name GANGLIA
+ alias GANGLIA Checks
+}
+{% endif %}
+{% if hostgroup_defs['hiveserver'] %}
+define servicegroup {
+ servicegroup_name HIVE-METASTORE
+ alias HIVE-METASTORE Checks
+}
+{% endif %}
+{% if hostgroup_defs['zookeeper-servers'] %}
+define servicegroup {
+ servicegroup_name ZOOKEEPER
+ alias ZOOKEEPER Checks
+}
+{% endif %}
+define servicegroup {
+ servicegroup_name AMBARI
+ alias AMBARI Checks
+}
+{% if hostgroup_defs['hue-server'] %}
+define servicegroup {
+ servicegroup_name HUE
+ alias HUE Checks
+}
+{% endif %}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/hadoop-services.cfg.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/hadoop-services.cfg.j2 b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/hadoop-services.cfg.j2
new file mode 100644
index 0000000..331eac3
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/hadoop-services.cfg.j2
@@ -0,0 +1,737 @@
+#
+#
+# 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.
+#
+#
+
+{# TODO: Look for { or } in created file #}
+# NAGIOS SERVER Check (status log update)
+{% if hostgroup_defs['nagios-server'] %}
+define service {
+ name hadoop-service
+ use generic-service
+ notification_options w,u,c,r,f,s
+ first_notification_delay 0
+ notification_interval 0 # Send the notification once
+ contact_groups admins
+ notifications_enabled 1
+ event_handler_enabled 1
+ register 0
+}
+
+define service {
+ hostgroup_name nagios-server
+ use hadoop-service
+ service_description NAGIOS::Nagios status log freshness
+ servicegroups NAGIOS
+ check_command check_nagios!10!/var/nagios/status.dat!{{nagios_lookup_daemon_str}}
+ normal_check_interval 5
+ retry_check_interval 0.5
+ max_check_attempts 2
+}
+
+# NAGIOS SERVER HDFS Checks
+define service {
+ hostgroup_name nagios-server
+ use hadoop-service
+ service_description HDFS::Percent DataNodes with space available
+ servicegroups HDFS
+ check_command check_aggregate!"DATANODE::DataNode space"!10%!30%
+ normal_check_interval 2
+ retry_check_interval 1
+ max_check_attempts 1
+}
+
+define service {
+ hostgroup_name nagios-server
+ use hadoop-service
+ service_description HDFS::Percent DataNodes live
+ servicegroups HDFS
+ check_command check_aggregate!"DATANODE::DataNode process"!10%!30%
+ normal_check_interval 0.5
+ retry_check_interval 0.25
+ max_check_attempts 3
+}
+
+# AMBARI AGENT Checks
+{% for hostname in all_hosts %}
+define service {
+ host_name {{ hostname }}
+ use hadoop-service
+ service_description AMBARI::Ambari Agent process
+ servicegroups AMBARI
+ check_command check_tcp!{{all_ping_ports[loop.index-1]}}!-w 1 -c 1
+ normal_check_interval 1
+ retry_check_interval 0.25
+ max_check_attempts 4
+}
+
+{% endfor %}
+
+# NAGIOS SERVER ZOOKEEPER Checks
+{% if hostgroup_defs['zookeeper-servers'] %}
+define service {
+ hostgroup_name nagios-server
+ use hadoop-service
+ service_description ZOOKEEPER::Percent ZooKeeper Servers live
+ servicegroups ZOOKEEPER
+ check_command check_aggregate!"ZOOKEEPER::ZooKeeper Server process"!35%!70%
+ normal_check_interval 0.5
+ retry_check_interval 0.25
+ max_check_attempts 3
+}
+{% endif %}
+
+# NAGIOS SERVER HBASE Checks
+{% if hostgroup_defs['hbasemasters'] %}
+define service {
+ hostgroup_name nagios-server
+ use hadoop-service
+ service_description HBASE::Percent RegionServers live
+ servicegroups HBASE
+ check_command check_aggregate!"REGIONSERVER::RegionServer process"!10%!30%
+ normal_check_interval 0.5
+ retry_check_interval 0.25
+ max_check_attempts 3
+}
+{% endif %}
+{% endif %}
+
+
+
+# GANGLIA SERVER Checks
+{% if hostgroup_defs['ganglia-server'] %}
+define service {
+ hostgroup_name ganglia-server
+ use hadoop-service
+ service_description GANGLIA::Ganglia Server process
+ servicegroups GANGLIA
+ check_command check_tcp!{{ ganglia_port }}!-w 1 -c 1
+ normal_check_interval 0.25
+ retry_check_interval 0.25
+ max_check_attempts 4
+}
+
+define service {
+ hostgroup_name ganglia-server
+ use hadoop-service
+ service_description GANGLIA::Ganglia Monitor process for Slaves
+ servicegroups GANGLIA
+ check_command check_tcp!{{ ganglia_collector_slaves_port }}!-w 1 -c 1
+ normal_check_interval 0.25
+ retry_check_interval 0.25
+ max_check_attempts 4
+}
+
+define service {
+ hostgroup_name ganglia-server
+ use hadoop-service
+ service_description GANGLIA::Ganglia Monitor process for NameNode
+ servicegroups GANGLIA
+ check_command check_tcp!{{ ganglia_collector_namenode_port }}!-w 1 -c 1
+ normal_check_interval 0.25
+ retry_check_interval 0.25
+ max_check_attempts 4
+}
+
+{% if hostgroup_defs['jobtracker'] %}
+define service {
+ hostgroup_name ganglia-server
+ use hadoop-service
+ service_description GANGLIA::Ganglia Monitor process for JobTracker
+ servicegroups GANGLIA
+ check_command check_tcp!{{ ganglia_collector_jobtracker_port }}!-w 1 -c 1
+ normal_check_interval 0.25
+ retry_check_interval 0.25
+ max_check_attempts 4
+}
+{% endif %}
+
+{% if hostgroup_defs['hbasemasters'] %}
+define service {
+ hostgroup_name ganglia-server
+ use hadoop-service
+ service_description GANGLIA::Ganglia Monitor process for HBase Master
+ servicegroups GANGLIA
+ check_command check_tcp!{{ ganglia_collector_hbase_port }}!-w 1 -c 1
+ normal_check_interval 0.25
+ retry_check_interval 0.25
+ max_check_attempts 4
+}
+{% endif %}
+
+{% if hostgroup_defs['resourcemanager'] %}
+define service {
+ hostgroup_name ganglia-server
+ use hadoop-service
+ service_description GANGLIA::Ganglia Monitor process for ResourceManager
+ servicegroups GANGLIA
+ check_command check_tcp!{{ ganglia_collector_rm_port }}!-w 1 -c 1
+ normal_check_interval 0.25
+ retry_check_interval 0.25
+ max_check_attempts 4
+}
+{% endif %}
+
+{% if hostgroup_defs['historyserver2'] %}
+define service {
+ hostgroup_name ganglia-server
+ use hadoop-service
+ service_description GANGLIA::Ganglia Monitor process for HistoryServer
+ servicegroups GANGLIA
+ check_command check_tcp!{{ ganglia_collector_hs_port }}!-w 1 -c 1
+ normal_check_interval 0.25
+ retry_check_interval 0.25
+ max_check_attempts 4
+}
+{% endif %}
+
+{% endif %}
+
+{% if hostgroup_defs['snamenode'] %}
+# Secondary namenode checks
+define service {
+ hostgroup_name snamenode
+ use hadoop-service
+ service_description NAMENODE::Secondary NameNode process
+ servicegroups HDFS
+ check_command check_tcp!{{ snamenode_port }}!-w 1 -c 1
+ normal_check_interval 0.5
+ retry_check_interval 0.25
+ max_check_attempts 3
+}
+{% endif %}
+
+
+{% if hostgroup_defs['namenode'] %}
+# HDFS Checks
+{% for namenode_hostname in namenode_host %}
+{# TODO: check if we can get rid of str, lower #}
+define service {
+ host_name {{ namenode_hostname }}
+ use hadoop-service
+ service_description NAMENODE::NameNode edit logs directory status on {{ namenode_hostname }}
+ servicegroups HDFS
+ check_command check_name_dir_status!{{ namenode_port }}!{{ str(hadoop_ssl_enabled).lower() }}!{{ nagios_keytab_path }}!{{ nagios_principal_name }}!{{ kinit_path_local }}!{{ str(security_enabled).lower() }}
+ normal_check_interval 0.5
+ retry_check_interval 0.5
+ max_check_attempts 3
+}
+
+{% if env.system.platform != "suse" %}
+define service {
+ host_name {{ namenode_hostname }}
+ use hadoop-service
+ service_description NAMENODE::NameNode host CPU utilization on {{ namenode_hostname }}
+ servicegroups HDFS
+ check_command check_cpu!200%!250%
+ normal_check_interval 5
+ retry_check_interval 2
+ max_check_attempts 5
+}
+{% endif %}
+
+define service {
+ host_name {{ namenode_hostname }}
+ use hadoop-service
+ service_description NAMENODE::NameNode Web UI on {{ namenode_hostname }}
+ servicegroups HDFS
+ check_command check_webui!namenode!{{ namenode_port }}
+ normal_check_interval 1
+ retry_check_interval 1
+ max_check_attempts 3
+}
+
+define service {
+ host_name {{ namenode_hostname }}
+ use hadoop-service
+ service_description NAMENODE::NameNode process on {{ namenode_hostname }}
+ servicegroups HDFS
+ check_command check_tcp!{{ namenode_metadata_port }}!-w 1 -c 1
+ normal_check_interval 0.5
+ retry_check_interval 0.25
+ max_check_attempts 3
+}
+
+define service {
+ host_name {{ namenode_hostname }}
+ use hadoop-service
+ service_description HDFS::NameNode RPC latency on {{ namenode_hostname }}
+ servicegroups HDFS
+ check_command check_rpcq_latency!NameNode!{{ namenode_port }}!3000!5000!{{ 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 1
+ max_check_attempts 5
+}
+
+{% endfor %}
+
+define service {
+ hostgroup_name nagios-server
+ use hadoop-service
+ service_description HDFS::Blocks health
+ servicegroups HDFS
+ check_command check_hdfs_blocks!$HOSTGROUPMEMBERS:namenode$!{{ namenode_port }}!0%!0%!{{ nn_metrics_property }}!{{ str(hadoop_ssl_enabled).lower() }}!{{ nagios_keytab_path }}!{{ nagios_principal_name }}!{{ kinit_path_local }}!{{ str(security_enabled).lower() }}
+ normal_check_interval 2
+ retry_check_interval 1
+ max_check_attempts 1
+}
+
+define service {
+ hostgroup_name nagios-server
+ use hadoop-service
+ service_description HDFS::HDFS capacity utilization
+ servicegroups HDFS
+ check_command check_hdfs_capacity!$HOSTGROUPMEMBERS:namenode$!{{ namenode_port }}!80%!90%!{{ str(hadoop_ssl_enabled).lower() }}!{{ nagios_keytab_path }}!{{ nagios_principal_name }}!{{ kinit_path_local }}!{{ str(security_enabled).lower() }}
+ normal_check_interval 10
+ retry_check_interval 1
+ max_check_attempts 1
+}
+
+{% endif %}
+
+# MAPREDUCE Checks
+{% if hostgroup_defs['jobtracker'] %}
+define service {
+ hostgroup_name jobtracker
+ use hadoop-service
+ service_description JOBTRACKER::JobTracker Web UI
+ servicegroups MAPREDUCE
+ check_command check_webui!jobtracker!{{ jtnode_port }}
+ normal_check_interval 1
+ retry_check_interval 1
+ max_check_attempts 3
+}
+
+define service {
+ hostgroup_name jobtracker
+ use hadoop-service
+ service_description JOBTRACKER::HistoryServer Web UI
+ servicegroups MAPREDUCE
+ check_command check_webui!jobhistory!{{ jobhistory_port }}
+ normal_check_interval 1
+ retry_check_interval 1
+ max_check_attempts 3
+}
+{% if env.system.platform != "suse" %}
+define service {
+ hostgroup_name jobtracker
+ use hadoop-service
+ service_description JOBTRACKER::JobTracker CPU utilization
+ servicegroups MAPREDUCE
+ check_command check_cpu!200%!250%
+ normal_check_interval 5
+ retry_check_interval 2
+ max_check_attempts 5
+}
+{% endif %}
+
+define service {
+ hostgroup_name jobtracker
+ use hadoop-service
+ use hadoop-service
+ service_description JOBTRACKER::JobTracker process
+ servicegroups MAPREDUCE
+ check_command check_tcp!{{ jtnode_port }}!-w 1 -c 1
+ normal_check_interval 0.5
+ retry_check_interval 0.25
+ max_check_attempts 4
+}
+
+define service {
+ hostgroup_name jobtracker
+ use hadoop-service
+ service_description MAPREDUCE::JobTracker RPC latency
+ servicegroups MAPREDUCE
+ check_command check_rpcq_latency!JobTracker!{{ jtnode_port }}!3000!5000!{{ 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 1
+ max_check_attempts 5
+}
+
+{% endif %}
+
+{% if hostgroup_defs['tasktracker-servers'] %}
+define service {
+ hostgroup_name nagios-server
+ use hadoop-service
+ service_description MAPREDUCE::Percent TaskTrackers live
+ servicegroups MAPREDUCE
+ check_command check_aggregate!"TASKTRACKER::TaskTracker process"!10%!30%
+ normal_check_interval 0.5
+ retry_check_interval 0.25
+ max_check_attempts 3
+}
+
+# MAPREDUCE::TASKTRACKER Checks
+define service {
+ hostgroup_name tasktracker-servers
+ use hadoop-service
+ service_description TASKTRACKER::TaskTracker process
+ servicegroups MAPREDUCE
+ check_command check_tcp!{{ tasktracker_port }}!-w 1 -c 1
+ normal_check_interval 1
+ retry_check_interval 0.5
+ max_check_attempts 3
+}
+
+# MAPREDUCE::TASKTRACKER Mapreduce local dir used space
+define service {
+ hostgroup_name tasktracker-servers
+ use hadoop-service
+ service_description ::MapReduce local dir space
+ servicegroups MAPREDUCE
+ check_command check_mapred_local_dir_used_space!{{ mapred_local_dir }}!85%
+ normal_check_interval 0.5
+ retry_check_interval 0.25
+ max_check_attempts 3
+}
+
+{% endif %}
+
+{% if hostgroup_defs['resourcemanager'] %}
+# YARN::RESOURCEMANAGER Checks
+define service {
+ hostgroup_name resourcemanager
+ use hadoop-service
+ service_description RESOURCEMANAGER::ResourceManager Web UI
+ servicegroups YARN
+ check_command check_webui!resourcemanager!{{ rm_port }}
+ normal_check_interval 1
+ retry_check_interval 1
+ max_check_attempts 3
+}
+
+{% if env.system.platform != "suse" %}
+define service {
+ hostgroup_name resourcemanager
+ use hadoop-service
+ service_description RESOURCEMANAGER::ResourceManager CPU utilization
+ servicegroups YARN
+ check_command check_cpu!200%!250%
+ normal_check_interval 5
+ retry_check_interval 2
+ max_check_attempts 5
+}
+{% endif %}
+
+define service {
+ hostgroup_name resourcemanager
+ use hadoop-service
+ service_description RESOURCEMANAGER::ResourceManager RPC latency
+ servicegroups YARN
+ check_command check_rpcq_latency!ResourceManager!{{ rm_port }}!3000!5000!{{ 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 1
+ max_check_attempts 5
+}
+
+define service {
+ hostgroup_name resourcemanager
+ use hadoop-service
+ service_description RESOURCEMANAGER::ResourceManager process
+ servicegroups YARN
+ check_command check_tcp!{{ rm_port }}!-w 1 -c 1
+ normal_check_interval 1
+ retry_check_interval 0.5
+ max_check_attempts 3
+}
+{% endif %}
+
+{% if hostgroup_defs['nodemanagers'] %}
+# YARN::NODEMANAGER Checks
+define service {
+ hostgroup_name nodemanagers
+ use hadoop-service
+ service_description NODEMANAGER::NodeManager process
+ servicegroups YARN
+ check_command check_tcp!{{ nm_port }}!-w 1 -c 1
+ normal_check_interval 1
+ retry_check_interval 0.5
+ max_check_attempts 3
+}
+
+define service {
+ hostgroup_name nodemanagers
+ use hadoop-service
+ service_description NODEMANAGER::NodeManager health
+ servicegroups YARN
+ check_command check_nodemanager_health!{{ nm_port }}!{{ str(security_enabled).lower() }}!{{ str(hadoop_ssl_enabled).lower() }}!{{ nagios_keytab_path }}!{{ nagios_principal_name }}!{{ kinit_path_local }}
+ normal_check_interval 1
+ retry_check_interval 1
+ max_check_attempts 3
+}
+define service {
+ hostgroup_name nagios-server
+ use hadoop-service
+ service_description NODEMANAGER::Percent NodeManagers live
+ servicegroups YARN
+ check_command check_aggregate!"NODEMANAGER::NodeManager process"!10%!30%
+ normal_check_interval 0.5
+ retry_check_interval 0.25
+ max_check_attempts 3
+}
+{% endif %}
+
+{% if hostgroup_defs['historyserver2'] %}
+# MAPREDUCE::JOBHISTORY Checks
+define service {
+ hostgroup_name historyserver2
+ use hadoop-service
+ service_description JOBHISTORY::HistoryServer Web UI
+ servicegroups MAPREDUCE
+ check_command check_webui!historyserver2!{{ hs_port }}
+ normal_check_interval 1
+ retry_check_interval 1
+ max_check_attempts 3
+}
+
+{% if env.system.platform != "suse" %}
+define service {
+ hostgroup_name historyserver2
+ use hadoop-service
+ service_description JOBHISTORY::HistoryServer CPU utilization
+ servicegroups MAPREDUCE
+ check_command check_cpu!200%!250%
+ normal_check_interval 5
+ retry_check_interval 2
+ max_check_attempts 5
+}
+{% endif %}
+
+define service {
+ hostgroup_name historyserver2
+ use hadoop-service
+ service_description JOBHISTORY::HistoryServer RPC latency
+ servicegroups MAPREDUCE
+ check_command check_rpcq_latency!JobHistoryServer!{{ hs_port }}!3000!5000!{{ 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 1
+ max_check_attempts 5
+}
+
+define service {
+ hostgroup_name historyserver2
+ use hadoop-service
+ service_description JOBHISTORY::HistoryServer process
+ servicegroups MAPREDUCE
+ check_command check_tcp!{{ hs_port }}!-w 1 -c 1
+ normal_check_interval 1
+ retry_check_interval 0.5
+ max_check_attempts 3
+}
+
+{% endif %}
+
+{% if hostgroup_defs['journalnodes'] %}
+# Journalnode checks
+define service {
+ hostgroup_name journalnodes
+ use hadoop-service
+ service_description JOURNALNODE::JournalNode process
+ servicegroups HDFS
+ check_command check_tcp!{{ journalnode_port }}!-w 1 -c 1
+ normal_check_interval 1
+ retry_check_interval 0.5
+ max_check_attempts 3
+}
+
+{% if dfs_ha_enabled %}
+define service {
+ hostgroup_name nagios-server
+ use hadoop-service
+ service_description HDFS::Percent JournalNodes live
+ servicegroups HDFS
+ check_command check_aggregate!"JOURNALNODE::JournalNode process"!33%!50%
+ normal_check_interval 0.5
+ retry_check_interval 0.25
+ max_check_attempts 3
+}
+{% endif %}
+{% endif %}
+
+{% if hostgroup_defs['slaves'] %}
+# HDFS::DATANODE Checks
+define service {
+ hostgroup_name slaves
+ use hadoop-service
+ service_description DATANODE::DataNode process
+ servicegroups HDFS
+ check_command check_tcp!{{datanode_port}}!-w 1 -c 1
+ normal_check_interval 1
+ retry_check_interval 0.5
+ max_check_attempts 3
+}
+
+define service {
+ hostgroup_name slaves
+ use hadoop-service
+ service_description DATANODE::DataNode space
+ servicegroups HDFS
+ check_command check_datanode_storage!{{ datanode_port }}!90%!90%!{{ 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 1
+ max_check_attempts 2
+}
+
+{% endif %}
+
+{% if hostgroup_defs['flume-servers'] %}
+# FLUME Checks
+define service {
+ hostgroup_name flume-servers
+ use hadoop-service
+ service_description FLUME::Flume Agent process
+ servicegroups FLUME
+ check_command check_tcp!{{ flume_port }}!-w 1 -c 1
+ normal_check_interval 1
+ retry_check_interval 0.5
+ max_check_attempts 3
+}
+{% endif %}
+
+
+{% if hostgroup_defs['zookeeper-servers'] %}
+# ZOOKEEPER Checks
+define service {
+ hostgroup_name zookeeper-servers
+ use hadoop-service
+ service_description ZOOKEEPER::ZooKeeper Server process
+ servicegroups ZOOKEEPER
+ check_command check_tcp!{{ clientPort }}!-w 1 -c 1
+ normal_check_interval 1
+ retry_check_interval 0.5
+ max_check_attempts 3
+}
+{% endif %}
+
+{% if hostgroup_defs['hbasemasters'] %}
+# HBASE::REGIONSERVER Checks
+define service {
+ hostgroup_name region-servers
+ use hadoop-service
+ service_description REGIONSERVER::RegionServer process
+ servicegroups HBASE
+ check_command check_tcp!{{ hbase_rs_port }}!-w 1 -c 1
+ normal_check_interval 1
+ retry_check_interval 0.5
+ max_check_attempts 3
+}
+
+{# HBASE:: MASTER Checks
+# define service {
+# hostgroup_name hbasemasters
+# use hadoop-service
+# service_description HBASEMASTER::HBase Master Web UI
+# servicegroups HBASE
+# check_command check_webui!hbase!{{ hbase_master_port }}
+# normal_check_interval 1
+# retry_check_interval 1
+# max_check_attempts 3
+# #}
+{% for hbasemaster in hbase_master_hosts %}
+{% if env.system.platform != "suse" %}
+define service {
+ host_name {{ hbasemaster }}
+ use hadoop-service
+ service_description HBASEMASTER::HBase Master CPU utilization on {{ hbasemaster }}
+ servicegroups HBASE
+ check_command check_cpu!200%!250%
+ normal_check_interval 5
+ retry_check_interval 2
+ max_check_attempts 5
+}
+{% endif %}
+define service {
+ host_name {{ hbasemaster }}
+ use hadoop-service
+ service_description HBASEMASTER::HBase Master process on {{ hbasemaster }}
+ servicegroups HBASE
+ check_command check_tcp!{{ hbase_master_rpc_port }}!-w 1 -c 1
+ normal_check_interval 0.5
+ retry_check_interval 0.25
+ max_check_attempts 4
+}
+{% endfor %}
+{% endif %}
+
+{% if hostgroup_defs['hiveserver'] %}
+# HIVE Metastore check
+define service {
+ hostgroup_name hiveserver
+ use hadoop-service
+ service_description HIVE-METASTORE::Hive Metastore status
+ servicegroups HIVE-METASTORE
+ {% if security_enabled %}
+ check_command check_hive_metastore_status!{{ hive_metastore_port }}!{{ java64_home }}!true!{{ nagios_keytab_path }}!{{ nagios_principal_name }}!{{ kinit_path_local }}
+ {% else %}
+ check_command check_hive_metastore_status!{{ hive_metastore_port }}!{{ java64_home }}!false
+ {% endif %}
+ normal_check_interval 0.5
+ retry_check_interval 0.5
+ max_check_attempts 3
+}
+{% endif %}
+{% if hostgroup_defs['oozie-server'] %}
+# Oozie check
+define service {
+ hostgroup_name oozie-server
+ use hadoop-service
+ service_description OOZIE::Oozie Server status
+ servicegroups OOZIE
+ {% if security_enabled %}
+ check_command check_oozie_status!{{ oozie_server_port }}!{{ java64_home }}!true!{{ nagios_keytab_path }}!{{ nagios_principal_name }}!{{ kinit_path_local }}
+ {% else %}
+ check_command check_oozie_status!{{ oozie_server_port }}!{{ java64_home }}!false
+ {% endif %}
+ normal_check_interval 1
+ retry_check_interval 1
+ max_check_attempts 3
+}
+{% endif %}
+{% if hostgroup_defs['webhcat-server'] %}
+# WEBHCAT check
+define service {
+ hostgroup_name webhcat-server
+ use hadoop-service
+ service_description WEBHCAT::WebHCat Server status
+ servicegroups WEBHCAT
+ {% if security_enabled %}
+ check_command check_templeton_status!{{ templeton_port }}!v1!{{ str(security_enabled).lower() }}!{{ nagios_keytab_path }}!{{ nagios_principal_name }}!{{ kinit_path_local }}
+ {% else %}
+ check_command check_templeton_status!{{ templeton_port }}!v1!false
+ {% endif %}
+ normal_check_interval 1
+ retry_check_interval 0.5
+ max_check_attempts 3
+}
+{% endif %}
+
+{% if hostgroup_defs['hue-server'] %}
+define service {
+ hostgroup_name hue-server
+ use hadoop-service
+ service_description HUE::Hue Server status
+ servicegroups HUE
+ check_command check_hue_status
+ normal_check_interval 100
+ retry_check_interval 0.5
+ max_check_attempts 3
+}
+{% endif %}
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/nagios.cfg.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/nagios.cfg.j2 b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/nagios.cfg.j2
new file mode 100644
index 0000000..acb2522
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/nagios.cfg.j2
@@ -0,0 +1,1349 @@
+##############################################################################
+#
+# NAGIOS.CFG - Sample Main Config File for Nagios 3.2.3
+#
+# Read the documentation for more information on this configuration
+# file. I've provided some comments here, but things may not be so
+# clear without further explanation.
+#
+# Last Modified: 12-14-2008
+#
+##############################################################################
+
+#
+#
+# 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.
+#
+#
+
+# LOG FILE
+# This is the main log file where service and host events are logged
+# for historical purposes. This should be the first option specified
+# in the config file!!!
+
+log_file=/var/log/nagios/nagios.log
+
+
+
+# OBJECT CONFIGURATION FILE(S)
+# These are the object configuration files in which you define hosts,
+# host groups, contacts, contact groups, services, etc.
+# You can split your object definitions across several config files
+# if you wish (as shown below), or keep them all in a single config file.
+
+# You can specify individual object config files as shown below:
+cfg_file=/etc/nagios/objects/commands.cfg
+cfg_file=/etc/nagios/objects/contacts.cfg
+cfg_file=/etc/nagios/objects/timeperiods.cfg
+cfg_file=/etc/nagios/objects/templates.cfg
+
+# Definitions for monitoring the local (Linux) host
+#cfg_file=/etc/nagios/objects/localhost.cfg
+
+# Definitions for monitoring a Windows machine
+#cfg_file=/etc/nagios/objects/windows.cfg
+
+# Definitions for monitoring a router/switch
+#cfg_file=/etc/nagios/objects/switch.cfg
+
+# Definitions for monitoring a network printer
+#cfg_file=/etc/nagios/objects/printer.cfg
+
+# Definitions for hadoop servers
+cfg_file={{nagios_host_cfg}}
+cfg_file={{nagios_hostgroup_cfg}}
+cfg_file={{nagios_servicegroup_cfg}}
+cfg_file={{nagios_service_cfg}}
+cfg_file={{nagios_command_cfg}}
+
+
+# You can also tell Nagios to process all config files (with a .cfg
+# extension) in a particular directory by using the cfg_dir
+# directive as shown below:
+
+#cfg_dir=/etc/nagios/servers
+#cfg_dir=/etc/nagios/printers
+#cfg_dir=/etc/nagios/switches
+#cfg_dir=/etc/nagios/routers
+
+
+
+
+# OBJECT CACHE FILE
+# This option determines where object definitions are cached when
+# Nagios starts/restarts. The CGIs read object definitions from
+# this cache file (rather than looking at the object config files
+# directly) in order to prevent inconsistencies that can occur
+# when the config files are modified after Nagios starts.
+
+object_cache_file=/var/nagios/objects.cache
+
+
+
+# PRE-CACHED OBJECT FILE
+# This options determines the location of the precached object file.
+# If you run Nagios with the -p command line option, it will preprocess
+# your object configuration file(s) and write the cached config to this
+# file. You can then start Nagios with the -u option to have it read
+# object definitions from this precached file, rather than the standard
+# object configuration files (see the cfg_file and cfg_dir options above).
+# Using a precached object file can speed up the time needed to (re)start
+# the Nagios process if you've got a large and/or complex configuration.
+# Read the documentation section on optimizing Nagios to find our more
+# about how this feature works.
+
+precached_object_file=/var/nagios/objects.precache
+
+
+
+# RESOURCE FILE
+# This is an optional resource file that contains $USERx$ macro
+# definitions. Multiple resource files can be specified by using
+# multiple resource_file definitions. The CGIs will not attempt to
+# read the contents of resource files, so information that is
+# considered to be sensitive (usernames, passwords, etc) can be
+# defined as macros in this file and restrictive permissions (600)
+# can be placed on this file.
+
+resource_file={{nagios_resource_cfg}}
+
+
+
+# STATUS FILE
+# This is where the current status of all monitored services and
+# hosts is stored. Its contents are read and processed by the CGIs.
+# The contents of the status file are deleted every time Nagios
+# restarts.
+
+status_file=/var/nagios/status.dat
+
+
+
+# STATUS FILE UPDATE INTERVAL
+# This option determines the frequency (in seconds) that
+# Nagios will periodically dump program, host, and
+# service status data.
+
+status_update_interval=10
+
+
+
+# NAGIOS USER
+# This determines the effective user that Nagios should run as.
+# You can either supply a username or a UID.
+
+nagios_user={{nagios_user}}
+
+
+
+# NAGIOS GROUP
+# This determines the effective group that Nagios should run as.
+# You can either supply a group name or a GID.
+
+nagios_group={{nagios_group}}
+
+
+
+# EXTERNAL COMMAND OPTION
+# This option allows you to specify whether or not Nagios should check
+# for external commands (in the command file defined below). By default
+# Nagios will *not* check for external commands, just to be on the
+# cautious side. If you want to be able to use the CGI command interface
+# you will have to enable this.
+# Values: 0 = disable commands, 1 = enable commands
+
+check_external_commands=1
+
+
+
+# EXTERNAL COMMAND CHECK INTERVAL
+# This is the interval at which Nagios should check for external commands.
+# This value works of the interval_length you specify later. If you leave
+# that at its default value of 60 (seconds), a value of 1 here will cause
+# Nagios to check for external commands every minute. If you specify a
+# number followed by an "s" (i.e. 15s), this will be interpreted to mean
+# actual seconds rather than a multiple of the interval_length variable.
+# Note: In addition to reading the external command file at regularly
+# scheduled intervals, Nagios will also check for external commands after
+# event handlers are executed.
+# NOTE: Setting this value to -1 causes Nagios to check the external
+# command file as often as possible.
+
+#command_check_interval=15s
+command_check_interval=-1
+
+
+
+# EXTERNAL COMMAND FILE
+# This is the file that Nagios checks for external command requests.
+# It is also where the command CGI will write commands that are submitted
+# by users, so it must be writeable by the user that the web server
+# is running as (usually 'nobody'). Permissions should be set at the
+# directory level instead of on the file, as the file is deleted every
+# time its contents are processed.
+
+command_file=/var/nagios/rw/nagios.cmd
+
+
+
+# EXTERNAL COMMAND BUFFER SLOTS
+# This settings is used to tweak the number of items or "slots" that
+# the Nagios daemon should allocate to the buffer that holds incoming
+# external commands before they are processed. As external commands
+# are processed by the daemon, they are removed from the buffer.
+
+external_command_buffer_slots=4096
+
+
+
+# LOCK FILE
+# This is the lockfile that Nagios will use to store its PID number
+# in when it is running in daemon mode.
+
+lock_file={{nagios_pid_file}}
+
+
+
+# TEMP FILE
+# This is a temporary file that is used as scratch space when Nagios
+# updates the status log, cleans the comment file, etc. This file
+# is created, used, and deleted throughout the time that Nagios is
+# running.
+
+temp_file=/var/nagios/nagios.tmp
+
+
+
+# TEMP PATH
+# This is path where Nagios can create temp files for service and
+# host check results, etc.
+
+temp_path=/tmp
+
+
+
+# EVENT BROKER OPTIONS
+# Controls what (if any) data gets sent to the event broker.
+# Values: 0 = Broker nothing
+# -1 = Broker everything
+# <other> = See documentation
+
+event_broker_options=-1
+
+
+
+# EVENT BROKER MODULE(S)
+# This directive is used to specify an event broker module that should
+# by loaded by Nagios at startup. Use multiple directives if you want
+# to load more than one module. Arguments that should be passed to
+# the module at startup are seperated from the module path by a space.
+#
+#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+# WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING
+#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+#
+# Do NOT overwrite modules while they are being used by Nagios or Nagios
+# will crash in a fiery display of SEGFAULT glory. This is a bug/limitation
+# either in dlopen(), the kernel, and/or the filesystem. And maybe Nagios...
+#
+# The correct/safe way of updating a module is by using one of these methods:
+# 1. Shutdown Nagios, replace the module file, restart Nagios
+# 2. Delete the original module file, move the new module file into place, restart Nagios
+#
+# Example:
+#
+# broker_module=<modulepath> [moduleargs]
+
+#broker_module=/somewhere/module1.o
+#broker_module=/somewhere/module2.o arg1 arg2=3 debug=0
+
+
+
+# LOG ROTATION METHOD
+# This is the log rotation method that Nagios should use to rotate
+# the main log file. Values are as follows..
+# n = None - don't rotate the log
+# h = Hourly rotation (top of the hour)
+# d = Daily rotation (midnight every day)
+# w = Weekly rotation (midnight on Saturday evening)
+# m = Monthly rotation (midnight last day of month)
+
+log_rotation_method=d
+
+
+
+# LOG ARCHIVE PATH
+# This is the directory where archived (rotated) log files should be
+# placed (assuming you've chosen to do log rotation).
+
+log_archive_path=/var/log/nagios/archives
+
+
+
+# LOGGING OPTIONS
+# If you want messages logged to the syslog facility, as well as the
+# Nagios log file set this option to 1. If not, set it to 0.
+
+use_syslog=1
+
+
+
+# NOTIFICATION LOGGING OPTION
+# If you don't want notifications to be logged, set this value to 0.
+# If notifications should be logged, set the value to 1.
+
+log_notifications=1
+
+
+
+# SERVICE RETRY LOGGING OPTION
+# If you don't want service check retries to be logged, set this value
+# to 0. If retries should be logged, set the value to 1.
+
+log_service_retries=1
+
+
+
+# HOST RETRY LOGGING OPTION
+# If you don't want host check retries to be logged, set this value to
+# 0. If retries should be logged, set the value to 1.
+
+log_host_retries=1
+
+
+
+# EVENT HANDLER LOGGING OPTION
+# If you don't want host and service event handlers to be logged, set
+# this value to 0. If event handlers should be logged, set the value
+# to 1.
+
+log_event_handlers=1
+
+
+
+# INITIAL STATES LOGGING OPTION
+# If you want Nagios to log all initial host and service states to
+# the main log file (the first time the service or host is checked)
+# you can enable this option by setting this value to 1. If you
+# are not using an external application that does long term state
+# statistics reporting, you do not need to enable this option. In
+# this case, set the value to 0.
+
+log_initial_states=0
+
+
+
+# EXTERNAL COMMANDS LOGGING OPTION
+# If you don't want Nagios to log external commands, set this value
+# to 0. If external commands should be logged, set this value to 1.
+# Note: This option does not include logging of passive service
+# checks - see the option below for controlling whether or not
+# passive checks are logged.
+
+log_external_commands=1
+
+
+
+# PASSIVE CHECKS LOGGING OPTION
+# If you don't want Nagios to log passive host and service checks, set
+# this value to 0. If passive checks should be logged, set
+# this value to 1.
+
+log_passive_checks=1
+
+
+
+# GLOBAL HOST AND SERVICE EVENT HANDLERS
+# These options allow you to specify a host and service event handler
+# command that is to be run for every host or service state change.
+# The global event handler is executed immediately prior to the event
+# handler that you have optionally specified in each host or
+# service definition. The command argument is the short name of a
+# command definition that you define in your host configuration file.
+# Read the HTML docs for more information.
+
+#global_host_event_handler=somecommand
+#global_service_event_handler=somecommand
+
+
+
+# SERVICE INTER-CHECK DELAY METHOD
+# This is the method that Nagios should use when initially
+# "spreading out" service checks when it starts monitoring. The
+# default is to use smart delay calculation, which will try to
+# space all service checks out evenly to minimize CPU load.
+# Using the dumb setting will cause all checks to be scheduled
+# at the same time (with no delay between them)! This is not a
+# good thing for production, but is useful when testing the
+# parallelization functionality.
+# n = None - don't use any delay between checks
+# d = Use a "dumb" delay of 1 second between checks
+# s = Use "smart" inter-check delay calculation
+# x.xx = Use an inter-check delay of x.xx seconds
+
+service_inter_check_delay_method=s
+
+
+
+# MAXIMUM SERVICE CHECK SPREAD
+# This variable determines the timeframe (in minutes) from the
+# program start time that an initial check of all services should
+# be completed. Default is 30 minutes.
+
+max_service_check_spread=30
+
+
+
+# SERVICE CHECK INTERLEAVE FACTOR
+# This variable determines how service checks are interleaved.
+# Interleaving the service checks allows for a more even
+# distribution of service checks and reduced load on remote
+# hosts. Setting this value to 1 is equivalent to how versions
+# of Nagios previous to 0.0.5 did service checks. Set this
+# value to s (smart) for automatic calculation of the interleave
+# factor unless you have a specific reason to change it.
+# s = Use "smart" interleave factor calculation
+# x = Use an interleave factor of x, where x is a
+# number greater than or equal to 1.
+
+service_interleave_factor=s
+
+
+
+# HOST INTER-CHECK DELAY METHOD
+# This is the method that Nagios should use when initially
+# "spreading out" host checks when it starts monitoring. The
+# default is to use smart delay calculation, which will try to
+# space all host checks out evenly to minimize CPU load.
+# Using the dumb setting will cause all checks to be scheduled
+# at the same time (with no delay between them)!
+# n = None - don't use any delay between checks
+# d = Use a "dumb" delay of 1 second between checks
+# s = Use "smart" inter-check delay calculation
+# x.xx = Use an inter-check delay of x.xx seconds
+
+host_inter_check_delay_method=s
+
+
+
+# MAXIMUM HOST CHECK SPREAD
+# This variable determines the timeframe (in minutes) from the
+# program start time that an initial check of all hosts should
+# be completed. Default is 30 minutes.
+
+max_host_check_spread=30
+
+
+
+# MAXIMUM CONCURRENT SERVICE CHECKS
+# This option allows you to specify the maximum number of
+# service checks that can be run in parallel at any given time.
+# Specifying a value of 1 for this variable essentially prevents
+# any service checks from being parallelized. A value of 0
+# will not restrict the number of concurrent checks that are
+# being executed.
+
+max_concurrent_checks=0
+
+
+
+# HOST AND SERVICE CHECK REAPER FREQUENCY
+# This is the frequency (in seconds!) that Nagios will process
+# the results of host and service checks.
+
+check_result_reaper_frequency=10
+
+
+
+
+# MAX CHECK RESULT REAPER TIME
+# This is the max amount of time (in seconds) that a single
+# check result reaper event will be allowed to run before
+# returning control back to Nagios so it can perform other
+# duties.
+
+max_check_result_reaper_time=30
+
+
+
+
+# CHECK RESULT PATH
+# This is directory where Nagios stores the results of host and
+# service checks that have not yet been processed.
+#
+# Note: Make sure that only one instance of Nagios has access
+# to this directory!
+
+check_result_path=/var/nagios/spool/checkresults
+
+
+
+
+# MAX CHECK RESULT FILE AGE
+# This option determines the maximum age (in seconds) which check
+# result files are considered to be valid. Files older than this
+# threshold will be mercilessly deleted without further processing.
+
+max_check_result_file_age=3600
+
+
+
+
+# CACHED HOST CHECK HORIZON
+# This option determines the maximum amount of time (in seconds)
+# that the state of a previous host check is considered current.
+# Cached host states (from host checks that were performed more
+# recently that the timeframe specified by this value) can immensely
+# improve performance in regards to the host check logic.
+# Too high of a value for this option may result in inaccurate host
+# states being used by Nagios, while a lower value may result in a
+# performance hit for host checks. Use a value of 0 to disable host
+# check caching.
+
+cached_host_check_horizon=15
+
+
+
+# CACHED SERVICE CHECK HORIZON
+# This option determines the maximum amount of time (in seconds)
+# that the state of a previous service check is considered current.
+# Cached service states (from service checks that were performed more
+# recently that the timeframe specified by this value) can immensely
+# improve performance in regards to predictive dependency checks.
+# Use a value of 0 to disable service check caching.
+
+cached_service_check_horizon=15
+
+
+
+# ENABLE PREDICTIVE HOST DEPENDENCY CHECKS
+# This option determines whether or not Nagios will attempt to execute
+# checks of hosts when it predicts that future dependency logic test
+# may be needed. These predictive checks can help ensure that your
+# host dependency logic works well.
+# Values:
+# 0 = Disable predictive checks
+# 1 = Enable predictive checks (default)
+
+enable_predictive_host_dependency_checks=1
+
+
+
+# ENABLE PREDICTIVE SERVICE DEPENDENCY CHECKS
+# This option determines whether or not Nagios will attempt to execute
+# checks of service when it predicts that future dependency logic test
+# may be needed. These predictive checks can help ensure that your
+# service dependency logic works well.
+# Values:
+# 0 = Disable predictive checks
+# 1 = Enable predictive checks (default)
+
+enable_predictive_service_dependency_checks=1
+
+
+
+# SOFT STATE DEPENDENCIES
+# This option determines whether or not Nagios will use soft state
+# information when checking host and service dependencies. Normally
+# Nagios will only use the latest hard host or service state when
+# checking dependencies. If you want it to use the latest state (regardless
+# of whether its a soft or hard state type), enable this option.
+# Values:
+# 0 = Don't use soft state dependencies (default)
+# 1 = Use soft state dependencies
+
+soft_state_dependencies=0
+
+
+
+# TIME CHANGE ADJUSTMENT THRESHOLDS
+# These options determine when Nagios will react to detected changes
+# in system time (either forward or backwards).
+
+#time_change_threshold=900
+
+
+
+# AUTO-RESCHEDULING OPTION
+# This option determines whether or not Nagios will attempt to
+# automatically reschedule active host and service checks to
+# "smooth" them out over time. This can help balance the load on
+# the monitoring server.
+# WARNING: THIS IS AN EXPERIMENTAL FEATURE - IT CAN DEGRADE
+# PERFORMANCE, RATHER THAN INCREASE IT, IF USED IMPROPERLY
+
+auto_reschedule_checks=0
+
+
+
+# AUTO-RESCHEDULING INTERVAL
+# This option determines how often (in seconds) Nagios will
+# attempt to automatically reschedule checks. This option only
+# has an effect if the auto_reschedule_checks option is enabled.
+# Default is 30 seconds.
+# WARNING: THIS IS AN EXPERIMENTAL FEATURE - IT CAN DEGRADE
+# PERFORMANCE, RATHER THAN INCREASE IT, IF USED IMPROPERLY
+
+auto_rescheduling_interval=30
+
+
+
+# AUTO-RESCHEDULING WINDOW
+# This option determines the "window" of time (in seconds) that
+# Nagios will look at when automatically rescheduling checks.
+# Only host and service checks that occur in the next X seconds
+# (determined by this variable) will be rescheduled. This option
+# only has an effect if the auto_reschedule_checks option is
+# enabled. Default is 180 seconds (3 minutes).
+# WARNING: THIS IS AN EXPERIMENTAL FEATURE - IT CAN DEGRADE
+# PERFORMANCE, RATHER THAN INCREASE IT, IF USED IMPROPERLY
+
+auto_rescheduling_window=180
+
+
+
+# SLEEP TIME
+# This is the number of seconds to sleep between checking for system
+# events and service checks that need to be run.
+
+sleep_time=0.25
+
+
+
+# TIMEOUT VALUES
+# These options control how much time Nagios will allow various
+# types of commands to execute before killing them off. Options
+# are available for controlling maximum time allotted for
+# service checks, host checks, event handlers, notifications, the
+# ocsp command, and performance data commands. All values are in
+# seconds.
+
+service_check_timeout=60
+host_check_timeout=30
+event_handler_timeout=30
+notification_timeout=30
+ocsp_timeout=5
+perfdata_timeout=5
+
+
+
+# RETAIN STATE INFORMATION
+# This setting determines whether or not Nagios will save state
+# information for services and hosts before it shuts down. Upon
+# startup Nagios will reload all saved service and host state
+# information before starting to monitor. This is useful for
+# maintaining long-term data on state statistics, etc, but will
+# slow Nagios down a bit when it (re)starts. Since its only
+# a one-time penalty, I think its well worth the additional
+# startup delay.
+
+retain_state_information=1
+
+
+
+# STATE RETENTION FILE
+# This is the file that Nagios should use to store host and
+# service state information before it shuts down. The state
+# information in this file is also read immediately prior to
+# starting to monitor the network when Nagios is restarted.
+# This file is used only if the retain_state_information
+# variable is set to 1.
+
+state_retention_file=/var/nagios/retention.dat
+
+
+
+# RETENTION DATA UPDATE INTERVAL
+# This setting determines how often (in minutes) that Nagios
+# will automatically save retention data during normal operation.
+# If you set this value to 0, Nagios will not save retention
+# data at regular interval, but it will still save retention
+# data before shutting down or restarting. If you have disabled
+# state retention, this option has no effect.
+
+retention_update_interval=60
+
+
+
+# USE RETAINED PROGRAM STATE
+# This setting determines whether or not Nagios will set
+# program status variables based on the values saved in the
+# retention file. If you want to use retained program status
+# information, set this value to 1. If not, set this value
+# to 0.
+
+use_retained_program_state=1
+
+
+
+# USE RETAINED SCHEDULING INFO
+# This setting determines whether or not Nagios will retain
+# the scheduling info (next check time) for hosts and services
+# based on the values saved in the retention file. If you
+# If you want to use retained scheduling info, set this
+# value to 1. If not, set this value to 0.
+
+use_retained_scheduling_info=1
+
+
+
+# RETAINED ATTRIBUTE MASKS (ADVANCED FEATURE)
+# The following variables are used to specify specific host and
+# service attributes that should *not* be retained by Nagios during
+# program restarts.
+#
+# The values of the masks are bitwise ANDs of values specified
+# by the "MODATTR_" definitions found in include/common.h.
+# For example, if you do not want the current enabled/disabled state
+# of flap detection and event handlers for hosts to be retained, you
+# would use a value of 24 for the host attribute mask...
+# MODATTR_EVENT_HANDLER_ENABLED (8) + MODATTR_FLAP_DETECTION_ENABLED (16) = 24
+
+# This mask determines what host attributes are not retained
+retained_host_attribute_mask=0
+
+# This mask determines what service attributes are not retained
+retained_service_attribute_mask=0
+
+# These two masks determine what process attributes are not retained.
+# There are two masks, because some process attributes have host and service
+# options. For example, you can disable active host checks, but leave active
+# service checks enabled.
+retained_process_host_attribute_mask=0
+retained_process_service_attribute_mask=0
+
+# These two masks determine what contact attributes are not retained.
+# There are two masks, because some contact attributes have host and
+# service options. For example, you can disable host notifications for
+# a contact, but leave service notifications enabled for them.
+retained_contact_host_attribute_mask=0
+retained_contact_service_attribute_mask=0
+
+
+
+# INTERVAL LENGTH
+# This is the seconds per unit interval as used in the
+# host/contact/service configuration files. Setting this to 60 means
+# that each interval is one minute long (60 seconds). Other settings
+# have not been tested much, so your mileage is likely to vary...
+
+interval_length=60
+
+
+
+# CHECK FOR UPDATES
+# This option determines whether Nagios will automatically check to
+# see if new updates (releases) are available. It is recommend that you
+# enable this option to ensure that you stay on top of the latest critical
+# patches to Nagios. Nagios is critical to you - make sure you keep it in
+# good shape. Nagios will check once a day for new updates. Data collected
+# by Nagios Enterprises from the update check is processed in accordance
+# with our privacy policy - see http://api.nagios.org for details.
+
+check_for_updates=1
+
+
+
+# BARE UPDATE CHECK
+# This option deterines what data Nagios will send to api.nagios.org when
+# it checks for updates. By default, Nagios will send information on the
+# current version of Nagios you have installed, as well as an indicator as
+# to whether this was a new installation or not. Nagios Enterprises uses
+# this data to determine the number of users running specific version of
+# Nagios. Enable this option if you do not want this information to be sent.
+
+bare_update_check=0
+
+
+
+# AGGRESSIVE HOST CHECKING OPTION
+# If you don't want to turn on aggressive host checking features, set
+# this value to 0 (the default). Otherwise set this value to 1 to
+# enable the aggressive check option. Read the docs for more info
+# on what aggressive host check is or check out the source code in
+# base/checks.c
+
+use_aggressive_host_checking=0
+
+
+
+# SERVICE CHECK EXECUTION OPTION
+# This determines whether or not Nagios will actively execute
+# service checks when it initially starts. If this option is
+# disabled, checks are not actively made, but Nagios can still
+# receive and process passive check results that come in. Unless
+# you're implementing redundant hosts or have a special need for
+# disabling the execution of service checks, leave this enabled!
+# Values: 1 = enable checks, 0 = disable checks
+
+execute_service_checks=1
+
+
+
+# PASSIVE SERVICE CHECK ACCEPTANCE OPTION
+# This determines whether or not Nagios will accept passive
+# service checks results when it initially (re)starts.
+# Values: 1 = accept passive checks, 0 = reject passive checks
+
+accept_passive_service_checks=1
+
+
+
+# HOST CHECK EXECUTION OPTION
+# This determines whether or not Nagios will actively execute
+# host checks when it initially starts. If this option is
+# disabled, checks are not actively made, but Nagios can still
+# receive and process passive check results that come in. Unless
+# you're implementing redundant hosts or have a special need for
+# disabling the execution of host checks, leave this enabled!
+# Values: 1 = enable checks, 0 = disable checks
+
+execute_host_checks=1
+
+
+
+# PASSIVE HOST CHECK ACCEPTANCE OPTION
+# This determines whether or not Nagios will accept passive
+# host checks results when it initially (re)starts.
+# Values: 1 = accept passive checks, 0 = reject passive checks
+
+accept_passive_host_checks=1
+
+
+
+# NOTIFICATIONS OPTION
+# This determines whether or not Nagios will sent out any host or
+# service notifications when it is initially (re)started.
+# Values: 1 = enable notifications, 0 = disable notifications
+
+enable_notifications=1
+
+
+
+# EVENT HANDLER USE OPTION
+# This determines whether or not Nagios will run any host or
+# service event handlers when it is initially (re)started. Unless
+# you're implementing redundant hosts, leave this option enabled.
+# Values: 1 = enable event handlers, 0 = disable event handlers
+
+enable_event_handlers=1
+
+
+
+# PROCESS PERFORMANCE DATA OPTION
+# This determines whether or not Nagios will process performance
+# data returned from service and host checks. If this option is
+# enabled, host performance data will be processed using the
+# host_perfdata_command (defined below) and service performance
+# data will be processed using the service_perfdata_command (also
+# defined below). Read the HTML docs for more information on
+# performance data.
+# Values: 1 = process performance data, 0 = do not process performance data
+
+process_performance_data=0
+
+
+
+# HOST AND SERVICE PERFORMANCE DATA PROCESSING COMMANDS
+# These commands are run after every host and service check is
+# performed. These commands are executed only if the
+# enable_performance_data option (above) is set to 1. The command
+# argument is the short name of a command definition that you
+# define in your host configuration file. Read the HTML docs for
+# more information on performance data.
+
+#host_perfdata_command=process-host-perfdata
+#service_perfdata_command=process-service-perfdata
+
+
+
+# HOST AND SERVICE PERFORMANCE DATA FILES
+# These files are used to store host and service performance data.
+# Performance data is only written to these files if the
+# enable_performance_data option (above) is set to 1.
+
+#host_perfdata_file=/tmp/host-perfdata
+#service_perfdata_file=/tmp/service-perfdata
+
+
+
+# HOST AND SERVICE PERFORMANCE DATA FILE TEMPLATES
+# These options determine what data is written (and how) to the
+# performance data files. The templates may contain macros, special
+# characters (\t for tab, \r for carriage return, \n for newline)
+# and plain text. A newline is automatically added after each write
+# to the performance data file. Some examples of what you can do are
+# shown below.
+
+#host_perfdata_file_template=[HOSTPERFDATA]\t$TIMET$\t$HOSTNAME$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$
+#service_perfdata_file_template=[SERVICEPERFDATA]\t$TIMET$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$
+
+
+
+# HOST AND SERVICE PERFORMANCE DATA FILE MODES
+# This option determines whether or not the host and service
+# performance data files are opened in write ("w") or append ("a")
+# mode. If you want to use named pipes, you should use the special
+# pipe ("p") mode which avoid blocking at startup, otherwise you will
+# likely want the defult append ("a") mode.
+
+#host_perfdata_file_mode=a
+#service_perfdata_file_mode=a
+
+
+
+# HOST AND SERVICE PERFORMANCE DATA FILE PROCESSING INTERVAL
+# These options determine how often (in seconds) the host and service
+# performance data files are processed using the commands defined
+# below. A value of 0 indicates the files should not be periodically
+# processed.
+
+#host_perfdata_file_processing_interval=0
+#service_perfdata_file_processing_interval=0
+
+
+
+# HOST AND SERVICE PERFORMANCE DATA FILE PROCESSING COMMANDS
+# These commands are used to periodically process the host and
+# service performance data files. The interval at which the
+# processing occurs is determined by the options above.
+
+#host_perfdata_file_processing_command=process-host-perfdata-file
+#service_perfdata_file_processing_command=process-service-perfdata-file
+
+
+
+# OBSESS OVER SERVICE CHECKS OPTION
+# This determines whether or not Nagios will obsess over service
+# checks and run the ocsp_command defined below. Unless you're
+# planning on implementing distributed monitoring, do not enable
+# this option. Read the HTML docs for more information on
+# implementing distributed monitoring.
+# Values: 1 = obsess over services, 0 = do not obsess (default)
+
+obsess_over_services=0
+
+
+
+# OBSESSIVE COMPULSIVE SERVICE PROCESSOR COMMAND
+# This is the command that is run for every service check that is
+# processed by Nagios. This command is executed only if the
+# obsess_over_services option (above) is set to 1. The command
+# argument is the short name of a command definition that you
+# define in your host configuration file. Read the HTML docs for
+# more information on implementing distributed monitoring.
+
+#ocsp_command=somecommand
+
+
+
+# OBSESS OVER HOST CHECKS OPTION
+# This determines whether or not Nagios will obsess over host
+# checks and run the ochp_command defined below. Unless you're
+# planning on implementing distributed monitoring, do not enable
+# this option. Read the HTML docs for more information on
+# implementing distributed monitoring.
+# Values: 1 = obsess over hosts, 0 = do not obsess (default)
+
+obsess_over_hosts=0
+
+
+
+# OBSESSIVE COMPULSIVE HOST PROCESSOR COMMAND
+# This is the command that is run for every host check that is
+# processed by Nagios. This command is executed only if the
+# obsess_over_hosts option (above) is set to 1. The command
+# argument is the short name of a command definition that you
+# define in your host configuration file. Read the HTML docs for
+# more information on implementing distributed monitoring.
+
+#ochp_command=somecommand
+
+
+
+# TRANSLATE PASSIVE HOST CHECKS OPTION
+# This determines whether or not Nagios will translate
+# DOWN/UNREACHABLE passive host check results into their proper
+# state for this instance of Nagios. This option is useful
+# if you have distributed or failover monitoring setup. In
+# these cases your other Nagios servers probably have a different
+# "view" of the network, with regards to the parent/child relationship
+# of hosts. If a distributed monitoring server thinks a host
+# is DOWN, it may actually be UNREACHABLE from the point of
+# this Nagios instance. Enabling this option will tell Nagios
+# to translate any DOWN or UNREACHABLE host states it receives
+# passively into the correct state from the view of this server.
+# Values: 1 = perform translation, 0 = do not translate (default)
+
+translate_passive_host_checks=0
+
+
+
+# PASSIVE HOST CHECKS ARE SOFT OPTION
+# This determines whether or not Nagios will treat passive host
+# checks as being HARD or SOFT. By default, a passive host check
+# result will put a host into a HARD state type. This can be changed
+# by enabling this option.
+# Values: 0 = passive checks are HARD, 1 = passive checks are SOFT
+
+passive_host_checks_are_soft=0
+
+
+
+# ORPHANED HOST/SERVICE CHECK OPTIONS
+# These options determine whether or not Nagios will periodically
+# check for orphaned host service checks. Since service checks are
+# not rescheduled until the results of their previous execution
+# instance are processed, there exists a possibility that some
+# checks may never get rescheduled. A similar situation exists for
+# host checks, although the exact scheduling details differ a bit
+# from service checks. Orphaned checks seem to be a rare
+# problem and should not happen under normal circumstances.
+# If you have problems with service checks never getting
+# rescheduled, make sure you have orphaned service checks enabled.
+# Values: 1 = enable checks, 0 = disable checks
+
+check_for_orphaned_services=1
+check_for_orphaned_hosts=1
+
+
+
+# SERVICE FRESHNESS CHECK OPTION
+# This option determines whether or not Nagios will periodically
+# check the "freshness" of service results. Enabling this option
+# is useful for ensuring passive checks are received in a timely
+# manner.
+# Values: 1 = enabled freshness checking, 0 = disable freshness checking
+
+check_service_freshness=1
+
+
+
+# SERVICE FRESHNESS CHECK INTERVAL
+# This setting determines how often (in seconds) Nagios will
+# check the "freshness" of service check results. If you have
+# disabled service freshness checking, this option has no effect.
+
+service_freshness_check_interval=60
+
+
+
+# HOST FRESHNESS CHECK OPTION
+# This option determines whether or not Nagios will periodically
+# check the "freshness" of host results. Enabling this option
+# is useful for ensuring passive checks are received in a timely
+# manner.
+# Values: 1 = enabled freshness checking, 0 = disable freshness checking
+
+check_host_freshness=0
+
+
+
+# HOST FRESHNESS CHECK INTERVAL
+# This setting determines how often (in seconds) Nagios will
+# check the "freshness" of host check results. If you have
+# disabled host freshness checking, this option has no effect.
+
+host_freshness_check_interval=60
+
+
+
+
+# ADDITIONAL FRESHNESS THRESHOLD LATENCY
+# This setting determines the number of seconds that Nagios
+# will add to any host and service freshness thresholds that
+# it calculates (those not explicitly specified by the user).
+
+additional_freshness_latency=15
+
+
+
+
+# FLAP DETECTION OPTION
+# This option determines whether or not Nagios will try
+# and detect hosts and services that are "flapping".
+# Flapping occurs when a host or service changes between
+# states too frequently. When Nagios detects that a
+# host or service is flapping, it will temporarily suppress
+# notifications for that host/service until it stops
+# flapping. Flap detection is very experimental, so read
+# the HTML documentation before enabling this feature!
+# Values: 1 = enable flap detection
+# 0 = disable flap detection (default)
+
+enable_flap_detection=1
+
+
+
+# FLAP DETECTION THRESHOLDS FOR HOSTS AND SERVICES
+# Read the HTML documentation on flap detection for
+# an explanation of what this option does. This option
+# has no effect if flap detection is disabled.
+
+low_service_flap_threshold=5.0
+high_service_flap_threshold=20.0
+low_host_flap_threshold=5.0
+high_host_flap_threshold=20.0
+
+
+
+# DATE FORMAT OPTION
+# This option determines how short dates are displayed. Valid options
+# include:
+# us (MM-DD-YYYY HH:MM:SS)
+# euro (DD-MM-YYYY HH:MM:SS)
+# iso8601 (YYYY-MM-DD HH:MM:SS)
+# strict-iso8601 (YYYY-MM-DDTHH:MM:SS)
+#
+
+date_format=us
+
+
+
+
+# TIMEZONE OFFSET
+# This option is used to override the default timezone that this
+# instance of Nagios runs in. If not specified, Nagios will use
+# the system configured timezone.
+#
+# NOTE: In order to display the correct timezone in the CGIs, you
+# will also need to alter the Apache directives for the CGI path
+# to include your timezone. Example:
+#
+# <Directory "/usr/local/nagios/sbin/">
+# SetEnv TZ "Australia/Brisbane"
+# ...
+# </Directory>
+
+#use_timezone=US/Mountain
+#use_timezone=Australia/Brisbane
+
+
+
+
+# P1.PL FILE LOCATION
+# This value determines where the p1.pl perl script (used by the
+# embedded Perl interpreter) is located. If you didn't compile
+# Nagios with embedded Perl support, this option has no effect.
+
+p1_file = {{nagios_p1_pl}}
+
+
+
+# EMBEDDED PERL INTERPRETER OPTION
+# This option determines whether or not the embedded Perl interpreter
+# will be enabled during runtime. This option has no effect if Nagios
+# has not been compiled with support for embedded Perl.
+# Values: 0 = disable interpreter, 1 = enable interpreter
+
+enable_embedded_perl=1
+
+
+
+# EMBEDDED PERL USAGE OPTION
+# This option determines whether or not Nagios will process Perl plugins
+# and scripts with the embedded Perl interpreter if the plugins/scripts
+# do not explicitly indicate whether or not it is okay to do so. Read
+# the HTML documentation on the embedded Perl interpreter for more
+# information on how this option works.
+
+use_embedded_perl_implicitly=1
+
+
+
+# ILLEGAL OBJECT NAME CHARACTERS
+# This option allows you to specify illegal characters that cannot
+# be used in host names, service descriptions, or names of other
+# object types.
+
+illegal_object_name_chars=`~!$%^&*|'"<>?,()=
+
+
+
+# ILLEGAL MACRO OUTPUT CHARACTERS
+# This option allows you to specify illegal characters that are
+# stripped from macros before being used in notifications, event
+# handlers, etc. This DOES NOT affect macros used in service or
+# host check commands.
+# The following macros are stripped of the characters you specify:
+# $HOSTOUTPUT$
+# $HOSTPERFDATA$
+# $HOSTACKAUTHOR$
+# $HOSTACKCOMMENT$
+# $SERVICEOUTPUT$
+# $SERVICEPERFDATA$
+# $SERVICEACKAUTHOR$
+# $SERVICEACKCOMMENT$
+
+illegal_macro_output_chars=`~$&|'"<>
+
+
+
+# REGULAR EXPRESSION MATCHING
+# This option controls whether or not regular expression matching
+# takes place in the object config files. Regular expression
+# matching is used to match host, hostgroup, service, and service
+# group names/descriptions in some fields of various object types.
+# Values: 1 = enable regexp matching, 0 = disable regexp matching
+
+use_regexp_matching=0
+
+
+
+# "TRUE" REGULAR EXPRESSION MATCHING
+# This option controls whether or not "true" regular expression
+# matching takes place in the object config files. This option
+# only has an effect if regular expression matching is enabled
+# (see above). If this option is DISABLED, regular expression
+# matching only occurs if a string contains wildcard characters
+# (* and ?). If the option is ENABLED, regexp matching occurs
+# all the time (which can be annoying).
+# Values: 1 = enable true matching, 0 = disable true matching
+
+use_true_regexp_matching=0
+
+
+
+# ADMINISTRATOR EMAIL/PAGER ADDRESSES
+# The email and pager address of a global administrator (likely you).
+# Nagios never uses these values itself, but you can access them by
+# using the $ADMINEMAIL$ and $ADMINPAGER$ macros in your notification
+# commands.
+
+admin_email=nagios@localhost
+admin_pager=pagenagios@localhost
+
+
+
+# DAEMON CORE DUMP OPTION
+# This option determines whether or not Nagios is allowed to create
+# a core dump when it runs as a daemon. Note that it is generally
+# considered bad form to allow this, but it may be useful for
+# debugging purposes. Enabling this option doesn't guarantee that
+# a core file will be produced, but that's just life...
+# Values: 1 - Allow core dumps
+# 0 - Do not allow core dumps (default)
+
+daemon_dumps_core=0
+
+
+
+# LARGE INSTALLATION TWEAKS OPTION
+# This option determines whether or not Nagios will take some shortcuts
+# which can save on memory and CPU usage in large Nagios installations.
+# Read the documentation for more information on the benefits/tradeoffs
+# of enabling this option.
+# Values: 1 - Enabled tweaks
+# 0 - Disable tweaks (default)
+
+use_large_installation_tweaks=0
+
+
+
+# ENABLE ENVIRONMENT MACROS
+# This option determines whether or not Nagios will make all standard
+# macros available as environment variables when host/service checks
+# and system commands (event handlers, notifications, etc.) are
+# executed. Enabling this option can cause performance issues in
+# large installations, as it will consume a bit more memory and (more
+# importantly) consume more CPU.
+# Values: 1 - Enable environment variable macros (default)
+# 0 - Disable environment variable macros
+
+enable_environment_macros=1
+
+
+
+# CHILD PROCESS MEMORY OPTION
+# This option determines whether or not Nagios will free memory in
+# child processes (processed used to execute system commands and host/
+# service checks). If you specify a value here, it will override
+# program defaults.
+# Value: 1 - Free memory in child processes
+# 0 - Do not free memory in child processes
+
+#free_child_process_memory=1
+
+
+
+# CHILD PROCESS FORKING BEHAVIOR
+# This option determines how Nagios will fork child processes
+# (used to execute system commands and host/service checks). Normally
+# child processes are fork()ed twice, which provides a very high level
+# of isolation from problems. Fork()ing once is probably enough and will
+# save a great deal on CPU usage (in large installs), so you might
+# want to consider using this. If you specify a value here, it will
+# program defaults.
+# Value: 1 - Child processes fork() twice
+# 0 - Child processes fork() just once
+
+#child_processes_fork_twice=1
+
+
+
+# DEBUG LEVEL
+# This option determines how much (if any) debugging information will
+# be written to the debug file. OR values together to log multiple
+# types of information.
+# Values:
+# -1 = Everything
+# 0 = Nothing
+# 1 = Functions
+# 2 = Configuration
+# 4 = Process information
+# 8 = Scheduled events
+# 16 = Host/service checks
+# 32 = Notifications
+# 64 = Event broker
+# 128 = External commands
+# 256 = Commands
+# 512 = Scheduled downtime
+# 1024 = Comments
+# 2048 = Macros
+
+debug_level=0
+
+
+
+# DEBUG VERBOSITY
+# This option determines how verbose the debug log out will be.
+# Values: 0 = Brief output
+# 1 = More detailed
+# 2 = Very detailed
+
+debug_verbosity=1
+
+
+
+# DEBUG FILE
+# This option determines where Nagios should write debugging information.
+
+debug_file=/var/log/nagios/nagios.debug
+
+
+
+# MAX DEBUG FILE SIZE
+# This option determines the maximum size (in bytes) of the debug file. If
+# the file grows larger than this size, it will be renamed with a .old
+# extension. If a file already exists with a .old extension it will
+# automatically be deleted. This helps ensure your disk space usage doesn't
+# get out of control when debugging Nagios.
+
+max_debug_file_size=1000000
+
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/95fb387b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/nagios.conf.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/nagios.conf.j2 b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/nagios.conf.j2
new file mode 100644
index 0000000..d8936a0
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/NAGIOS/package/templates/nagios.conf.j2
@@ -0,0 +1,62 @@
+# 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.
+#
+
+#
+# SAMPLE CONFIG SNIPPETS FOR APACHE WEB SERVER
+# Last Modified: 11-26-2005
+#
+# This file contains examples of entries that need
+# to be incorporated into your Apache web server
+# configuration file. Customize the paths, etc. as
+# needed to fit your system.
+#
+
+ScriptAlias /nagios/cgi-bin "/usr/lib/nagios/cgi"
+
+<Directory "/usr/lib/nagios/cgi">
+# SSLRequireSSL
+ Options ExecCGI
+ AllowOverride None
+ Order allow,deny
+ Allow from all
+# Order deny,allow
+# Deny from all
+# Allow from 127.0.0.1
+ AuthName "Nagios Access"
+ AuthType Basic
+ AuthUserFile /etc/nagios/htpasswd.users
+ Require valid-user
+</Directory>
+
+Alias /nagios "/usr/share/nagios"
+
+<Directory "/usr/share/nagios">
+# SSLRequireSSL
+ Options None
+ AllowOverride None
+ Order allow,deny
+ Allow from all
+# Order deny,allow
+# Deny from all
+# Allow from 127.0.0.1
+ AuthName "Nagios Access"
+ AuthType Basic
+ AuthUserFile /etc/nagios/htpasswd.users
+ Require valid-user
+</Directory>
+