git.lirion.de

Of git, get, and gud

summaryrefslogtreecommitdiffstats
path: root/nagios-plugins-contrib-24.20190301~bpo9+1/extras
diff options
context:
space:
mode:
Diffstat (limited to 'nagios-plugins-contrib-24.20190301~bpo9+1/extras')
-rw-r--r--nagios-plugins-contrib-24.20190301~bpo9+1/extras/Makefile16
-rw-r--r--nagios-plugins-contrib-24.20190301~bpo9+1/extras/check_apt.cmd25
-rw-r--r--nagios-plugins-contrib-24.20190301~bpo9+1/extras/control7
-rw-r--r--nagios-plugins-contrib-24.20190301~bpo9+1/extras/copyright20
-rwxr-xr-xnagios-plugins-contrib-24.20190301~bpo9+1/extras/send_nsca_host_or_service_check_result86
5 files changed, 154 insertions, 0 deletions
diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/extras/Makefile b/nagios-plugins-contrib-24.20190301~bpo9+1/extras/Makefile
new file mode 100644
index 0000000..8563418
--- /dev/null
+++ b/nagios-plugins-contrib-24.20190301~bpo9+1/extras/Makefile
@@ -0,0 +1,16 @@
+#!/usr/bin/make -f
+
+DM_DIR=/usr/share/icinga/plugins/eventhandlers/distributed-monitoring/
+MULTI_DIR=/etc/check_multi
+
+all:
+ #nothing to do.
+
+install:
+ install -d $(DESTDIR)$(MULTI_DIR)
+ install -m 644 -o root -g root check_apt.cmd $(DESTDIR)$(MULTI_DIR)
+ install -d $(DESTDIR)$(DM_DIR)
+ install -m 755 -o root -g root send_nsca_host_or_service_check_result $(DESTDIR)$(DM_DIR)
+
+clean:
+ # nothing to do.
diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/extras/check_apt.cmd b/nagios-plugins-contrib-24.20190301~bpo9+1/extras/check_apt.cmd
new file mode 100644
index 0000000..aeb8d09
--- /dev/null
+++ b/nagios-plugins-contrib-24.20190301~bpo9+1/extras/check_apt.cmd
@@ -0,0 +1,25 @@
+# check_multi command file implementing a
+# check_apt replacement
+#
+# example nrpe.cfg config:
+# command[check_apt]=/usr/lib/nagios/plugins/check_multi -f /etc/check_multi/check_apt.cmd
+#
+# requirements:
+# - moreutils
+# - the following sudo permissions:
+# nagios ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/check_libs
+# nagios ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/check_running_kernel
+# - cronjobs running update-apt-status and update-check_libs-status:
+# @hourly root [ -x /usr/lib/nagios/cronjobs/update-apt-status ] && /usr/lib/nagios/cronjobs/update-apt-status 2>&1 | logger -t update-apt-status
+# @hourly root [ -x /usr/lib/nagios/cronjobs/update-check_libs-status ] && /usr/lib/nagios/cronjobs/update-check_libs-status 2>&1 | logger -t update-check_libs-status
+
+
+
+command[ packages ] = mispipe "/usr/lib/nagios/plugins/check_statusfile /var/cache/nagios_status/apt" "sed -n '1p;\$p' | paste -s -d ''"
+command[ libs ] = /usr/lib/nagios/plugins/check_statusfile /var/cache/nagios_status/check_libs
+command[ running_kernel ] = sudo /usr/lib/nagios/plugins/check_running_kernel
+
+
+state [ CRITICAL ] = COUNT(CRITICAL) > 0
+state [ WARNING ] = COUNT(WARNING) > 0
+state [ UNKNOWN ] = COUNT(UNKNOWN) > 0
diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/extras/control b/nagios-plugins-contrib-24.20190301~bpo9+1/extras/control
new file mode 100644
index 0000000..16e65d4
--- /dev/null
+++ b/nagios-plugins-contrib-24.20190301~bpo9+1/extras/control
@@ -0,0 +1,7 @@
+Suggests: nsca-client
+Version: 1
+Uploaders: Bernd Zeimetz <bzed@debian.org>
+Suggests: nagios-plugin-check-multi, moreutils
+Description: various scripts and extras
+ Not a plugin, but a collection of various useful
+ event/obsession handlers and similar scripts.
diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/extras/copyright b/nagios-plugins-contrib-24.20190301~bpo9+1/extras/copyright
new file mode 100644
index 0000000..e42c816
--- /dev/null
+++ b/nagios-plugins-contrib-24.20190301~bpo9+1/extras/copyright
@@ -0,0 +1,20 @@
+
+send_nsca_host_or_service_check_result:
+
+ Based on the example in the icinga documentation.
+ Enhanced to handle service and host checks by
+ Bernd Zeimetz <bzed@debian.org>.
+
+ Copyright (c) 1999-2009 Ethan Galstad (nagios@nagios.org)
+ Copyright (c) 2009-2010 Icinga Development Team (info@icinga.org)
+ Copyright (c) 2012 Bernd Zeimetz <bzed@debian.org>
+
+ License:
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2 as
+ published by the Free Software Foundation.
+
+ On Debian systems, the complete text of the GNU General Public
+ License, version 2, can be found in /usr/share/common-licenses/GPL-2.
+
diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/extras/send_nsca_host_or_service_check_result b/nagios-plugins-contrib-24.20190301~bpo9+1/extras/send_nsca_host_or_service_check_result
new file mode 100755
index 0000000..b634a25
--- /dev/null
+++ b/nagios-plugins-contrib-24.20190301~bpo9+1/extras/send_nsca_host_or_service_check_result
@@ -0,0 +1,86 @@
+#!/bin/bash
+
+
+# Enhanced version of the send_nsca wrappers to handle service and host checks.
+# Allows to specify the nsca host and send_nsca config file in the command definition.
+
+#define command{
+# command_name obsessive_host_handler
+# command_line /usr/share/icinga/plugins/eventhandlers/distributed-monitoring/send_nsca_host_or_service_check_result '$_HOSTOCHP_HOST$' '$_HOSTOCHP_CONFIG$' '$HOSTNAME$' '$HOSTSTATE$' '$HOSTOUTPUT$\\n$LONGHOSTOUTPUT$|$HOSTPERFDATA$'
+#}
+
+#define command{
+# command_name obsessive_service_handler
+# command_line /usr/share/icinga/plugins/eventhandlers/distributed-monitoring/send_nsca_host_or_service_check_result '$_SERVICEOCSP_HOST$' '$_SERVICEOCSP_CONFIG$' '$HOSTNAME$' '$SERVICEDESC$' '$SERVICESTATE$' '$SERVICEOUTPUT$\\n$LONGSERVICEOUTPUT$|$SERVICEPERFDATA$'
+#}
+
+
+
+NSCA_HOST="$1"
+shift
+SEND_NSCA_CFG="$1"
+shift
+
+# Service check
+# Arguments:
+# $1 = host_name (Short name of host that the service is
+# associated with)
+# $2 = svc_description (Description of the service)
+# $3 = state_string (A string representing the status of
+# the given service - "OK", "WARNING", "CRITICAL"
+# or "UNKNOWN")
+# $4 = plugin_output (A text string that should be used
+# as the plugin output for the service checks)
+#
+
+# Host check
+# Arguments:
+# $1 = host_name (Short name of host that the service is
+# associated with)
+# $2 = state_string (A string representing the status of
+# the given service - "OK", "WARNING", "CRITICAL"
+# or "UNKNOWN")
+# $3 = plugin_output (A text string that should be used
+# as the plugin output for the service checks)
+#
+
+HOSTNAME="$1"
+shift
+
+if [ $# -eq 3 ]; then
+ # we have a service check
+ # append service name to target.
+ SERVICE="${1}"
+ shift
+fi
+
+# Convert the state string to the corresponding return code
+RETURN_CODE=-1
+
+case "$1" in
+ OK|UP)
+ RETURN_CODE=0
+ ;;
+ WARNING)
+ RETURN_CODE=1
+ ;;
+ CRITICAL|DOWN)
+ RETURN_CODE=2
+ ;;
+ UNKNOWN|UNREACHABLE)
+ RETURN_CODE=3
+ ;;
+esac
+
+shift
+
+# pipe the service check info into the send_nsca program, which
+# in turn transmits the data to the nsca daemon on the central
+# monitoring server
+
+if [ -n "${SERVICE}" ]; then
+ /usr/bin/printf "%s\t%s\t%s\t%s\n" "${HOSTNAME}" "${SERVICE}" "$RETURN_CODE" "$1"
+else
+ /usr/bin/printf "%s\t%s\t%s\n" "${HOSTNAME}" "$RETURN_CODE" "$1"
+fi | /usr/sbin/send_nsca -H ${NSCA_HOST} -c ${SEND_NSCA_CFG}
+