From dc54b0930e377cca55527d7298ddbc9ab123ba36 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 9 Feb 2007 13:59:02 +0000 Subject: [PATCH 001/205] [svn-inject] Applying Debian modifications to trunk --- debian/README.Debian | 263 +++++++++++++++++++++++++++ debian/changelog | 5 + debian/compat | 1 + debian/control | 15 ++ debian/copyright | 30 +++ debian/docs | 1 + debian/pluginconfig/snmp_cpfw.cfg | 8 + debian/pluginconfig/snmp_env.cfg | 20 ++ debian/pluginconfig/snmp_int.cfg | 20 ++ debian/pluginconfig/snmp_load.cfg | 20 ++ debian/pluginconfig/snmp_mem.cfg | 20 ++ debian/pluginconfig/snmp_process.cfg | 15 ++ debian/pluginconfig/snmp_storage.cfg | 20 ++ debian/pluginconfig/snmp_vrrp.cfg | 20 ++ debian/pluginconfig/snmp_win.cfg | 8 + debian/postinst | 21 +++ debian/postrm.in | 17 ++ debian/rules | 66 +++++++ debian/watch | 2 + 19 files changed, 572 insertions(+) create mode 100644 debian/README.Debian create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/docs create mode 100644 debian/pluginconfig/snmp_cpfw.cfg create mode 100644 debian/pluginconfig/snmp_env.cfg create mode 100644 debian/pluginconfig/snmp_int.cfg create mode 100644 debian/pluginconfig/snmp_load.cfg create mode 100644 debian/pluginconfig/snmp_mem.cfg create mode 100644 debian/pluginconfig/snmp_process.cfg create mode 100644 debian/pluginconfig/snmp_storage.cfg create mode 100644 debian/pluginconfig/snmp_vrrp.cfg create mode 100644 debian/pluginconfig/snmp_win.cfg create mode 100644 debian/postinst create mode 100644 debian/postrm.in create mode 100755 debian/rules create mode 100644 debian/watch diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 0000000..eecf2e6 --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,263 @@ +nagios-snmp-plugins for Debian +------------------------------ + + If you are using snmp v1 and v2c, you can provide your community as last + argument with your check_command. So you can specify different communities + for different services. With snmp v3 you need to set $USER9$ like shown in + the config snipsets in your resource.cfg or you need to modify your + command definitions! + + See http://www.manubulon.com/nagios/index_commands.html#snmplogin + and http://www.manubulon.com/nagios/index_info.html#snmplogin + + -- Jan Wagner Fri, 26 Jan 2007 16:32:47 +0100 + + These snipsets are dumped from nagios-snmp-plugins website. + Look at and + for more (actual) info! + + Here are commands example to use the scripts with nagios. + + All these commands use $USER$ macros to put snmp login. You + have to do this for these examples to work. + The $USER$ macro are defined in the resources.cfg file + + If you are using snmp v1 : + $USER7$=-C + + If you are using snmp v2c : + $USER7$=-C -2 + + Examples of snmp v3 login : + AuthNoPriv (md5) : + $USER8$=-l -x + + AuthPriv (md5,aes) : + $USER8$=-l -x -X -L md5,aes + + About regular expressions + + With all these scripts, when you select an interface, a service or process name + etc... you use by default regular expresions : + Note : you can disable this by using "-r" + + Examples : Don't forget it is perl regular expressions. + Regexp Will match + eth eth0, eth1, eth2 but also Fastethernet0/0 .... + eth[1-9] eth1, eth2, ... eth9 but also eth10, eth11 + eth[1-2]$ eth1, eth2 only (not eth11 for ex). + dhcp dhcpc, dhpcd + +* check_snmp_cpfw.pl + + define command { + command_name check_snmp_cpfw_v3 + command_line $USER1$/check_snmp_cpfw.pl -H $HOSTADDRESS$ $USER8$ + $ARG1$ + } + + define service { + name checkpoint_verification + check_command check_snmp_cpfw_v3!-swa -p Solsoft_Policy \ + -c 100000,200000 -f + } + +* check_snmp_load.pl + + define command { + command_name check_snmp_load_v1 + command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ $USER7$ -T + $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ + } + + define command { + command_name check_snmp_load_v3 + command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ $USER8$ -T + $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ + } + + define service { + name bluecoat_load + check_command check_snmp_load_v1!bc!95!99 + } + + define service { + name Linux_load + check_command check_snmp_load_v1!netsl!4,3,3!8,5,5 + } + + define service { + name Cisco_load + check_command check_snmp_load_v1!cisco!90,80,60!100,100,100 + } + + define service { + name lp_load + check_command check_snmp_load_v1!lp!90!99 + } + +* check_snmp_interface.pl + + define command { + command_name check_snmp_int_v1 + command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ $USER7$ -n + $ARG1$ $ARG2$ + } + + define command{ + command_name check_snmp_int_v3 + command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ $USER8$ -n + $ARG1$ $ARG2$ + } + + define service { + name check_int_1_6 + check_command check_snmp_int_v1!"FastEthernet-[1-6]" + } + + define service { + name check_int_eth0_bdw + check_command check_snmp_int_v3!eth0!-k -w 100,50 -c 0,0 + } + +* check_snmp_mem.pl + + define command { + command_name check_snmp_mem_v1 + command_line $USER1$/check_snmp_mem.pl -H $HOSTADDRESS$ $USER7$ $ARG1$ + -w $ARG2$ -c $ARG3$ $ARG4$ + } + + define command { + command_name check_snmp_mem_v3 + command_line $USER1$/check_snmp_mem.pl -H $HOSTADDRESS$ $USER8$ $ARG1$ + -w $ARG2$ -c $ARG3$ $ARG4$ + } + + define service { + name Linux_memory + check_command check_snmp_mem_v1!-N!95,60!99,90 + } + + define service { + name Cisco_mem + check_command check_snmp_mem_v1!-I!80!99 + } + +* check_snmp_process.pl + + define command { + command_name check_snmp_process_v1 + command_line $USER1$/check_snmp_process.pl -H $HOSTADDRESS$ $USER7$ -n + $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ + } + + define service { + name proxy_checks + check_command check_snmp_process_v1!proxy!21,1999!20,2000!-2 + } + + define service { + name Check_httpd_all + check_command check_snmp_process_v1!httpd!5,100!0!-2 -m 20,30 -u 90,99 + } + + define service { + name check_crontab + service_description Check Crontab service + check_command check_snmp_process!crond!0!0 + } + +* check_snmp_storage.pl + + define command { + command_name check_snmp_storage_v1 + command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ $USER7$ -m + $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ + } + + define command { + command_name check_snmp_storage_v3 + command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ $USER8$ -m + $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ + } + + define service { + name Check_LinDisk_home + service_description Check /home + check_command check_snmp_storage_v3!/home!90!97!-r + } + + define service { + name Win_check_swap + service_description Check Windows swap + check_command check_snmp_storage_v3!Virtual!60!90 + } + + define service { + name check_linux_swap + service_description Check swap linux + check_command check_snmp_storage_v1!Swap!60!90! + } + + define service { + name check_disk_all + service_description Check / /opt /var /config + check_command check_snmp_storage_v1!"^/$|opt|config|var"!80!90! + } + +* check_snmp_vrrp.pl + + define command { + command_name check_snmp_vrrp_v1 + command_line $USER1$/check_snmp_vrrp.pl -H $HOSTADDRESS$ $USER7$ -T + $ARG1$ -s $ARG2$ + } + + define command { + command_name check_snmp_vrrp_v3 + command_line $USER1$/check_snmp_vrrp.pl -H $HOSTADDRESS$ $USER8$ -T + $ARG1$ -s $ARG2$ + } + + define service { + name Linkproof_check_vrrp_master + service_description Check vrrp in master state + check_command check_snmp_vrrp_v3!lp!master + } + + define service { + name Linkproof_check_vrrp_backup + service_description Check vrrp in backup state + check_command check_snmp_vrrp_v3!lp!backup + } + + define service { + name Nokia_clustering + check_command check_snmp_vrrp_v3!ipso!2,98% + } + +* check_snmp_win.pl + + define command { + command_name check_win + command_line $USER1$/check_snmp_win.pl -H $HOSTADDRESS$ $USER7$ -n + $ARG2$ + # comment community service(s) name + } + + define service { + name check_win_dhcp + service_description Check dhcp service + check_command check_win!dhcp + register 0 + } + + define service { + name check_win_reg_spool + service_description Verification acces au registre en spooleur + check_command check_win!"au registre",spouleur + register 0 + } + + -- Jan Wagner Tue, 5 Dec 2006 11:52:19 +0100 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..94a9e00 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +nagios-snmp-plugins (1.1-1~unreleased.2) unstable; urgency=low + + * Initial release (Closes: #401678). + + -- Jan Wagner Mon, 15 Jan 2007 20:34:19 +0100 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..ea61a8b --- /dev/null +++ b/debian/control @@ -0,0 +1,15 @@ +Source: nagios-snmp-plugins +Section: net +Priority: optional +Maintainer: Jan Wagner +Build-Depends: debhelper (>= 5) +Standards-Version: 3.7.2 + +Package: nagios-snmp-plugins +Architecture: all +Depends: ${perl:Depends}, libnet-snmp-perl, perl-base (>= 5.8.4-8), ucf +Suggests: nagios-plugins-basic (>= 1.4.5-2) +Description: SNMP Plugins for nagios + A set of Nagios plugins to check hosts/devices using snmp protocol + . + Homepage: diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..f4ca66c --- /dev/null +++ b/debian/copyright @@ -0,0 +1,30 @@ +This package was debianized by Jan Wagner on +Tue, 5 Dec 2006 11:52:19 +0100. + +It was downloaded from + +Upstream Author: Patrick Proy (nagios at proy.org) + +Copyright: (C) 2004-2007 Patrick Proy (nagios at proy.org) + +License: + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General Public License +can be found in /usr/share/common-licenses/GPL file. + +The Debian packaging is (C) 2006, 2007 Jan Wagner and +is licensed under the GPL, see `/usr/share/common-licenses/GPL'. diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..e845566 --- /dev/null +++ b/debian/docs @@ -0,0 +1 @@ +README diff --git a/debian/pluginconfig/snmp_cpfw.cfg b/debian/pluginconfig/snmp_cpfw.cfg new file mode 100644 index 0000000..27810ab --- /dev/null +++ b/debian/pluginconfig/snmp_cpfw.cfg @@ -0,0 +1,8 @@ +# check point firewall template, for more info see: +# http://www.manubulon.com/nagios/index_commands.html#cpfw + +# 'check_snmp_cpfw_v3' command definition +define command { + command_name check_snmp_cpfw_v3 + command_line $USER1$/check_snmp_cpfw.pl -H $HOSTADDRESS$ $USER9$ $ARG1$ +} diff --git a/debian/pluginconfig/snmp_env.cfg b/debian/pluginconfig/snmp_env.cfg new file mode 100644 index 0000000..1ab7d98 --- /dev/null +++ b/debian/pluginconfig/snmp_env.cfg @@ -0,0 +1,20 @@ +# system environment check template, for more see: +# http://www.manubulon.com/nagios/index_commands.html#env + +# 'check_snmp_env_v1' command definition +define command { + command_name check_snmp_env_v1 + command_line $USER1$/check_snmp_env.pl -H $HOSTADDRESS$ -C $ARG3$ -T $ARG1$ $ARG2$ +} + +# 'check_snmp_env_v2' command definition +define command { + command_name check_snmp_env_v2 + command_line $USER1$/check_snmp_env.pl -H $HOSTADDRESS$ -C $ARG3$ -2 -T $ARG1$ $ARG2$ +} + +# 'check_snmp_env_v3' command definition +define command { + command_name check_snmp_env_v3 + command_line $USER1$/check_snmp_env.pl -H $HOSTADDRESS$ $USER9$ -T $ARG1$ $ARG2$ +} diff --git a/debian/pluginconfig/snmp_int.cfg b/debian/pluginconfig/snmp_int.cfg new file mode 100644 index 0000000..001c860 --- /dev/null +++ b/debian/pluginconfig/snmp_int.cfg @@ -0,0 +1,20 @@ +# (network-) interface check template, for more see: +# http://www.manubulon.com/nagios/index_commands.html#interface + +# 'check_snmp_int_v1' command definition +define command { + command_name check_snmp_int_v1 + command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ -C $ARG3$ -n $ARG1$ $ARG2$ +} + +# 'check_snmp_int_v2' command definition +define command { + command_name check_snmp_int_v2 + command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ -C $ARG3$ -2 -n $ARG1$ $ARG2$ +} + +# 'check_snmp_int_v3' command definition +define command{ + command_name check_snmp_int_v3 + command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ $USER9$ -n $ARG1$ $ARG2$ +} diff --git a/debian/pluginconfig/snmp_load.cfg b/debian/pluginconfig/snmp_load.cfg new file mode 100644 index 0000000..f291d07 --- /dev/null +++ b/debian/pluginconfig/snmp_load.cfg @@ -0,0 +1,20 @@ +# system load check template, for more see: +# http://www.manubulon.com/nagios/index_commands.html#load + +# 'check_snmp_load_v1' command definition +define command { + command_name check_snmp_load_v1 + command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ -C $ARG5$ -T $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ +} + +# 'check_snmp_load_v2' command definition +define command { + command_name check_snmp_load_v2 + command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ -C $ARG5$ -2 -T $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ +} + +# 'check_snmp_load_v3' command definition +define command { + command_name check_snmp_load_v3 + command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ $USER9$ -T $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ +} diff --git a/debian/pluginconfig/snmp_mem.cfg b/debian/pluginconfig/snmp_mem.cfg new file mode 100644 index 0000000..8fb3f29 --- /dev/null +++ b/debian/pluginconfig/snmp_mem.cfg @@ -0,0 +1,20 @@ +# system memory check template, for more see: +# http://www.manubulon.com/nagios/index_commands.html#mem + +# 'check_snmp_mem_v1' command definition +define command { + command_name check_snmp_mem_v1 + command_line $USER1$/check_snmp_mem.pl -H $HOSTADDRESS$ -C $ARG5$ $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ +} + +# 'check_snmp_mem_v2' command definition +define command { + command_name check_snmp_mem_v2 + command_line $USER1$/check_snmp_mem.pl -H $HOSTADDRESS$ -C $ARG5$ -2 $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ +} + +# 'check_snmp_mem_v3' command definition +define command { + command_name check_snmp_mem_v3 + command_line $USER1$/check_snmp_mem.pl -H $HOSTADDRESS$ $USER9$ $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ +} diff --git a/debian/pluginconfig/snmp_process.cfg b/debian/pluginconfig/snmp_process.cfg new file mode 100644 index 0000000..1ce43e7 --- /dev/null +++ b/debian/pluginconfig/snmp_process.cfg @@ -0,0 +1,15 @@ +# system process check template, for more see: +# http://www.manubulon.com/nagios/index_commands.html#process + +# 'check_snmp_process_v1' command definition +define command { + command_name check_snmp_process_v1 + command_line $USER1$/check_snmp_process.pl -H $HOSTADDRESS$ -C $ARG5$ -n $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ +} + +# 'check_snmp_process_v2' command definition +define command { + command_name check_snmp_process_v2 + command_line $USER1$/check_snmp_process.pl -H $HOSTADDRESS$ -C $ARG5$ -2 -n $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ +} + diff --git a/debian/pluginconfig/snmp_storage.cfg b/debian/pluginconfig/snmp_storage.cfg new file mode 100644 index 0000000..e3df174 --- /dev/null +++ b/debian/pluginconfig/snmp_storage.cfg @@ -0,0 +1,20 @@ +# system storage check template, for more see: +# http://www.manubulon.com/nagios/index_commands.html#storage + +# 'check_snmp_storage_v1' command definition +define command { + command_name check_snmp_storage_v1 + command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ -C $ARG5$ -m $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ +} + +# 'check_snmp_storage_v2' command definition +define command { + command_name check_snmp_storage_v2 + command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ -C $ARG5$ -2 -m $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ +} + +# 'check_snmp_storage_v3' command definition +define command { + command_name check_snmp_storage_v3 + command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ $USER9$ -m $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ +} diff --git a/debian/pluginconfig/snmp_vrrp.cfg b/debian/pluginconfig/snmp_vrrp.cfg new file mode 100644 index 0000000..fb5d5c3 --- /dev/null +++ b/debian/pluginconfig/snmp_vrrp.cfg @@ -0,0 +1,20 @@ +# vrrp check template, for more see: +# http://www.manubulon.com/nagios/index_commands.html#vrrp + +# 'check_snmp_vrrp_v1' command definition +define command { + command_name check_snmp_vrrp_v1 + command_line $USER1$/check_snmp_vrrp.pl -H $HOSTADDRESS$ -C $ARG3$ -T $ARG1$ -s $ARG2$ +} + +# 'check_snmp_vrrp_v2' command definition +define command { + command_name check_snmp_vrrp_v2 + command_line $USER1$/check_snmp_vrrp.pl -H $HOSTADDRESS$ -C $ARG3$ -2 -T $ARG1$ -s $ARG2$ +} + +# 'check_snmp_vrrp_v3' command definition +define command { + command_name check_snmp_vrrp_v3 + command_line $USER1$/check_snmp_vrrp.pl -H $HOSTADDRESS$ $USER9$ -T $ARG1$ -s $ARG2$ +} diff --git a/debian/pluginconfig/snmp_win.cfg b/debian/pluginconfig/snmp_win.cfg new file mode 100644 index 0000000..53fdf84 --- /dev/null +++ b/debian/pluginconfig/snmp_win.cfg @@ -0,0 +1,8 @@ +# windows check template, for more see: +# http://www.manubulon.com/nagios/index_commands.html#windows + +# 'check_win' command definition +define command { + command_name check_win + command_line $USER1$/check_snmp_win.pl -H $HOSTADDRESS$ -C $ARG3$ -n $ARG2$ +} diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..9b5893c --- /dev/null +++ b/debian/postinst @@ -0,0 +1,21 @@ +#!/bin/sh -e + +templdir=/usr/share/nagios-snmp-plugins/pluginconfig + +if [ "$1" = "configure" ]; then + if [ -f /usr/share/nagios-plugins/dpkg/functions ]; then + # only working with nagios-plugins-basic (>= 1.4.5-2) + . /usr/share/nagios-plugins/dpkg/functions + register_cfgs $2 + else + # to get working with etch + ( + cd $templdir + for f in *cfg; do + ucf $f /etc/nagios-plugins/config/$f + done + ); + fi +fi + +#DEBHELPER# diff --git a/debian/postrm.in b/debian/postrm.in new file mode 100644 index 0000000..c2474a7 --- /dev/null +++ b/debian/postrm.in @@ -0,0 +1,17 @@ +#!/bin/sh -e + +PLUGINS="@PLUGINS@" + +if [ "$1" = "purge" ]; then + if which ucf >/dev/null 2>&1; then + have_ucf="yes" + fi + for f in $PLUGINS; do + rm -f /etc/nagios-plugins/config/${f}.cfg + if [ "$have_ucf" = "yes" ]; then + ucf --purge /etc/nagios-plugins/config/${f}.cfg + fi + done +fi + +#DEBHELPER# diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..05800d4 --- /dev/null +++ b/debian/rules @@ -0,0 +1,66 @@ +#!/usr/bin/make -f + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +COMMANDDEFPATH:=/etc/nagios-plugins/config/ +NP_DIR:=debian/nagios-snmp-plugins +NP_TEMPLATES:=$(NP_DIR)/usr/share/nagios-snmp-plugins/pluginconfig +NP_LIBEXEC:=/usr/lib/nagios/plugins + +plugin_cfgs:=snmp_cpfw snmp_env snmp_int snmp_load snmp_mem snmp_process \ + snmp_storage snmp_vrrp snmp_win + +build: + +clean: + dh_testdir + dh_testroot + + dh_clean + -rm -f debian/postrm + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/nagios-snmp-plugins. + for PLUGINS in *.pl; \ + do \ + install -D -m 0755 $$PLUGINS $(NP_DIR)$(NP_LIBEXEC)/$$PLUGINS || exit 1; \ + sed -i "s#/usr/local/nagios/libexec#$(NP_LIBEXEC)#" $(NP_DIR)$(NP_LIBEXEC)/$$PLUGINS || exit 1; \ + done + # copying templates them into seperate "template" directories outside of + # /usr/share/doc for ucf to use. + install -d $(NP_DIR)/usr/share/nagios-snmp-plugins/pluginconfig + for c in ${plugin_cfgs}; do \ + cp debian/pluginconfig/$${c}.cfg ${NP_TEMPLATES}; \ + done + # here the list of config templates are writen to postrm + sed -e 's/@PLUGINS@/${plugin_cfgs}/' \ + < debian/postrm.in \ + > debian/postrm + +# Build architecture-independent files here. +binary-indep: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_link + dh_compress + dh_fixperms + dh_perl + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb + +# Build architecture-dependent files here. +binary-arch: build install +# We have nothing to do for now. + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..ac77c66 --- /dev/null +++ b/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://www.manubulon.com/nagios/nagios-snmp-plugins\.(.*)\.tgz debian uupdate From 98b23393b973bf316d6d6164e20c7f9a3c892723 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sat, 10 Feb 2007 11:22:23 +0000 Subject: [PATCH 002/205] set maintainer to nagios team, add uploader and ${misc:Depends} to deps --- debian/control | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/debian/control b/debian/control index ea61a8b..3eb3cd6 100644 --- a/debian/control +++ b/debian/control @@ -1,13 +1,14 @@ Source: nagios-snmp-plugins Section: net Priority: optional -Maintainer: Jan Wagner +Maintainer: Debian Nagios Maintainer Group +Uploaders: Jan Wagner Build-Depends: debhelper (>= 5) Standards-Version: 3.7.2 Package: nagios-snmp-plugins Architecture: all -Depends: ${perl:Depends}, libnet-snmp-perl, perl-base (>= 5.8.4-8), ucf +Depends: ${perl:Depends}, ${misc:Depends}, libnet-snmp-perl, perl-base (>= 5.8.4-8), ucf Suggests: nagios-plugins-basic (>= 1.4.5-2) Description: SNMP Plugins for nagios A set of Nagios plugins to check hosts/devices using snmp protocol From c51122cb398e048b72d8ac0624d9c0fda203e0bf Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sat, 10 Feb 2007 11:22:46 +0000 Subject: [PATCH 003/205] add exit 0 and remove whitespace --- debian/postinst | 2 ++ debian/postrm.in | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/debian/postinst b/debian/postinst index 9b5893c..7db878e 100644 --- a/debian/postinst +++ b/debian/postinst @@ -19,3 +19,5 @@ if [ "$1" = "configure" ]; then fi #DEBHELPER# + +exit 0 diff --git a/debian/postrm.in b/debian/postrm.in index c2474a7..c4dcc12 100644 --- a/debian/postrm.in +++ b/debian/postrm.in @@ -11,7 +11,9 @@ if [ "$1" = "purge" ]; then if [ "$have_ucf" = "yes" ]; then ucf --purge /etc/nagios-plugins/config/${f}.cfg fi - done + done fi #DEBHELPER# + +exit 0 From 6e2485ae653e6322ef2dbe794c18bacc497b46c9 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sat, 10 Feb 2007 11:23:52 +0000 Subject: [PATCH 004/205] cosmetic fixes --- debian/README.Debian | 7 ++----- debian/changelog | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/debian/README.Debian b/debian/README.Debian index eecf2e6..e5092c7 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -10,10 +10,8 @@ nagios-snmp-plugins for Debian See http://www.manubulon.com/nagios/index_commands.html#snmplogin and http://www.manubulon.com/nagios/index_info.html#snmplogin - -- Jan Wagner Fri, 26 Jan 2007 16:32:47 +0100 - These snipsets are dumped from nagios-snmp-plugins website. - Look at and + Look at and for more (actual) info! Here are commands example to use the scripts with nagios. @@ -259,5 +257,4 @@ nagios-snmp-plugins for Debian check_command check_win!"au registre",spouleur register 0 } - - -- Jan Wagner Tue, 5 Dec 2006 11:52:19 +0100 + -- Jan Wagner Fri, 26 Jan 2007 16:32:47 +0100 diff --git a/debian/changelog b/debian/changelog index 94a9e00..c1e3701 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -nagios-snmp-plugins (1.1-1~unreleased.2) unstable; urgency=low +nagios-snmp-plugins (1.1-1) unstable; urgency=low * Initial release (Closes: #401678). From b7ee03321444be4e84d3c1950c214b359dbcd163 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sat, 10 Feb 2007 11:24:27 +0000 Subject: [PATCH 005/205] cosmetic fixes --- debian/copyright | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/copyright b/debian/copyright index f4ca66c..2b73896 100644 --- a/debian/copyright +++ b/debian/copyright @@ -26,5 +26,5 @@ License: On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL file. -The Debian packaging is (C) 2006, 2007 Jan Wagner and +The Debian packaging is (C) 2006-2007 Jan Wagner and is licensed under the GPL, see `/usr/share/common-licenses/GPL'. From 24c12a6a5e6d4fd2f8b261a229add9a7742adcb5 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 25 Apr 2007 20:03:25 +0000 Subject: [PATCH 006/205] new upstream release (1.1.1) --- debian/changelog | 7 +++++++ debian/rules | 3 +++ 2 files changed, 10 insertions(+) diff --git a/debian/changelog b/debian/changelog index c1e3701..c633810 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +nagios-snmp-plugins (1.1.1-1) unstable; urgency=low + + * new upstream + * include (new) html docs into package + + -- Jan Wagner Wed, 25 Apr 2007 22:00:50 +0200 + nagios-snmp-plugins (1.1-1) unstable; urgency=low * Initial release (Closes: #401678). diff --git a/debian/rules b/debian/rules index 05800d4..6e83254 100755 --- a/debian/rules +++ b/debian/rules @@ -42,6 +42,9 @@ install: build sed -e 's/@PLUGINS@/${plugin_cfgs}/' \ < debian/postrm.in \ > debian/postrm + # copy html documentation over + install -d $(NP_DIR)/usr/share/doc/nagios-snmp-plugins/html/ + cp doc/* $(NP_DIR)/usr/share/doc/nagios-snmp-plugins/html/ # Build architecture-independent files here. binary-indep: build install From 2a97354a0b2f22785f29d01feb917c4068cf5fd3 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 6 Jul 2007 20:34:17 +0000 Subject: [PATCH 007/205] add dpatch infrastructure --- debian/control | 2 +- debian/patches/00list | 1 + debian/patches/01_check_snmp_env.dpatch | 133 ++++++++++++++++++++++++ debian/rules | 6 +- 4 files changed, 139 insertions(+), 3 deletions(-) create mode 100644 debian/patches/00list create mode 100644 debian/patches/01_check_snmp_env.dpatch diff --git a/debian/control b/debian/control index 3eb3cd6..7654d63 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: net Priority: optional Maintainer: Debian Nagios Maintainer Group Uploaders: Jan Wagner -Build-Depends: debhelper (>= 5) +Build-Depends: debhelper (>= 5), dpatch Standards-Version: 3.7.2 Package: nagios-snmp-plugins diff --git a/debian/patches/00list b/debian/patches/00list new file mode 100644 index 0000000..edb5355 --- /dev/null +++ b/debian/patches/00list @@ -0,0 +1 @@ +01_check_snmp_env.dpatch diff --git a/debian/patches/01_check_snmp_env.dpatch b/debian/patches/01_check_snmp_env.dpatch new file mode 100644 index 0000000..9fcd9f6 --- /dev/null +++ b/debian/patches/01_check_snmp_env.dpatch @@ -0,0 +1,133 @@ +#!/bin/sh /usr/share/dpatch/dpatch-run +## 01_check_snmp_env.dpatch by Jan Wagner +## +## DP: Fix some issues via cvs version + +@DPATCH@ + +--- old/check_snmp_env.pl 2007-07-04 09:46:55.000000000 +0200 ++++ new/check_snmp_env.pl 2007-07-06 22:17:06.000000000 +0200 +@@ -1,7 +1,7 @@ + #!/usr/bin/perl -w + ############################## check_snmp_env ################# +-# Version : 1.2 +-# Date : April 19 2007 ++# Version : 1.3 ++# Date : May 24 2007 + # Author : Patrick Proy ( patrick at proy.org) + # Help : http://www.manubulon.com/nagios/ + # Licence : GPL - http://www.fsf.org/licenses/gpl.txt +@@ -145,9 +145,24 @@ + + my @foundry_status = (3,0,2); # oper status : 1:other, 2: Normal, 3: Failure + ++# Linux Net-SNMP with LM-SENSORS ++my $linux_temp = "1.3.6.1.4.1.2021.13.16.2.1"; # temperature table ++my $linux_temp_descr = "1.3.6.1.4.1.2021.13.16.2.1.2"; # temperature entry description ++my $linux_temp_value = "1.3.6.1.4.1.2021.13.16.2.1.3"; # temperature entry value (mC) ++my $linux_fan = "1.3.6.1.4.1.2021.13.16.3.1"; # fan table ++my $linux_fan_descr = "1.3.6.1.4.1.2021.13.16.3.1.2"; # fan entry description ++my $linux_fan_value = "1.3.6.1.4.1.2021.13.16.3.1.3"; # fan entry value (RPM) ++my $linux_volt = "1.3.6.1.4.1.2021.13.16.4.1"; # voltage table ++my $linux_volt_descr = "1.3.6.1.4.1.2021.13.16.4.1.2"; # voltage entry description ++my $linux_volt_value = "1.3.6.1.4.1.2021.13.16.4.1.3"; # voltage entry value (mV) ++my $linux_misc = "1.3.6.1.4.1.2021.13.16.4.1"; # misc table ++my $linux_misc_descr = "1.3.6.1.4.1.2021.13.16.4.1.2"; # misc entry description ++my $linux_misc_value = "1.3.6.1.4.1.2021.13.16.4.1.3"; # misc entry value ++ ++ + # Globals + +-my $Version='1.2'; ++my $Version='1.3'; + + my $o_host = undef; # hostname + my $o_community = undef; # community +@@ -160,7 +175,7 @@ + my $o_version2= undef; # use snmp v2c + # check type + my $o_check_type= "cisco"; # default Cisco +-my @valid_types =("cisco","nokia","bc","iron","foundry"); ++my @valid_types =("cisco","nokia","bc","iron","foundry","linux"); + my $o_temp= undef; # max temp + my $o_fan= undef; # min fan speed + +@@ -177,7 +192,7 @@ + sub p_version { print "check_snmp_env version : $Version\n"; } + + sub print_usage { +- print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -T (cisco|nokia|bc|iron|foundry) [-F ] [-c ] [-f] [-t ] [-V]\n"; ++ print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -T (cisco|nokia|bc|iron|foundry|linux) [-F ] [-c ] [-f] [-t ] [-V]\n"; + } + + sub isnnum { # Return true if arg is not a number +@@ -221,17 +236,18 @@ + -P, --port=PORT + SNMP port (Default 161) + -T, --type=cisco|nokia|bc|iron|foundry +- Environemental check : +- cisco : voltage,temp,fan,power supply status +- will try to check everything present +- nokia : fan and power supply +- bc : fans, power supply, voltage, disks +- iron : fans, power supply, temp +- foundry : power supply, temp ++ Environemental check : ++ cisco : All Cisco equipements : voltage,temp,fan,power supply ++ (will try to check everything in the env mib) ++ nokia : Nokia IP platforms : fan and power supply ++ bc : BlueCoat platforms : fans, power supply, voltage, disks ++ iron : IronPort platforms : fans, power supply, temp ++ foundry : Foundry Network platforms : power supply, temp ++ linux : Net-SNMP with LM-SENSORS : temp, fan, volt, misc + -F, --fan= +- Minimum fan rpm value ++ Minimum fan rpm value (only needed for 'iron' & 'linux') + -c, --celcius= +- Maximum temp in degree celcius ++ Maximum temp in degree celcius (only needed for 'iron' & 'linux') + -f, --perfparse + Perfparse compatible output + -t, --timeout=INTEGER +@@ -428,8 +444,10 @@ + if (!defined ($cur_status)) { ### Error TODO + $volt_global=1; + } +- $perf_output.=" '".$$resultat{$ciscoVoltageTableDesc .".".$voltindex[$i]}."'=" ; +- $perf_output.=$$resultat{$ciscoVoltageTableValue."." . $voltindex[$i]}; ++ if (defined($$resultat{$ciscoVoltageTableValue."." . $voltindex[$i]})) { ++ $perf_output.=" '".$$resultat{$ciscoVoltageTableDesc .".".$voltindex[$i]}."'=" ; ++ $perf_output.=$$resultat{$ciscoVoltageTableValue."." . $voltindex[$i]}; ++ } + if ($Nagios_state[$CiscoEnvMonNagios{$cur_status}] ne "OK") { + $volt_global= 1; + $volt_status{$$resultat{$ciscoVoltageTableDesc .".".$voltindex[$i]}}=$cur_status; +@@ -448,8 +466,10 @@ + if (!defined ($cur_status)) { ### Error TODO + $temp_global=1; + } +- $perf_output.=" '".$$resultat{$ciscoTempTableDesc .".".$tempindex[$i]}."'=" ; +- $perf_output.=$$resultat{$ciscoTempTableValue."." . $tempindex[$i]}; ++ if (defined($$resultat{$ciscoTempTableValue."." . $tempindex[$i]})) { ++ $perf_output.=" '".$$resultat{$ciscoTempTableDesc .".".$tempindex[$i]}."'=" ; ++ $perf_output.=$$resultat{$ciscoTempTableValue."." . $tempindex[$i]}; ++ } + if ($Nagios_state[$CiscoEnvMonNagios{$cur_status}] ne "OK") { + $temp_global= 1; + $temp_status{$$resultat{$ciscoTempTableDesc .".".$tempindex[$i]}}=$cur_status; +@@ -1003,4 +1023,14 @@ + + } + +-exit (3); ++########### Cisco env checks ############## ++if ($o_check_type eq "linux") { ++ ++ verb("Checking linux env"); ++ ++ print "Not implemented yet : UNKNOWN\n"; ++ exit $ERRORS{"UNKNOWN"}; ++} ++ ++print "Unknown check type : UNKNOWN\n"; ++exit $ERRORS{"UNKNOWN"}; diff --git a/debian/rules b/debian/rules index 6e83254..c5fdedd 100755 --- a/debian/rules +++ b/debian/rules @@ -3,6 +3,8 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 +include /usr/share/dpatch/dpatch.make + COMMANDDEFPATH:=/etc/nagios-plugins/config/ NP_DIR:=debian/nagios-snmp-plugins NP_TEMPLATES:=$(NP_DIR)/usr/share/nagios-snmp-plugins/pluginconfig @@ -11,9 +13,9 @@ NP_LIBEXEC:=/usr/lib/nagios/plugins plugin_cfgs:=snmp_cpfw snmp_env snmp_int snmp_load snmp_mem snmp_process \ snmp_storage snmp_vrrp snmp_win -build: +build: patch-stamp -clean: +clean: unpatch dh_testdir dh_testroot From f0b4e079cdd491b668bd7a970d27fff85b847e2c Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 6 Jul 2007 20:35:00 +0000 Subject: [PATCH 008/205] update changelog --- debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index c633810..084a979 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +nagios-snmp-plugins (1.1.1-2) unstable; urgency=low + + * make use of dpatch infrastructure + * include a fix for check_snmp_env.pl from cvs + + -- Jan Wagner Fri, 6 Jul 2007 22:22:02 +0200 + nagios-snmp-plugins (1.1.1-1) unstable; urgency=low * new upstream From 0924c1761ca35df802d94d19789c18c446fa5a61 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 9 Jul 2007 13:20:09 +0000 Subject: [PATCH 009/205] change scale and unit of check_snmp_int.pl --- debian/changelog | 7 +++++++ debian/pluginconfig/snmp_int.cfg | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 084a979..22cc8e3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +nagios-snmp-plugins (1.1.1-3) UNRELEASED; urgency=low + + * change unit to bit/s in interface check + * add option for scale of bandwidth to interface check + + -- Jan Wagner Fri, 06 Jul 2007 23:25:38 +0200 + nagios-snmp-plugins (1.1.1-2) unstable; urgency=low * make use of dpatch infrastructure diff --git a/debian/pluginconfig/snmp_int.cfg b/debian/pluginconfig/snmp_int.cfg index 001c860..5e0dba6 100644 --- a/debian/pluginconfig/snmp_int.cfg +++ b/debian/pluginconfig/snmp_int.cfg @@ -4,17 +4,17 @@ # 'check_snmp_int_v1' command definition define command { command_name check_snmp_int_v1 - command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ -C $ARG3$ -n $ARG1$ $ARG2$ + command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ -C $ARG3$ -n $ARG1$ -B$ARG4$ $ARG2$ } # 'check_snmp_int_v2' command definition define command { command_name check_snmp_int_v2 - command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ -C $ARG3$ -2 -n $ARG1$ $ARG2$ + command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ -C $ARG3$ -2 -n $ARG1$ -B$ARG4$ $ARG2$ } # 'check_snmp_int_v3' command definition -define command{ +define command { command_name check_snmp_int_v3 - command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ $USER9$ -n $ARG1$ $ARG2$ + command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ $USER9$ -n $ARG1$ -B$ARG4$ $ARG2$ } From 801b91956e7bea0c4c363b12f033f010aac0c8cb Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 9 Dec 2007 22:26:32 +0000 Subject: [PATCH 010/205] update to standards 3.7.3, added Vcs- fields, moved Homepage --- debian/changelog | 4 +++- debian/control | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 22cc8e3..bfb3055 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,8 +2,10 @@ nagios-snmp-plugins (1.1.1-3) UNRELEASED; urgency=low * change unit to bit/s in interface check * add option for scale of bandwidth to interface check + * added Vcs- fields, moved Homepage into source header's field + * bump standards version to 3.7.3 - -- Jan Wagner Fri, 06 Jul 2007 23:25:38 +0200 + -- Jan Wagner Sun, 9 Dec 2007 23:25:38 +0200 nagios-snmp-plugins (1.1.1-2) unstable; urgency=low diff --git a/debian/control b/debian/control index 7654d63..3b5cf1c 100644 --- a/debian/control +++ b/debian/control @@ -4,7 +4,10 @@ Priority: optional Maintainer: Debian Nagios Maintainer Group Uploaders: Jan Wagner Build-Depends: debhelper (>= 5), dpatch -Standards-Version: 3.7.2 +Homepage: http://www.manubulon.com/nagios/index_snmp.html +Vcs-Browser: http://svn.debian.org/wsvn/pkg-nagios/nagios-snmp-plugins/ +Vcs-Svn: svn://svn.debian.org/pkg-nagios/nagios-snmp-plugins/ +Standards-Version: 3.7.3 Package: nagios-snmp-plugins Architecture: all @@ -12,5 +15,3 @@ Depends: ${perl:Depends}, ${misc:Depends}, libnet-snmp-perl, perl-base (>= 5.8.4 Suggests: nagios-plugins-basic (>= 1.4.5-2) Description: SNMP Plugins for nagios A set of Nagios plugins to check hosts/devices using snmp protocol - . - Homepage: From 312ee9887f014ee9843ed7f33ef120d1f44ffae8 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 10 Feb 2008 19:52:57 +0000 Subject: [PATCH 011/205] disable epn default --- debian/changelog | 2 + debian/patches/02_disable_epn.dpatch | 133 +++++++++++++++++++++++++++ 2 files changed, 135 insertions(+) create mode 100644 debian/patches/02_disable_epn.dpatch diff --git a/debian/changelog b/debian/changelog index bfb3055..1799bc5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,8 @@ nagios-snmp-plugins (1.1.1-3) UNRELEASED; urgency=low * add option for scale of bandwidth to interface check * added Vcs- fields, moved Homepage into source header's field * bump standards version to 3.7.3 + * add 02_disable_epn.dpatch to disable epn, since the plugins don't + work with it -- Jan Wagner Sun, 9 Dec 2007 23:25:38 +0200 diff --git a/debian/patches/02_disable_epn.dpatch b/debian/patches/02_disable_epn.dpatch new file mode 100644 index 0000000..509ee87 --- /dev/null +++ b/debian/patches/02_disable_epn.dpatch @@ -0,0 +1,133 @@ +#!/bin/sh /usr/share/dpatch/dpatch-run +## 02_disable_epn.dpatch by Jan Wagner +## +## DP: leave marks to disable epn + +@DPATCH@ + +diff -Nur nagios_plugins.orig/check_snmp_boostedge.pl nagios_plugins/check_snmp_boostedge.pl +--- nagios_plugins.orig/check_snmp_boostedge.pl 2007-01-16 23:57:14.000000000 +0100 ++++ nagios_plugins/check_snmp_boostedge.pl 2008-02-10 20:41:52.345434535 +0100 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_boostedge.pl ################# + # Version : 1.0 + # Date : Jan 16 2007 +diff -Nur nagios_plugins.orig/check_snmp_cpfw.pl nagios_plugins/check_snmp_cpfw.pl +--- nagios_plugins.orig/check_snmp_cpfw.pl 2007-04-20 00:03:30.000000000 +0200 ++++ nagios_plugins/check_snmp_cpfw.pl 2008-02-10 20:42:02.055266874 +0100 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_cpfw ############## + # Version : 1.2.1 + # Date : April 19 2007 +diff -Nur nagios_plugins.orig/check_snmp_css.pl nagios_plugins/check_snmp_css.pl +--- nagios_plugins.orig/check_snmp_css.pl 2007-01-11 17:06:08.000000000 +0100 ++++ nagios_plugins/check_snmp_css.pl 2008-02-10 20:42:10.943113408 +0100 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_css.pl ################# + # Version : 1.0.1 + # Date : 27 Sept 2006 +diff -Nur nagios_plugins.orig/check_snmp_css_main.pl nagios_plugins/check_snmp_css_main.pl +--- nagios_plugins.orig/check_snmp_css_main.pl 2006-10-05 23:40:55.000000000 +0200 ++++ nagios_plugins/check_snmp_css_main.pl 2008-02-10 20:42:19.513965416 +0100 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_css_main.pl ################# + # Version : 1.0 + # Date : 27 Sept 2006 +diff -Nur nagios_plugins.orig/check_snmp_env.pl nagios_plugins/check_snmp_env.pl +--- nagios_plugins.orig/check_snmp_env.pl 2007-04-20 11:45:22.000000000 +0200 ++++ nagios_plugins/check_snmp_env.pl 2008-02-10 20:42:25.912854927 +0100 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_env ################# + # Version : 1.2 + # Date : April 19 2007 +diff -Nur nagios_plugins.orig/check_snmp_int.pl nagios_plugins/check_snmp_int.pl +--- nagios_plugins.orig/check_snmp_int.pl 2007-04-23 11:40:39.000000000 +0200 ++++ nagios_plugins/check_snmp_int.pl 2008-02-10 20:42:33.816718453 +0100 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_int ############## + # Version : 1.4.6 + # Date : April 23 2007 +diff -Nur nagios_plugins.orig/check_snmp_linkproof_nhr.pl nagios_plugins/check_snmp_linkproof_nhr.pl +--- nagios_plugins.orig/check_snmp_linkproof_nhr.pl 2006-08-26 14:37:12.000000000 +0200 ++++ nagios_plugins/check_snmp_linkproof_nhr.pl 2008-02-10 20:42:41.965577749 +0100 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_linkproof_nhr ################# + # Version : 1.0 + # Date : Aug 24 2006 +diff -Nur nagios_plugins.orig/check_snmp_load.pl nagios_plugins/check_snmp_load.pl +--- nagios_plugins.orig/check_snmp_load.pl 2007-04-16 19:41:20.000000000 +0200 ++++ nagios_plugins/check_snmp_load.pl 2008-02-10 20:42:49.700444194 +0100 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_load ################# + # Version : 1.3.2 + # Date : Jan 16 2007 +diff -Nur nagios_plugins.orig/check_snmp_mem.pl nagios_plugins/check_snmp_mem.pl +--- nagios_plugins.orig/check_snmp_mem.pl 2006-07-09 22:52:37.000000000 +0200 ++++ nagios_plugins/check_snmp_mem.pl 2008-02-10 20:42:58.441293269 +0100 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_mem ############## + # Version : 1.1 + # Date : Jul 09 2006 +diff -Nur nagios_plugins.orig/check_snmp_nsbox.pl nagios_plugins/check_snmp_nsbox.pl +--- nagios_plugins.orig/check_snmp_nsbox.pl 2007-01-16 23:55:21.000000000 +0100 ++++ nagios_plugins/check_snmp_nsbox.pl 2008-02-10 20:43:06.286157817 +0100 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_nsbox ################# + # Version : 1.0 + # Date : Jan 16 2007 +diff -Nur nagios_plugins.orig/check_snmp_process.pl nagios_plugins/check_snmp_process.pl +--- nagios_plugins.orig/check_snmp_process.pl 2007-03-12 21:36:02.000000000 +0100 ++++ nagios_plugins/check_snmp_process.pl 2008-02-10 20:43:15.957990819 +0100 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_process ############## + # Version : 1.4 + # Date : March 12 2007 +diff -Nur nagios_plugins.orig/check_snmp_storage.pl nagios_plugins/check_snmp_storage.pl +--- nagios_plugins.orig/check_snmp_storage.pl 2007-03-12 22:01:36.000000000 +0100 ++++ nagios_plugins/check_snmp_storage.pl 2008-02-10 20:43:23.024868799 +0100 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_storage ############## + # Version : 1.3.2 + # Date : March 12 2007 +diff -Nur nagios_plugins.orig/check_snmp_vrrp.pl nagios_plugins/check_snmp_vrrp.pl +--- nagios_plugins.orig/check_snmp_vrrp.pl 2006-08-23 23:39:48.000000000 +0200 ++++ nagios_plugins/check_snmp_vrrp.pl 2008-02-10 20:43:30.870733331 +0100 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_vrrp ############## + # Version : 1.3 + # Date : Aug 23 2006 +diff -Nur nagios_plugins.orig/check_snmp_win.pl nagios_plugins/check_snmp_win.pl +--- nagios_plugins.orig/check_snmp_win.pl 2006-11-29 20:59:55.000000000 +0100 ++++ nagios_plugins/check_snmp_win.pl 2008-02-10 20:43:40.407568666 +0100 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_win ############## + # Version : 0.6 + # Date : Nov 29 2006 From 10ef56f52bbc8d00d6ac90fb86418fec9b0326c5 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 14 Apr 2008 19:23:36 +0000 Subject: [PATCH 012/205] bump copyright of packaging to 2008 --- debian/changelog | 1 + debian/copyright | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 1799bc5..087510d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,7 @@ nagios-snmp-plugins (1.1.1-3) UNRELEASED; urgency=low * bump standards version to 3.7.3 * add 02_disable_epn.dpatch to disable epn, since the plugins don't work with it + * bump copyright of packaging to 2008 -- Jan Wagner Sun, 9 Dec 2007 23:25:38 +0200 diff --git a/debian/copyright b/debian/copyright index 2b73896..fc3a1a6 100644 --- a/debian/copyright +++ b/debian/copyright @@ -26,5 +26,5 @@ License: On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL file. -The Debian packaging is (C) 2006-2007 Jan Wagner and +The Debian packaging is (C) 2006-2008 Jan Wagner and is licensed under the GPL, see `/usr/share/common-licenses/GPL'. From 68aa03fde62edbf967c05343d791c966e9f08fe9 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 14 Apr 2008 21:21:36 +0000 Subject: [PATCH 013/205] release 1.1.1-3 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 087510d..5377679 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -nagios-snmp-plugins (1.1.1-3) UNRELEASED; urgency=low +nagios-snmp-plugins (1.1.1-3) unstable; urgency=low * change unit to bit/s in interface check * add option for scale of bandwidth to interface check @@ -8,7 +8,7 @@ nagios-snmp-plugins (1.1.1-3) UNRELEASED; urgency=low work with it * bump copyright of packaging to 2008 - -- Jan Wagner Sun, 9 Dec 2007 23:25:38 +0200 + -- Jan Wagner Mon, 14 Apr 2008 23:20:52 +0200 nagios-snmp-plugins (1.1.1-2) unstable; urgency=low From 580585cbe6448d5516365cfcafa7cf2759f785ac Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 14 Apr 2008 21:54:44 +0000 Subject: [PATCH 014/205] be more verbose in changelog --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 5377679..bde51d7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,7 +3,7 @@ nagios-snmp-plugins (1.1.1-3) unstable; urgency=low * change unit to bit/s in interface check * add option for scale of bandwidth to interface check * added Vcs- fields, moved Homepage into source header's field - * bump standards version to 3.7.3 + * bump standards version to 3.7.3 (no changes needed) * add 02_disable_epn.dpatch to disable epn, since the plugins don't work with it * bump copyright of packaging to 2008 From 24e3702ec6ae6d2c06ae73888bdf3946839e830a Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Tue, 15 Apr 2008 07:58:37 +0000 Subject: [PATCH 015/205] we are not later than GPL2 --- debian/changelog | 1 + debian/copyright | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index bde51d7..f2ee9b5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,7 @@ nagios-snmp-plugins (1.1.1-3) unstable; urgency=low * add 02_disable_epn.dpatch to disable epn, since the plugins don't work with it * bump copyright of packaging to 2008 + * adjust copyright, it's GPL2 (and not later) -- Jan Wagner Mon, 14 Apr 2008 23:20:52 +0200 diff --git a/debian/copyright b/debian/copyright index fc3a1a6..082f763 100644 --- a/debian/copyright +++ b/debian/copyright @@ -10,9 +10,8 @@ Copyright: (C) 2004-2007 Patrick Proy (nagios at proy.org) License: This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of From 12871c69e0dc47e0b8bdea3837fe4c4e3108641f Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 23 Apr 2008 23:15:44 +0000 Subject: [PATCH 016/205] revert to uploaded 1.1.1-3 --- debian/changelog | 1 - debian/copyright | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index f2ee9b5..bde51d7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,7 +7,6 @@ nagios-snmp-plugins (1.1.1-3) unstable; urgency=low * add 02_disable_epn.dpatch to disable epn, since the plugins don't work with it * bump copyright of packaging to 2008 - * adjust copyright, it's GPL2 (and not later) -- Jan Wagner Mon, 14 Apr 2008 23:20:52 +0200 diff --git a/debian/copyright b/debian/copyright index 082f763..fc3a1a6 100644 --- a/debian/copyright +++ b/debian/copyright @@ -10,8 +10,9 @@ Copyright: (C) 2004-2007 Patrick Proy (nagios at proy.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. + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of From 86e207f61f2334f1e5bdf99ed09bec771819b606 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 23 Apr 2008 23:58:15 +0000 Subject: [PATCH 017/205] readjust copyright file to GPL2 only --- debian/changelog | 6 ++++++ debian/copyright | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index bde51d7..2e98ffb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +nagios-snmp-plugins (1.1.1-4) UNRELEASED; urgency=low + + * adjust copyright, it's GPL2 (and not later) + + -- Jan Wagner Thu, 24 Apr 2008 01:55:58 +0200 + nagios-snmp-plugins (1.1.1-3) unstable; urgency=low * change unit to bit/s in interface check diff --git a/debian/copyright b/debian/copyright index fc3a1a6..082f763 100644 --- a/debian/copyright +++ b/debian/copyright @@ -10,9 +10,8 @@ Copyright: (C) 2004-2007 Patrick Proy (nagios at proy.org) License: This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of From fb68b9969b18c2bb49f11eb424c159d6613aa536 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 23 May 2008 12:14:48 +0000 Subject: [PATCH 018/205] update to latest versions --- debian/patches/02_check_snmp_int.dpatch | 375 ++++++++++++++++++++ debian/patches/03_check_snmp_load.dpatch | 46 +++ debian/patches/04_check_snmp_process.dpatch | 210 +++++++++++ debian/patches/05_check_snmp_storage.dpatch | 225 ++++++++++++ debian/patches/06_check_snmp_win.dpatch | 70 ++++ 5 files changed, 926 insertions(+) create mode 100644 debian/patches/02_check_snmp_int.dpatch create mode 100644 debian/patches/03_check_snmp_load.dpatch create mode 100644 debian/patches/04_check_snmp_process.dpatch create mode 100644 debian/patches/05_check_snmp_storage.dpatch create mode 100644 debian/patches/06_check_snmp_win.dpatch diff --git a/debian/patches/02_check_snmp_int.dpatch b/debian/patches/02_check_snmp_int.dpatch new file mode 100644 index 0000000..964478d --- /dev/null +++ b/debian/patches/02_check_snmp_int.dpatch @@ -0,0 +1,375 @@ +#!/bin/sh /usr/share/dpatch/dpatch-run +## 02_check_snmp_int.dpatch by Jan Wagner +## +## DP: Update script to version 1.24 + +@DPATCH@ + + +diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_int.pl nagios-snmp-plugins-1.1.1/check_snmp_int.pl +--- nagios-snmp-plugins-1.1.1.orig/check_snmp_int.pl 2007-04-23 11:40:39.000000000 +0200 ++++ nagios-snmp-plugins-1.1.1/check_snmp_int.pl 2007-10-12 22:23:22.000000000 +0200 +@@ -1,13 +1,12 @@ + #!/usr/bin/perl -w + ############################## check_snmp_int ############## +-# Version : 1.4.6 +-# Date : April 23 2007 ++my $Version='1.24'; ++# Date : Oct 10 2007 + # Author : Patrick Proy ( patrick at proy.org ) + # Help : http://nagios.manubulon.com + # Licence : GPL - http://www.fsf.org/licenses/gpl.txt + # Contrib : J. Jungmann, S. Probst, R. Leroy, M. Berger + # TODO : +-# Check isdn "dormant" state + # Maybe put base directory for performance as an option + ################################################################# + # +@@ -23,10 +22,8 @@ + + # Nagios specific + +-use lib "/usr/local/nagios/libexec"; +-use utils qw(%ERRORS $TIMEOUT); +-#my $TIMEOUT = 5; +-#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); ++my $TIMEOUT = 15; ++my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); + + # SNMP Datas + +@@ -36,6 +33,7 @@ + my $oper_table = '1.3.6.1.2.1.2.2.1.8.'; + my $admin_table = '1.3.6.1.2.1.2.2.1.7.'; + my $speed_table = '1.3.6.1.2.1.2.2.1.5.'; ++my $speed_table_64 = '1.3.6.1.2.1.31.1.1.1.15.'; + my $in_octet_table = '1.3.6.1.2.1.2.2.1.10.'; + my $in_octet_table_64 = '1.3.6.1.2.1.31.1.1.1.6.'; + my $in_error_table = '1.3.6.1.2.1.2.2.1.14.'; +@@ -49,7 +47,6 @@ + + # Globals + +-my $Version='1.4.6'; + + # Standard options + my $o_host = undef; # hostname +@@ -58,6 +55,7 @@ + my $o_help= undef; # wan't some help ? + my $o_admin= undef; # admin status instead of oper + my $o_inverse= undef; # Critical when up ++my $o_dormant= undef; # Dormant state is OK + my $o_verb= undef; # verbose mode + my $o_version= undef; # print version + my $o_noreg= undef; # Do not use Regexp for name +@@ -66,16 +64,16 @@ + # Performance data options + my $o_perf= undef; # Output performance data + my $o_perfe= undef; # Output discard/error also in perf data +-my $o_perfs= undef; # include speed in performance output (-S) +-my $o_perfp= undef; # output performance data in % of max speed (-y) +-my $o_perfr= undef; # output performance data in bits/s or Bytes/s (-Y) ++my $o_perfs= undef; # include speed in performance output (-S) ++my $o_perfp= undef; # output performance data in % of max speed (-y) ++my $o_perfr= undef; # output performance data in bits/s or Bytes/s (-Y) + # Speed/error checks + my $o_checkperf= undef; # checks in/out/err/disc values + my $o_delta= 300; # delta of time of perfcheck (default 5min) + my $o_ext_checkperf= undef; # extended perf checks (+error+discard) + my $o_warn_opt= undef; # warning options + my $o_crit_opt= undef; # critical options +-my $o_kbits= undef; # Warn and critical in Kbits instead of KBytes ++my $o_kbits= undef; # Warn and critical in Kbits instead of KBytes + my @o_warn= undef; # warning levels of perfcheck + my @o_crit= undef; # critical levels of perfcheck + my $o_highperf= undef; # Use 64 bits counters +@@ -152,7 +150,7 @@ + sub p_version { print "check_snmp_int version : $Version\n"; } + + sub print_usage { +- print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,) [-p ] -n [-i] [-a] [-r] [-f[eSyY]] [-k[qBMGu] -g -w -c -d] [-o ] [-t ] [-s] --label [-V]\n"; ++ print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,) [-p ] -n [-i -a -D] [-r] [-f[eSyY]] [-k[qBMGu] -g -w -c -d] [-o ] [-t ] [-s] --label [-V]\n"; + } + + sub isnnum { # Return true if arg is not a number +@@ -195,6 +193,8 @@ + Make critical when up + -a, --admin + Use administrative status instead of operational ++-D, --dormant ++ Dormant state is an OK state + -o, --octetlength=INTEGER + max-size of the SNMP message, usefull in case of Too Long responses. + Be carefull with network filters. Range 484 - 65535, default are +@@ -214,8 +214,8 @@ + --label + Add label before speed in output : in=, out=, errors-out=, etc... + -g, --64bits +- Use 64 bits counters instead of the standard counters +- when checking bandwidth & performance data. ++ Use 64 bits counters instead of the standard counters when checking ++ bandwidth & performance data for interface >= 1Gbps. + You must use snmp v2c or v3 to get 64 bits counters. + -d, --delta=seconds + make an average of seconds (default 300=5min) +@@ -284,7 +284,8 @@ + 'u' => \$o_prct, 'prct' => \$o_prct, + 'o:i' => \$o_octetlength, 'octetlength:i' => \$o_octetlength, + 'label' => \$o_label, +- 'd:i' => \$o_delta, 'delta:i' => \$o_delta ++ 'd:i' => \$o_delta, 'delta:i' => \$o_delta, ++ 'D' => \$o_dormant, 'dormant' => \$o_dormant + ); + if (defined ($o_help) ) { help(); exit $ERRORS{"UNKNOWN"}}; + if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"}}; +@@ -460,6 +461,7 @@ + my (@oid_perf,@oid_perf_outoct,@oid_perf_inoct,@oid_perf_inerr,@oid_perf_outerr,@oid_perf_indisc,@oid_perf_outdisc)= + (undef,undef,undef,undef,undef,undef,undef); + my @oid_speed=undef; ++my @oid_speed_high=undef; + my $num_int = 0; + + # Change to 64 bit counters if option is set : +@@ -494,7 +496,8 @@ + if (defined($o_perf) || defined($o_checkperf)) { + $oid_perf_inoct[$num_int]= $in_octet_table . $tindex[$num_int]; + $oid_perf_outoct[$num_int]= $out_octet_table . $tindex[$num_int]; +- $oid_speed[$num_int]=$speed_table . $tindex[$num_int]; ++ $oid_speed[$num_int]=$speed_table . $tindex[$num_int]; ++ $oid_speed_high[$num_int]=$speed_table_64 . $tindex[$num_int]; + if (defined($o_ext_checkperf) || defined($o_perfe)) { + $oid_perf_indisc[$num_int]= $in_discard_table . $tindex[$num_int]; + $oid_perf_outdisc[$num_int]= $out_discard_table . $tindex[$num_int]; +@@ -509,25 +512,25 @@ + # No interface found -> error + if ( $num_int == 0 ) { print "ERROR : Unknown interface $o_descr\n" ; exit $ERRORS{"UNKNOWN"};} + +-my ($result,$resultf)=(undef,undef); ++my $result=undef; ++# Add performance oids if requested ++if (defined($o_perf)||defined($o_checkperf)) { ++ @oids=(@oids,@oid_perf_outoct,@oid_perf_inoct,@oid_speed); ++ if (defined($o_highperf)) { ++ @oids=(@oids,@oid_speed_high); ++ } ++ if (defined ($o_ext_checkperf) || defined($o_perfe)) { ++ @oids=(@oids,@oid_perf_inerr,@oid_perf_outerr,@oid_perf_indisc,@oid_perf_outdisc); ++ } ++} ++ + # Get the requested oid values + $result = $session->get_request( + Varbindlist => \@oids + ); +-if (!defined($result)) { printf("ERROR: Status table : %s.\n", $session->error); $session->close; ++if (!defined($result)) { printf("ERROR: Status/statistics table : %s.\n", $session->error); $session->close; + exit $ERRORS{"UNKNOWN"}; + } +-# Get the perf value if -f (performance) option defined or -k (check bandwidth) +-if (defined($o_perf)||defined($o_checkperf)) { +- @oid_perf=(@oid_perf_outoct,@oid_perf_inoct,@oid_perf_inerr,@oid_perf_outerr,@oid_perf_indisc,@oid_perf_outdisc,@oid_speed); +- $resultf = $session->get_request( +- Varbindlist => \@oid_perf +- ); +- if (!defined($resultf)) { printf("ERROR: Statistics table : %s.\n", $session->error); $session->close; +- exit $ERRORS{"UNKNOWN"}; +- } +-} +- + + $session->close; + +@@ -544,6 +547,7 @@ + my $trigger_low=$timenow - 3*$o_delta; + my ($old_value,$old_time)=undef; + my $speed_unit=undef; ++my $speed_real=undef; # speed of interface using either standard or highperf mib. + + # define the OK value depending on -i option + my $ok_val= defined ($o_inverse) ? 2 : 1; +@@ -570,7 +574,22 @@ + $n_rows = shift(@ret_array); + if ($n_rows != 0) { @file_values = @ret_array }; + verb ("File read returns : $return with $n_rows rows"); +- verb ("Interface speed : $$resultf{$oid_speed[$i]}"); ++ # Get the speed in normal or highperf speed counters ++ if ($$result{$oid_speed[$i]} == 4294967295) { # Too high for this counter (cf IF-MIB) ++ if (! defined($o_highperf) && (defined($o_prct) || defined ($o_perfs) || defined ($o_perfp))) { ++ print "Cannot get interface speed with standard MIB, use highperf mib (-g) : UNKNOWN\n"; ++ exit $ERRORS{"UNKNOWN"} ++ } ++ if (defined ($$result{$oid_speed_high[$i]}) && $$result{$oid_speed_high[$i]} != 0) { ++ $speed_real=$$result{$oid_speed_high[$i]} * 1000000; ++ } else { ++ print "Cannot get interface speed using highperf mib : UNKNOWN\n"; ++ exit $ERRORS{"UNKNOWN"} ++ } ++ } else { ++ $speed_real=$$result{$oid_speed[$i]}; ++ } ++ verb ("Interface speed : $speed_real"); + #make the checks if the file is OK + if ($return ==0) { + my $j=$n_rows-1; +@@ -583,7 +602,7 @@ + my $speed_metric=undef; + if (defined($o_prct)) { # in % of speed + # Speed is in bits/s, calculated speed is in Bytes/s +- $speed_metric=$$resultf{$oid_speed[$i]}/800; ++ $speed_metric=$speed_real/800; + $speed_unit="%"; + } else { + if (defined($o_kbits)) { # metric in bits +@@ -614,24 +633,24 @@ + # First set the modulus depending on highperf counters or not + my $overfl_mod = defined ($o_highperf) ? 18446744073709551616 : 4294967296; + # Check counter (s) +- my $overfl = ($$resultf{$oid_perf_inoct[$i]} >= $file_values[$j][1] ) ? 0 : $overfl_mod; +- $checkperf_out_raw[0] = ( ($overfl + $$resultf{$oid_perf_inoct[$i]} - $file_values[$j][1])/ ++ my $overfl = ($$result{$oid_perf_inoct[$i]} >= $file_values[$j][1] ) ? 0 : $overfl_mod; ++ $checkperf_out_raw[0] = ( ($overfl + $$result{$oid_perf_inoct[$i]} - $file_values[$j][1])/ + ($timenow - $file_values[$j][0] )); + $checkperf_out[0] = $checkperf_out_raw[0] / $speed_metric; + +- $overfl = ($$resultf{$oid_perf_outoct[$i]} >= $file_values[$j][2] ) ? 0 : $overfl_mod; +- $checkperf_out_raw[1] = ( ($overfl + $$resultf{$oid_perf_outoct[$i]} - $file_values[$j][2])/ ++ $overfl = ($$result{$oid_perf_outoct[$i]} >= $file_values[$j][2] ) ? 0 : $overfl_mod; ++ $checkperf_out_raw[1] = ( ($overfl + $$result{$oid_perf_outoct[$i]} - $file_values[$j][2])/ + ($timenow - $file_values[$j][0] )); + $checkperf_out[1] = $checkperf_out_raw[1] / $speed_metric; + + if (defined($o_ext_checkperf)) { +- $checkperf_out[2] = ( ($$resultf{$oid_perf_inerr[$i]} - $file_values[$j][3])/ ++ $checkperf_out[2] = ( ($$result{$oid_perf_inerr[$i]} - $file_values[$j][3])/ + ($timenow - $file_values[$j][0] ))*60; +- $checkperf_out[3] = ( ($$resultf{$oid_perf_outerr[$i]} - $file_values[$j][4])/ ++ $checkperf_out[3] = ( ($$result{$oid_perf_outerr[$i]} - $file_values[$j][4])/ + ($timenow - $file_values[$j][0] ))*60; +- $checkperf_out[4] = ( ($$resultf{$oid_perf_indisc[$i]} - $file_values[$j][5])/ ++ $checkperf_out[4] = ( ($$result{$oid_perf_indisc[$i]} - $file_values[$j][5])/ + ($timenow - $file_values[$j][0] ))*60; +- $checkperf_out[5] = ( ($$resultf{$oid_perf_outdisc[$i]} - $file_values[$j][6])/ ++ $checkperf_out[5] = ( ($$result{$oid_perf_outdisc[$i]} - $file_values[$j][6])/ + ($timenow - $file_values[$j][0] ))*60; + } + } +@@ -641,13 +660,13 @@ + } + # Put the new values in the array and write the file + $file_values[$n_rows][0]=$timenow; +- $file_values[$n_rows][1]=$$resultf{$oid_perf_inoct[$i]}; +- $file_values[$n_rows][2]=$$resultf{$oid_perf_outoct[$i]}; ++ $file_values[$n_rows][1]=$$result{$oid_perf_inoct[$i]}; ++ $file_values[$n_rows][2]=$$result{$oid_perf_outoct[$i]}; + if (defined($o_ext_checkperf)) { # Add other values (error & disc) +- $file_values[$n_rows][3]=$$resultf{$oid_perf_inerr[$i]}; +- $file_values[$n_rows][4]=$$resultf{$oid_perf_outerr[$i]}; +- $file_values[$n_rows][5]=$$resultf{$oid_perf_indisc[$i]}; +- $file_values[$n_rows][6]=$$resultf{$oid_perf_outdisc[$i]}; ++ $file_values[$n_rows][3]=$$result{$oid_perf_inerr[$i]}; ++ $file_values[$n_rows][4]=$$result{$oid_perf_outerr[$i]}; ++ $file_values[$n_rows][5]=$$result{$oid_perf_indisc[$i]}; ++ $file_values[$n_rows][6]=$$result{$oid_perf_outdisc[$i]}; + } + $n_rows++; + $return=write_file($temp_file_name,$n_rows,$n_items_check,@file_values); +@@ -703,62 +722,79 @@ + } + # Get rid of special caracters for performance in description + $descr[$i] =~ s/'\/\(\)/_/g; +- if ( $int_status == $ok_val) { ++ if (( $int_status == $ok_val)||(defined($o_dormant) && $int_status == 5)) { + $num_ok++; + } + if (( $int_status == 1 ) && defined ($o_perf)) { + if (defined ($o_perfp)) { # output in % of speed + if ($usable_data==1) { ++ my $warn_factor=1; ++ if (!defined($o_prct)) { # warn&crit in K|M|G B|bps -> put warn_factor to make % ++ $warn_factor = (defined($o_meg)) ? 1000000 : (defined($o_gig)) ? 1000000000 : 1000; ++ if (!defined($o_kbits)) { $warn_factor*=8;} ++ $warn_factor/=$speed_real; ++ $warn_factor*=100; # now turn into displayed % : 0,1 = 10% ++ } + $perf_out .= "'" . $descr[$i] ."_in_prct'="; +- $perf_out .= sprintf("%.0f",$checkperf_out_raw[0] * 800 / $$resultf{$oid_speed[$i]}) ."%;"; +- $perf_out .= ($o_warn[0]!=0) ? $o_warn[0] . ";" : ";"; +- $perf_out .= ($o_crit[0]!=0) ? $o_crit[0] . ";" : ";"; ++ $perf_out .= sprintf("%.0f",$checkperf_out_raw[0] * 800 / $speed_real) ."%;"; ++ $perf_out .= ($o_warn[0]!=0) ? sprintf("%.0f",$o_warn[0]*$warn_factor) . ";" : ";"; ++ $perf_out .= ($o_crit[0]!=0) ? sprintf("%.0f",$o_crit[0]*$warn_factor) . ";" : ";"; + $perf_out .= "0;100 "; + $perf_out .= "'" . $descr[$i] ."_out_prct'="; +- $perf_out .= sprintf("%.0f",$checkperf_out_raw[1] * 800 / $$resultf{$oid_speed[$i]}) ."%;"; +- $perf_out .= ($o_warn[1]!=0) ? $o_warn[1] . ";" : ";"; +- $perf_out .= ($o_crit[1]!=0) ? $o_crit[1] . ";" : ";"; ++ $perf_out .= sprintf("%.0f",$checkperf_out_raw[1] * 800 / $speed_real) ."%;"; ++ $perf_out .= ($o_warn[1]!=0) ? sprintf("%.0f",$o_warn[1]*$warn_factor) . ";" : ";"; ++ $perf_out .= ($o_crit[1]!=0) ? sprintf("%.0f",$o_crit[1]*$warn_factor) . ";" : ";"; + $perf_out .= "0;100 "; + } + } elsif (defined ($o_perfr)) { # output in bites or Bytes /s + if ($usable_data==1) { + if (defined($o_kbits)) { # bps + # put warning and critical levels into bps or Bps +- my $warn_factor = (defined($o_meg)) ? 1000000 : (defined($o_gig)) ? 1000000000 : 1000; ++ my $warn_factor; ++ if (defined($o_prct)) { # warn&crit in % -> put warn_factor to 1% of speed in bps ++ $warn_factor=$speed_real/100; ++ } else { # just convert from K|M|G bps ++ $warn_factor = (defined($o_meg)) ? 1000000 : (defined($o_gig)) ? 1000000000 : 1000; ++ } + $perf_out .= "'" . $descr[$i] ."_in_bps'="; + $perf_out .= sprintf("%.0f",$checkperf_out_raw[0] * 8) .";"; + $perf_out .= ($o_warn[0]!=0) ? $o_warn[0]*$warn_factor . ";" : ";"; + $perf_out .= ($o_crit[0]!=0) ? $o_crit[0]*$warn_factor . ";" : ";"; +- $perf_out .= "0;". $$resultf{$oid_speed[$i]} ." "; ++ $perf_out .= "0;". $speed_real ." "; + $perf_out .= "'" . $descr[$i] ."_out_bps'="; + $perf_out .= sprintf("%.0f",$checkperf_out_raw[1] * 8) .";"; + $perf_out .= ($o_warn[1]!=0) ? $o_warn[1]*$warn_factor . ";" : ";"; + $perf_out .= ($o_crit[1]!=0) ? $o_crit[1]*$warn_factor . ";" : ";"; +- $perf_out .= "0;". $$resultf{$oid_speed[$i]} ." "; ++ $perf_out .= "0;". $speed_real ." "; + } else { # Bps +- my $warn_factor = (defined($o_meg)) ? 1048576 : (defined($o_gig)) ? 1073741824 : 1024; ++ my $warn_factor; ++ if (defined($o_prct)) { # warn&crit in % -> put warn_factor to 1% of speed in Bps ++ $warn_factor=$speed_real/800; ++ } else { # just convert from K|M|G bps ++ $warn_factor = (defined($o_meg)) ? 1048576 : (defined($o_gig)) ? 1073741824 : 1024; ++ } + $perf_out .= "'" . $descr[$i] ."_in_Bps'=" . sprintf("%.0f",$checkperf_out_raw[0]) .";"; + $perf_out .= ($o_warn[0]!=0) ? $o_warn[0]*$warn_factor . ";" : ";"; + $perf_out .= ($o_crit[0]!=0) ? $o_crit[0]*$warn_factor . ";" : ";"; +- $perf_out .= "0;". $$resultf{$oid_speed[$i]} ." "; ++ $perf_out .= "0;". $speed_real / 8 ." "; + $perf_out .= "'" . $descr[$i] ."_out_Bps'=" . sprintf("%.0f",$checkperf_out_raw[1]) .";" ; + $perf_out .= ($o_warn[1]!=0) ? $o_warn[1]*$warn_factor . ";" : ";"; + $perf_out .= ($o_crit[1]!=0) ? $o_crit[1]*$warn_factor . ";" : ";"; +- $perf_out .= "0;". $$resultf{$oid_speed[$i]} ." "; ++ $perf_out .= "0;". $speed_real / 8 ." "; + } + } + } else { # output in octet counter +- $perf_out .= "'" . $descr[$i] ."_in_octet'=". $$resultf{$oid_perf_inoct[$i]} ."c "; +- $perf_out .= "'" . $descr[$i] ."_out_octet'=". $$resultf{$oid_perf_outoct[$i]} ."c"; ++ $perf_out .= "'" . $descr[$i] ."_in_octet'=". $$result{$oid_perf_inoct[$i]} ."c "; ++ $perf_out .= "'" . $descr[$i] ."_out_octet'=". $$result{$oid_perf_outoct[$i]} ."c "; + } + if (defined ($o_perfe)) { +- $perf_out .= " '" . $descr[$i] ."_in_error'=". $$resultf{$oid_perf_inerr[$i]} ."c "; +- $perf_out .= "'" . $descr[$i] ."_in_discard'=". $$resultf{$oid_perf_indisc[$i]} ."c "; +- $perf_out .= "'" . $descr[$i] ."_out_error'=". $$resultf{$oid_perf_outerr[$i]} ."c "; +- $perf_out .= "'" . $descr[$i] ."_out_discard'=". $$resultf{$oid_perf_outdisc[$i]} ."c"; ++ $perf_out .= "'" . $descr[$i] ."_in_error'=". $$result{$oid_perf_inerr[$i]} ."c "; ++ $perf_out .= "'" . $descr[$i] ."_in_discard'=". $$result{$oid_perf_indisc[$i]} ."c "; ++ $perf_out .= "'" . $descr[$i] ."_out_error'=". $$result{$oid_perf_outerr[$i]} ."c "; ++ $perf_out .= "'" . $descr[$i] ."_out_discard'=". $$result{$oid_perf_outdisc[$i]} ."c "; + } + if (defined ($o_perfs)) { +- $perf_out .= " '" . $descr[$i] ."_speed_bps'=".$$resultf{$oid_speed[$i]}; ++ $perf_out .= "'" . $descr[$i] ."_speed_bps'=".$speed_real; + } + } + } diff --git a/debian/patches/03_check_snmp_load.dpatch b/debian/patches/03_check_snmp_load.dpatch new file mode 100644 index 0000000..e0dc967 --- /dev/null +++ b/debian/patches/03_check_snmp_load.dpatch @@ -0,0 +1,46 @@ +#!/bin/sh /usr/share/dpatch/dpatch-run +## 03_check_snmp_load.dpatch by Jan Wagner +## +## DP: Update script to version 1.12 + +@DPATCH@ + +diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_load.pl nagios-snmp-plugins-1.1.1/check_snmp_load.pl +--- nagios-snmp-plugins-1.1.1.orig/check_snmp_load.pl 2007-04-16 19:41:20.000000000 +0200 ++++ nagios-snmp-plugins-1.1.1/check_snmp_load.pl 2007-10-12 22:23:23.000000000 +0200 +@@ -1,11 +1,10 @@ + #!/usr/bin/perl -w + ############################## check_snmp_load ################# +-# Version : 1.3.2 +-# Date : Jan 16 2007 ++my $Version='1.12'; ++# Date : Oct 12 2007 + # Author : Patrick Proy ( patrick at proy.org) +-# Help : http://www.manubulon.com/nagios/ ++# Help : http://nagios.manubulon.com/ + # Licence : GPL - http://www.fsf.org/licenses/gpl.txt +-# Changelog : HP-UX load added. + # Contributors : F. Lacroix and many others !!! + ################################################################# + # +@@ -18,10 +17,8 @@ + + # Nagios specific + +-use lib "/usr/local/nagios/libexec"; +-use utils qw(%ERRORS $TIMEOUT); +-#my $TIMEOUT = 15; +-#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); ++my $TIMEOUT = 15; ++my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); + + # SNMP Datas + +@@ -94,7 +91,6 @@ + + # Globals + +-my $Version='1.3.2'; + + my $o_host = undef; # hostname + my $o_community = undef; # community diff --git a/debian/patches/04_check_snmp_process.dpatch b/debian/patches/04_check_snmp_process.dpatch new file mode 100644 index 0000000..858421a --- /dev/null +++ b/debian/patches/04_check_snmp_process.dpatch @@ -0,0 +1,210 @@ +#!/bin/sh /usr/share/dpatch/dpatch-run +## 04_check_snmp_process.dpatch by Jan Wagner +## +## DP: Update script to version 1.10 + +@DPATCH@ + +diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_process.pl nagios-snmp-plugins-1.1.1/check_snmp_process.pl +--- nagios-snmp-plugins-1.1.1.orig/check_snmp_process.pl 2007-03-12 21:36:02.000000000 +0100 ++++ nagios-snmp-plugins-1.1.1/check_snmp_process.pl 2007-10-12 22:23:24.000000000 +0200 +@@ -1,45 +1,43 @@ + #!/usr/bin/perl -w + ############################## check_snmp_process ############## +-# Version : 1.4 +-# Date : March 12 2007 +-# Author : Patrick Proy (patrick at proy.org) ++my $Version='1.10'; ++# Date : Oct 12 2007 ++# Author : Patrick Proy (patrick at proy dot org) + # Help : http://nagios.manubulon.com + # Licence : GPL - http://www.fsf.org/licenses/gpl.txt +-# Contrib : Makina Corpus ++# Contrib : Makina Corpus, adam At greekattic d0t com + # TODO : put $o_delta as an option +-# Contrib : ++# If testing on localhost, selects itself.... + ############################################################### + # + # help : ./check_snmp_process -h + ++use strict; ++use Net::SNMP; ++use Getopt::Long; ++ + ############### BASE DIRECTORY FOR TEMP FILE ######## + my $o_base_dir="/tmp/tmp_Nagios_proc."; + my $file_history=200; # number of data to keep in files. + my $delta_of_time_to_make_average=300; # 5minutes by default +- +-use strict; +-use Net::SNMP; +-use Getopt::Long; + + # Nagios specific + +-use lib "/usr/local/nagios/libexec"; +-use utils qw(%ERRORS $TIMEOUT); +-#my $TIMEOUT = 5; +-#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); ++my $TIMEOUT = 15; ++my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); + + # SNMP Datas + my $process_table= '1.3.6.1.2.1.25.4.2.1'; + my $index_table = '1.3.6.1.2.1.25.4.2.1.1'; + my $run_name_table = '1.3.6.1.2.1.25.4.2.1.2'; + my $run_path_table = '1.3.6.1.2.1.25.4.2.1.4'; ++my $run_param_table = '1.3.6.1.2.1.25.4.2.1.5'; + my $proc_mem_table = '1.3.6.1.2.1.25.5.1.1.2'; # Kbytes + my $proc_cpu_table = '1.3.6.1.2.1.25.5.1.1.1'; # Centi sec of CPU + my $proc_run_state = '1.3.6.1.2.1.25.4.2.1.7'; + + # Globals + +-my $Version='1.4'; + + my $o_host = undef; # hostname + my $o_community =undef; # community +@@ -57,6 +55,8 @@ + my $o_path= undef; # check path instead of name + my $o_inverse= undef; # checks max instead of min number of process + my $o_get_all= undef; # get all tables at once ++my $o_param= undef; # Add process parameters for selection ++my $o_perf= undef; # Add performance output + my $o_timeout= 5; # Default 5s Timeout + # SNMP V3 specific + my $o_login= undef; # snmp v3 login +@@ -80,7 +80,7 @@ + sub p_version { print "check_snmp_process version : $Version\n"; } + + sub print_usage { +- print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd) [-p ] -n [-w [,] -c [,max_proc] ] [-m, -a -u, ] [-t ] [-o ] [-f ] [-r] [-V] [-g]\n"; ++ print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd) [-p ] -n [-w [,] -c [,max_proc] ] [-m, -a -u, -d ] [-t ] [-o ] [-f -A -F ] [-r] [-V] [-g]\n"; + } + + sub isnotnum { # Return true if arg is not a number +@@ -174,6 +174,12 @@ + -f, --fullpath + Use full path name instead of process name + (Windows doesn't provide full path name) ++-A, --param ++ Add parameters to select processes. ++ ex : "named.*-t /var/named/chroot" will only select named process with this parameter ++-F, --perfout ++ Add performance output ++ outputs : memory_usage, num_process, cpu_usage + -w, --warn=MIN[,MAX] + Number of process that will cause a warning + -1 for no warning, MAX must be >0. Ex : -w-1,50 +@@ -193,6 +199,8 @@ + checks cpu usage of all process + values are warning and critical values in % of CPU usage + if more than one CPU, value can be > 100% : 100%=1 CPU ++-d, --delta=seconds ++ make an average of seconds for CPU (default 300=5min) + -g, --getall + In some cases, it is necessary to get all data at once because + process die very frequently. +@@ -242,6 +250,9 @@ + '2' => \$o_version2, 'v2c' => \$o_version2, + 'o:i' => \$o_octetlength, 'octetlength:i' => \$o_octetlength, + 'g' => \$o_get_all, 'getall' => \$o_get_all, ++ 'A' => \$o_param, 'param' => \$o_param, ++ 'F' => \$o_perf, 'perfout' => \$o_perf, ++ 'd:i' => \$o_delta, 'delta:i' => \$o_delta, + 'V' => \$o_version, 'version' => \$o_version + ); + if (defined ($o_help)) { help(); exit $ERRORS{"UNKNOWN"}}; +@@ -411,6 +422,19 @@ + exit $ERRORS{"UNKNOWN"}; + } + ++my $resultat_param=undef; ++if (defined($o_param)) { # Get parameter table too ++ $resultat_param = (Net::SNMP->VERSION < 4) ? ++ $session->get_table($run_param_table) ++ :$session->get_table(Baseoid => $run_param_table); ++ if (!defined($resultat_param)) { ++ printf("ERROR: Process param table : %s.\n", $session->error); ++ $session->close; ++ exit $ERRORS{"UNKNOWN"}; ++ } ++ ++} ++ + if (defined ($o_get_all)) { + $getall_run = (Net::SNMP->VERSION < 4) ? + $session->get_table($proc_run_state ) +@@ -458,8 +482,14 @@ + verb("Filter : $o_descr"); + + foreach my $key ( keys %$resultat) { +- verb("OID : $key, Desc : $$resultat{$key}"); + # test by regexp or exact match ++ # First add param if necessary ++ if (defined($o_param)){ ++ my $pid = (split /\./,$key)[-1]; ++ $pid = $run_param_table .".".$pid; ++ $$resultat{$key} .= " " . $$resultat_param{$pid}; ++ } ++ verb("OID : $key, Desc : $$resultat{$key}"); + my $test = defined($o_noreg) + ? $$resultat{$key} eq $o_descr + : $$resultat{$key} =~ /$o_descr/; +@@ -545,6 +575,7 @@ + } + + my $final_status=0; ++my $perf_output; + my ($res_memory,$res_cpu)=(0,0); + my $memory_print=""; + my $cpu_print=""; +@@ -571,6 +602,9 @@ + } else { + $memory_print=", Mem : ".sprintf("%.1f",$res_memory)."Mb OK"; + } ++ if (defined($o_perf)) { ++ $perf_output= "'memory_usage'=".sprintf("%.1f",$res_memory) ."MB;".$o_memL[0].";".$o_memL[1]; ++ } + } + + ######## Checks CPU usage +@@ -609,6 +643,10 @@ + if ($file_values[$j][0] > $trigger_low) { + # found value = centiseconds / seconds = %cpu + $found_value= ($res_cpu-$file_values[$j][1]) / ($timenow - $file_values[$j][0] ); ++ if ($found_value <0) { # in case of program restart ++ $j=0;$found_value=undef; # don't look for more values ++ $n_rows=0; # reset file ++ } + } + } + $j--; +@@ -631,6 +669,10 @@ + } else { + $cpu_print.=", Cpu : ".sprintf("%.0f",$found_value)."% OK"; + } ++ if (defined($o_perf)) { ++ if (!defined($perf_output)) {$perf_output="";} else {$perf_output.=" ";} ++ $perf_output.= "'cpu_usage'=". sprintf("%.0f",$found_value)."%;".$o_cpuL[0].";".$o_cpuL[1]; ++ } + } else { + if ($final_status==0) { $final_status=3 }; + $cpu_print.=", No data for CPU (".$n_rows." line(s)):UNKNOWN"; +@@ -659,7 +701,14 @@ + print " (<= ",$o_warnL[1],"):OK"; + } + +-print $memory_print,$cpu_print,"\n"; ++print $memory_print,$cpu_print; ++ ++if (defined($o_perf)) { ++ if (!defined($perf_output)) {$perf_output="";} else {$perf_output.=" ";} ++ $perf_output.= "'num_process'=". $num_int_ok.";".$o_warnL[0].";".$o_critL[0]; ++ print " | ",$perf_output; ++} ++print "\n"; + + if ($final_status==2) { exit $ERRORS{"CRITICAL"};} + if ($final_status==1) { exit $ERRORS{"WARNING"};} diff --git a/debian/patches/05_check_snmp_storage.dpatch b/debian/patches/05_check_snmp_storage.dpatch new file mode 100644 index 0000000..99f8208 --- /dev/null +++ b/debian/patches/05_check_snmp_storage.dpatch @@ -0,0 +1,225 @@ +#!/bin/sh /usr/share/dpatch/dpatch-run +## 05_check_snmp_storage.dpatch by Jan Wagner +## +## DP: Update script to version 1.3.3 + +@DPATCH@ + +diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_storage.pl nagios-snmp-plugins-1.1.1/check_snmp_storage.pl +--- nagios-snmp-plugins-1.1.1.orig/check_snmp_storage.pl 2007-03-12 22:01:36.000000000 +0100 ++++ nagios-snmp-plugins-1.1.1/check_snmp_storage.pl 2007-10-12 22:23:24.000000000 +0200 +@@ -1,12 +1,12 @@ + #!/usr/bin/perl -w + ############################## check_snmp_storage ############## +-# Version : 1.3.2 +-# Date : March 12 2007 ++# Version : 1.3.3 ++# Date : Jun 1 2007 + # Author : Patrick Proy ( patrick at proy.org) + # Help : http://nagios.manubulon.com + # Licence : GPL - http://www.fsf.org/licenses/gpl.txt + # TODO : +-# Contribs : Dimo Velev, Makina Corpus ++# Contribs : Dimo Velev, Makina Corpus, A. Greiner-Bär + ################################################################# + # + # help : ./check_snmp_storage -h +@@ -57,7 +57,7 @@ + # Globals + + my $Name='check_snmp_storage'; +-my $Version='1.3.2'; ++my $Version='1.3.3'; + + my $o_host = undef; # hostname + my $o_community = undef; # community +@@ -80,6 +80,8 @@ + my $o_perf= undef; # Output performance data + my $o_short= undef; # Short output parameters + my @o_shortL= undef; # output type,where,cut ++my $o_reserve= 0; # % reserved blocks (A. Greiner-Bär patch) ++my $o_giga= undef; # output and levels in gigabytes instead of megabytes + # SNMPv3 specific + my $o_login= undef; # Login for snmpv3 + my $o_passwd= undef; # Pass for snmpv3 +@@ -95,7 +97,7 @@ + sub p_version { print "$Name version : $Version\n"; } + + sub print_usage { +- print "Usage: $Name [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -m [-q storagetype] -w -c [-t ] [-T pl|pu|bl|bu ] [-r] [-s] [-i] [-e] [-S 0|1[,1,]] [-o ]\n"; ++ print "Usage: $Name [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -m [-q storagetype] -w -c [-t ] [-T pl|pu|bl|bu ] [-r -s -i -G] [-e] [-S 0|1[,1,]] [-o ] [-R <% reserved>]\n"; + } + + sub round ($$) { +@@ -122,7 +124,7 @@ + + sub help { + print "\nSNMP Disk Monitor for Nagios version ",$Version,"\n"; +- print "(c)2004-2006 Patrick Proy\n\n"; ++ print "(c)2004-2007 Patrick Proy\n\n"; + print_usage(); + print <[,,] +@@ -245,7 +252,9 @@ + 'q:s' => \$o_storagetype, 'storagetype:s'=> \$o_storagetype, + 'S:s' => \$o_short, 'short:s' => \$o_short, + 'o:i' => \$o_octetlength, 'octetlength:i' => \$o_octetlength, +- 'f' => \$o_perf, 'perfparse' => \$o_perf ++ 'f' => \$o_perf, 'perfparse' => \$o_perf, ++ 'R:i' => \$o_reserve, 'reserved:i' => \$o_reserve, ++ 'G' => \$o_giga, 'gigabyte' => \$o_giga + ); + if (defined($o_help) ) { help(); exit $ERRORS{"UNKNOWN"}}; + if (defined($o_version) ) { p_version(); exit $ERRORS{"UNKNOWN"}}; +@@ -271,6 +280,9 @@ + # Check compulsory attributes + if ( ! defined($o_descr) || ! defined($o_host) || !defined($o_warn) || + !defined($o_crit)) { print_usage(); exit $ERRORS{"UNKNOWN"}}; ++ # Get rid of % sign if any ++ $o_warn =~ s/\%//; ++ $o_crit =~ s/\%//; + # Check for positive numbers + if (($o_warn < 0) || ($o_crit < 0)) { print " warn and critical > 0 \n";print_usage(); exit $ERRORS{"UNKNOWN"}}; + # check if warn or crit in % and MB is tested +@@ -278,9 +290,6 @@ + print "warning or critical cannot be in % when MB are tested\n"; + print_usage(); exit $ERRORS{"UNKNOWN"}; + } +- # Get rid of % sign +- $o_warn =~ s/\%//; +- $o_crit =~ s/\%//; + # Check warning and critical values + if ( ( $o_type eq 'pu' ) || ( $o_type eq 'bu' )) { + if ($o_warn >= $o_crit) { print " warn < crit if type=",$o_type,"\n";print_usage(); exit $ERRORS{"UNKNOWN"}}; +@@ -306,6 +315,10 @@ + if (defined ($o_octetlength) && (isnnum($o_octetlength) || $o_octetlength > 65535 || $o_octetlength < 484 )) { + print "octet lenght must be < 65535 and > 484\n";print_usage(); exit $ERRORS{"UNKNOWN"}; + } ++ #### reserved blocks checks (A. Greiner-Bär patch). ++ if (defined ($o_reserve) && (isnnum($o_reserve) || $o_reserve > 99 || $o_reserve < 0 )) { ++ print "reserved blocks must be < 100 and >= 0\n";print_usage(); exit $ERRORS{"UNKNOWN"}; ++ } + } + + ########## MAIN ####### +@@ -521,21 +534,35 @@ + my $crit_state=0; + my ($p_warn,$p_crit); + my $output=undef; ++my $output_metric_val = 1024**2; ++my $output_metric = "M"; ++# Set the metric ++if (defined($o_giga)) { ++ $output_metric_val *= 1024; ++ $output_metric='G'; ++} ++ + for ($i=0;$i<$num_int;$i++) { + verb("Descr : $descr[$i]"); + verb("Size : $$result{$size_table . $tindex[$i]}"); + verb("Used : $$result{$used_table . $tindex[$i]}"); + verb("Alloc : $$result{$alloc_units . $tindex[$i]}"); +- my $to = $$result{$size_table . $tindex[$i]} * $$result{$alloc_units . $tindex[$i]} / 1024**2; ++ if (!defined($$result{$size_table . $tindex[$i]}) || ++ !defined($$result{$used_table . $tindex[$i]}) || ++ !defined ($$result{$alloc_units . $tindex[$i]})) { ++ print "Data not fully defined for storage ",$descr[$i]," : UNKNOWN\n"; ++ exit $ERRORS{"UNKNOWN"}; ++ } ++ my $to = $$result{$size_table . $tindex[$i]} * ( ( 100 - $o_reserve ) / 100 ) * $$result{$alloc_units . $tindex[$i]} / $output_metric_val; + my $pu=undef; + if ( $$result{$used_table . $tindex[$i]} != 0 ) { +- $pu = $$result{$used_table . $tindex[$i]}*100 / $$result{$size_table . $tindex[$i]}; ++ $pu = $$result{$used_table . $tindex[$i]}* 100 / ( $$result{$size_table . $tindex[$i]} * ( 100 - $o_reserve ) / 100 ); + }else { + $pu=0; + } +- my $bu = $$result{$used_table . $tindex[$i]} * $$result{$alloc_units . $tindex[$i]} / 1024**2; ++ my $bu = $$result{$used_table . $tindex[$i]} * $$result{$alloc_units . $tindex[$i]} / $output_metric_val; + my $pl = 100 - $pu; +- my $bl = ($$result{$size_table . $tindex[$i]}- $$result{$used_table . $tindex[$i]}) * $$result{$alloc_units . $tindex[$i]} / 1024**2; ++ my $bl = ( ( $$result{$size_table . $tindex[$i]} * ( ( 100 - $o_reserve ) / 100 ) - ( $$result{$used_table . $tindex[$i]} ) ) * $$result{$alloc_units . $tindex[$i]} / $output_metric_val ); + # add a ' ' if some data exists in $perf_out + $perf_out .= " " if (defined ($perf_out)) ; + ##### Ouputs and checks +@@ -554,7 +581,7 @@ + || (($pu >= $o_warn) && ($locstate=$warn_state=1)); + if (defined($o_shortL[2])) {} + if (!defined($o_shortL[0]) || ($locstate==1)) { # print full output if warn or critical state +- $output.=sprintf ("%s: %.0f%%used(%.0fMB/%.0fMB) ",$descr[$i],$pu,$bu,$to); ++ $output.=sprintf ("%s: %.0f%%used(%.0f%sB/%.0f%sB) ",$descr[$i],$pu,$bu,$output_metric,$to,$output_metric); + } elsif ($o_shortL[0] == 1) { + $output.=sprintf ("%s: %.0f%% ",$descr[$i],$pu); + } +@@ -566,9 +593,9 @@ + ( ($bu >= $o_crit) && ($locstate=$crit_state=1) ) + || ( ($bu >= $o_warn) && ($locstate=$warn_state=1) ); + if (!defined($o_shortL[0]) || ($locstate==1)) { # print full output if warn or critical state +- $output.=sprintf("%s: %.0fMBused/%.0fMB (%.0f%%) ",$descr[$i],$bu,$to,$pu); ++ $output.=sprintf("%s: %.0f%sBused/%.0f%sB (%.0f%%) ",$descr[$i],$bu,$output_metric,$to,$output_metric,$pu); + } elsif ($o_shortL[0] == 1) { +- $output.=sprintf("%s: %.0fMB ",$descr[$i],$bu); ++ $output.=sprintf("%s: %.0f%sB ",$descr[$i],$bu,$output_metric); + } + } + +@@ -578,9 +605,9 @@ + ( ($bl <= $o_crit) && ($locstate=$crit_state=1) ) + || ( ($bl <= $o_warn) && ($locstate=$warn_state=1) ); + if (!defined($o_shortL[0]) || ($locstate==1)) { # print full output if warn or critical state +- $output.=sprintf ("%s: %.0fMBleft/%.0fMB (%.0f%%) ",$descr[$i],$bl,$to,$pl); ++ $output.=sprintf ("%s: %.0f%sBleft/%.0f%sB (%.0f%%) ",$descr[$i],$bl,$output_metric,$to,$output_metric,$pl); + } elsif ($o_shortL[0] == 1) { +- $output.=sprintf ("%s: %.0fMB ",$descr[$i],$bl); ++ $output.=sprintf ("%s: %.0f%sB ",$descr[$i],$bl,$output_metric); + } + } + +@@ -590,13 +617,13 @@ + ( ($pl <= $o_crit) && ($locstate=$crit_state=1) ) + || ( ($pl <= $o_warn) && ($locstate=$warn_state=1) ); + if (!defined($o_shortL[0]) || ($locstate==1)) { # print full output if warn or critical state +- $output.=sprintf ("%s: %.0f%%left(%.0fMB/%.0fMB) ",$descr[$i],$pl,$bl,$to); ++ $output.=sprintf ("%s: %.0f%%left(%.0f%sB/%.0f%sB) ",$descr[$i],$pl,$bl,$output_metric,$to,$output_metric); + } elsif ($o_shortL[0] == 1) { + $output.=sprintf ("%s: %.0f%% ",$descr[$i],$pl); + } + } + # Performance output (in MB) +- $perf_out .= "'".$Pdescr. "'=" . round($bu,0) . "MB;" . round($p_warn,0) ++ $perf_out .= "'".$Pdescr. "'=" . round($bu,0) . $output_metric ."B;" . round($p_warn,0) + . ";" . round($p_crit,0) . ";0;" . round($to,0); + } + +@@ -606,8 +633,8 @@ + my $comp_unit=undef; + ($o_type eq "pu") && ($comp_oper ="<") && ($comp_unit ="%"); + ($o_type eq "pl") && ($comp_oper =">") && ($comp_unit ="%"); +-($o_type eq "bu") && ($comp_oper ="<") && ($comp_unit ="MB"); +-($o_type eq 'bl') && ($comp_oper =">") && ($comp_unit ="MB"); ++($o_type eq "bu") && ($comp_oper ="<") && ($comp_unit = $output_metric."B"); ++($o_type eq 'bl') && ($comp_oper =">") && ($comp_unit =$output_metric."B"); + + if (!defined ($output)) { $output="All selected storages "; } + diff --git a/debian/patches/06_check_snmp_win.dpatch b/debian/patches/06_check_snmp_win.dpatch new file mode 100644 index 0000000..bee1eed --- /dev/null +++ b/debian/patches/06_check_snmp_win.dpatch @@ -0,0 +1,70 @@ +#!/bin/sh /usr/share/dpatch/dpatch-run +## 06_check_snmp_win.dpatch by Jan Wagner +## +## DP: Update script to version 1.1 + +@DPATCH@ + +diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_win.pl nagios-snmp-plugins-1.1.1/check_snmp_win.pl +--- nagios-snmp-plugins-1.1.1.orig/check_snmp_win.pl 2006-11-29 20:59:55.000000000 +0100 ++++ nagios-snmp-plugins-1.1.1/check_snmp_win.pl 2007-10-12 22:23:25.000000000 +0200 +@@ -1,10 +1,11 @@ + #!/usr/bin/perl -w + ############################## check_snmp_win ############## +-# Version : 0.6 +-# Date : Nov 29 2006 ++my $Version='1.1'; ++# Date : Oct 12 2007 + # Author : Patrick Proy (patrick at proy.org) +-# Help : http://www.manubulon.com/nagios/ ++# Help : http://nagios.manubulon.com/ + # Licence : GPL - http://www.fsf.org/licenses/gpl.txt ++# Contrib : Tenaku + # TODO : + ############################################################### + # +@@ -16,10 +17,10 @@ + + # Nagios specific + +-use lib "/usr/local/nagios/libexec"; +-use utils qw(%ERRORS $TIMEOUT); +-#my $TIMEOUT = 5; +-#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); ++#use lib "/usr/local/nagios/libexec"; ++#use utils qw(%ERRORS $TIMEOUT); ++my $TIMEOUT = 15; ++my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); + + # SNMP Datas for processes (MIB II) + my $process_table= '1.3.6.1.2.1.25.4.2.1'; +@@ -44,7 +45,6 @@ + + # Globals + +-my $Version='0.6'; + my $Name='check_snmp_win'; + + my $o_host = undef; # hostname +@@ -93,7 +93,7 @@ + + sub help { + print "\nSNMP Windows Monitor for Nagios version ",$Version,"\n"; +- print "GPL licence, (c)2004-2005 Patrick Proy\n\n"; ++ print "GPL licence, (c)2004-2007 Patrick Proy\n\n"; + print_usage(); + print < Date: Fri, 23 May 2008 12:18:47 +0000 Subject: [PATCH 019/205] use new patches and readjust epn patch --- debian/patches/00list | 6 ++ debian/patches/02_disable_epn.dpatch | 133 --------------------------- debian/patches/99_disable_epn.dpatch | 133 +++++++++++++++++++++++++++ 3 files changed, 139 insertions(+), 133 deletions(-) delete mode 100644 debian/patches/02_disable_epn.dpatch create mode 100644 debian/patches/99_disable_epn.dpatch diff --git a/debian/patches/00list b/debian/patches/00list index edb5355..d2f695f 100644 --- a/debian/patches/00list +++ b/debian/patches/00list @@ -1 +1,7 @@ 01_check_snmp_env.dpatch +02_check_snmp_int.dpatch +03_check_snmp_load.dpatch +04_check_snmp_process.dpatch +05_check_snmp_storage.dpatch +06_check_snmp_win.dpatch +99_disable_epn.dpatch diff --git a/debian/patches/02_disable_epn.dpatch b/debian/patches/02_disable_epn.dpatch deleted file mode 100644 index 509ee87..0000000 --- a/debian/patches/02_disable_epn.dpatch +++ /dev/null @@ -1,133 +0,0 @@ -#!/bin/sh /usr/share/dpatch/dpatch-run -## 02_disable_epn.dpatch by Jan Wagner -## -## DP: leave marks to disable epn - -@DPATCH@ - -diff -Nur nagios_plugins.orig/check_snmp_boostedge.pl nagios_plugins/check_snmp_boostedge.pl ---- nagios_plugins.orig/check_snmp_boostedge.pl 2007-01-16 23:57:14.000000000 +0100 -+++ nagios_plugins/check_snmp_boostedge.pl 2008-02-10 20:41:52.345434535 +0100 -@@ -1,4 +1,5 @@ - #!/usr/bin/perl -w -+# nagios: -epn - ############################## check_snmp_boostedge.pl ################# - # Version : 1.0 - # Date : Jan 16 2007 -diff -Nur nagios_plugins.orig/check_snmp_cpfw.pl nagios_plugins/check_snmp_cpfw.pl ---- nagios_plugins.orig/check_snmp_cpfw.pl 2007-04-20 00:03:30.000000000 +0200 -+++ nagios_plugins/check_snmp_cpfw.pl 2008-02-10 20:42:02.055266874 +0100 -@@ -1,4 +1,5 @@ - #!/usr/bin/perl -w -+# nagios: -epn - ############################## check_snmp_cpfw ############## - # Version : 1.2.1 - # Date : April 19 2007 -diff -Nur nagios_plugins.orig/check_snmp_css.pl nagios_plugins/check_snmp_css.pl ---- nagios_plugins.orig/check_snmp_css.pl 2007-01-11 17:06:08.000000000 +0100 -+++ nagios_plugins/check_snmp_css.pl 2008-02-10 20:42:10.943113408 +0100 -@@ -1,4 +1,5 @@ - #!/usr/bin/perl -w -+# nagios: -epn - ############################## check_snmp_css.pl ################# - # Version : 1.0.1 - # Date : 27 Sept 2006 -diff -Nur nagios_plugins.orig/check_snmp_css_main.pl nagios_plugins/check_snmp_css_main.pl ---- nagios_plugins.orig/check_snmp_css_main.pl 2006-10-05 23:40:55.000000000 +0200 -+++ nagios_plugins/check_snmp_css_main.pl 2008-02-10 20:42:19.513965416 +0100 -@@ -1,4 +1,5 @@ - #!/usr/bin/perl -w -+# nagios: -epn - ############################## check_snmp_css_main.pl ################# - # Version : 1.0 - # Date : 27 Sept 2006 -diff -Nur nagios_plugins.orig/check_snmp_env.pl nagios_plugins/check_snmp_env.pl ---- nagios_plugins.orig/check_snmp_env.pl 2007-04-20 11:45:22.000000000 +0200 -+++ nagios_plugins/check_snmp_env.pl 2008-02-10 20:42:25.912854927 +0100 -@@ -1,4 +1,5 @@ - #!/usr/bin/perl -w -+# nagios: -epn - ############################## check_snmp_env ################# - # Version : 1.2 - # Date : April 19 2007 -diff -Nur nagios_plugins.orig/check_snmp_int.pl nagios_plugins/check_snmp_int.pl ---- nagios_plugins.orig/check_snmp_int.pl 2007-04-23 11:40:39.000000000 +0200 -+++ nagios_plugins/check_snmp_int.pl 2008-02-10 20:42:33.816718453 +0100 -@@ -1,4 +1,5 @@ - #!/usr/bin/perl -w -+# nagios: -epn - ############################## check_snmp_int ############## - # Version : 1.4.6 - # Date : April 23 2007 -diff -Nur nagios_plugins.orig/check_snmp_linkproof_nhr.pl nagios_plugins/check_snmp_linkproof_nhr.pl ---- nagios_plugins.orig/check_snmp_linkproof_nhr.pl 2006-08-26 14:37:12.000000000 +0200 -+++ nagios_plugins/check_snmp_linkproof_nhr.pl 2008-02-10 20:42:41.965577749 +0100 -@@ -1,4 +1,5 @@ - #!/usr/bin/perl -w -+# nagios: -epn - ############################## check_snmp_linkproof_nhr ################# - # Version : 1.0 - # Date : Aug 24 2006 -diff -Nur nagios_plugins.orig/check_snmp_load.pl nagios_plugins/check_snmp_load.pl ---- nagios_plugins.orig/check_snmp_load.pl 2007-04-16 19:41:20.000000000 +0200 -+++ nagios_plugins/check_snmp_load.pl 2008-02-10 20:42:49.700444194 +0100 -@@ -1,4 +1,5 @@ - #!/usr/bin/perl -w -+# nagios: -epn - ############################## check_snmp_load ################# - # Version : 1.3.2 - # Date : Jan 16 2007 -diff -Nur nagios_plugins.orig/check_snmp_mem.pl nagios_plugins/check_snmp_mem.pl ---- nagios_plugins.orig/check_snmp_mem.pl 2006-07-09 22:52:37.000000000 +0200 -+++ nagios_plugins/check_snmp_mem.pl 2008-02-10 20:42:58.441293269 +0100 -@@ -1,4 +1,5 @@ - #!/usr/bin/perl -w -+# nagios: -epn - ############################## check_snmp_mem ############## - # Version : 1.1 - # Date : Jul 09 2006 -diff -Nur nagios_plugins.orig/check_snmp_nsbox.pl nagios_plugins/check_snmp_nsbox.pl ---- nagios_plugins.orig/check_snmp_nsbox.pl 2007-01-16 23:55:21.000000000 +0100 -+++ nagios_plugins/check_snmp_nsbox.pl 2008-02-10 20:43:06.286157817 +0100 -@@ -1,4 +1,5 @@ - #!/usr/bin/perl -w -+# nagios: -epn - ############################## check_snmp_nsbox ################# - # Version : 1.0 - # Date : Jan 16 2007 -diff -Nur nagios_plugins.orig/check_snmp_process.pl nagios_plugins/check_snmp_process.pl ---- nagios_plugins.orig/check_snmp_process.pl 2007-03-12 21:36:02.000000000 +0100 -+++ nagios_plugins/check_snmp_process.pl 2008-02-10 20:43:15.957990819 +0100 -@@ -1,4 +1,5 @@ - #!/usr/bin/perl -w -+# nagios: -epn - ############################## check_snmp_process ############## - # Version : 1.4 - # Date : March 12 2007 -diff -Nur nagios_plugins.orig/check_snmp_storage.pl nagios_plugins/check_snmp_storage.pl ---- nagios_plugins.orig/check_snmp_storage.pl 2007-03-12 22:01:36.000000000 +0100 -+++ nagios_plugins/check_snmp_storage.pl 2008-02-10 20:43:23.024868799 +0100 -@@ -1,4 +1,5 @@ - #!/usr/bin/perl -w -+# nagios: -epn - ############################## check_snmp_storage ############## - # Version : 1.3.2 - # Date : March 12 2007 -diff -Nur nagios_plugins.orig/check_snmp_vrrp.pl nagios_plugins/check_snmp_vrrp.pl ---- nagios_plugins.orig/check_snmp_vrrp.pl 2006-08-23 23:39:48.000000000 +0200 -+++ nagios_plugins/check_snmp_vrrp.pl 2008-02-10 20:43:30.870733331 +0100 -@@ -1,4 +1,5 @@ - #!/usr/bin/perl -w -+# nagios: -epn - ############################## check_snmp_vrrp ############## - # Version : 1.3 - # Date : Aug 23 2006 -diff -Nur nagios_plugins.orig/check_snmp_win.pl nagios_plugins/check_snmp_win.pl ---- nagios_plugins.orig/check_snmp_win.pl 2006-11-29 20:59:55.000000000 +0100 -+++ nagios_plugins/check_snmp_win.pl 2008-02-10 20:43:40.407568666 +0100 -@@ -1,4 +1,5 @@ - #!/usr/bin/perl -w -+# nagios: -epn - ############################## check_snmp_win ############## - # Version : 0.6 - # Date : Nov 29 2006 diff --git a/debian/patches/99_disable_epn.dpatch b/debian/patches/99_disable_epn.dpatch new file mode 100644 index 0000000..1c504fd --- /dev/null +++ b/debian/patches/99_disable_epn.dpatch @@ -0,0 +1,133 @@ +#!/bin/sh /usr/share/dpatch/dpatch-run +## 50_disable_epn.dpatch by Jan Wagner +## +## DP: leave marks to disable epn + +@DPATCH@ + +diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_boostedge.pl nagios-snmp-plugins-1.1.1/check_snmp_boostedge.pl +--- nagios-snmp-plugins-1.1.1.orig/check_snmp_boostedge.pl 2007-01-16 23:57:14.000000000 +0100 ++++ nagios-snmp-plugins-1.1.1/check_snmp_boostedge.pl 2008-05-23 14:09:04.000000000 +0200 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_boostedge.pl ################# + # Version : 1.0 + # Date : Jan 16 2007 +diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_cpfw.pl nagios-snmp-plugins-1.1.1/check_snmp_cpfw.pl +--- nagios-snmp-plugins-1.1.1.orig/check_snmp_cpfw.pl 2007-04-20 00:03:30.000000000 +0200 ++++ nagios-snmp-plugins-1.1.1/check_snmp_cpfw.pl 2008-05-23 14:09:09.000000000 +0200 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_cpfw ############## + # Version : 1.2.1 + # Date : April 19 2007 +diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_css_main.pl nagios-snmp-plugins-1.1.1/check_snmp_css_main.pl +--- nagios-snmp-plugins-1.1.1.orig/check_snmp_css_main.pl 2006-10-05 23:40:55.000000000 +0200 ++++ nagios-snmp-plugins-1.1.1/check_snmp_css_main.pl 2008-05-23 14:09:25.000000000 +0200 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_css_main.pl ################# + # Version : 1.0 + # Date : 27 Sept 2006 +diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_css.pl nagios-snmp-plugins-1.1.1/check_snmp_css.pl +--- nagios-snmp-plugins-1.1.1.orig/check_snmp_css.pl 2007-01-11 17:06:08.000000000 +0100 ++++ nagios-snmp-plugins-1.1.1/check_snmp_css.pl 2008-05-23 14:09:18.000000000 +0200 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_css.pl ################# + # Version : 1.0.1 + # Date : 27 Sept 2006 +diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_env.pl nagios-snmp-plugins-1.1.1/check_snmp_env.pl +--- nagios-snmp-plugins-1.1.1.orig/check_snmp_env.pl 2008-05-23 14:05:14.000000000 +0200 ++++ nagios-snmp-plugins-1.1.1/check_snmp_env.pl 2008-05-23 14:09:32.000000000 +0200 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_env ################# + # Version : 1.3 + # Date : May 24 2007 +diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_int.pl nagios-snmp-plugins-1.1.1/check_snmp_int.pl +--- nagios-snmp-plugins-1.1.1.orig/check_snmp_int.pl 2008-05-23 14:05:14.000000000 +0200 ++++ nagios-snmp-plugins-1.1.1/check_snmp_int.pl 2008-05-23 14:09:39.000000000 +0200 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_int ############## + my $Version='1.24'; + # Date : Oct 10 2007 +diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_linkproof_nhr.pl nagios-snmp-plugins-1.1.1/check_snmp_linkproof_nhr.pl +--- nagios-snmp-plugins-1.1.1.orig/check_snmp_linkproof_nhr.pl 2006-08-26 14:37:12.000000000 +0200 ++++ nagios-snmp-plugins-1.1.1/check_snmp_linkproof_nhr.pl 2008-05-23 14:09:46.000000000 +0200 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_linkproof_nhr ################# + # Version : 1.0 + # Date : Aug 24 2006 +diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_load.pl nagios-snmp-plugins-1.1.1/check_snmp_load.pl +--- nagios-snmp-plugins-1.1.1.orig/check_snmp_load.pl 2008-05-23 14:05:14.000000000 +0200 ++++ nagios-snmp-plugins-1.1.1/check_snmp_load.pl 2008-05-23 14:09:52.000000000 +0200 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_load ################# + my $Version='1.12'; + # Date : Oct 12 2007 +diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_mem.pl nagios-snmp-plugins-1.1.1/check_snmp_mem.pl +--- nagios-snmp-plugins-1.1.1.orig/check_snmp_mem.pl 2006-07-09 22:52:37.000000000 +0200 ++++ nagios-snmp-plugins-1.1.1/check_snmp_mem.pl 2008-05-23 14:09:58.000000000 +0200 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_mem ############## + # Version : 1.1 + # Date : Jul 09 2006 +diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_nsbox.pl nagios-snmp-plugins-1.1.1/check_snmp_nsbox.pl +--- nagios-snmp-plugins-1.1.1.orig/check_snmp_nsbox.pl 2007-01-16 23:55:21.000000000 +0100 ++++ nagios-snmp-plugins-1.1.1/check_snmp_nsbox.pl 2008-05-23 14:10:04.000000000 +0200 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_nsbox ################# + # Version : 1.0 + # Date : Jan 16 2007 +diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_process.pl nagios-snmp-plugins-1.1.1/check_snmp_process.pl +--- nagios-snmp-plugins-1.1.1.orig/check_snmp_process.pl 2008-05-23 14:05:14.000000000 +0200 ++++ nagios-snmp-plugins-1.1.1/check_snmp_process.pl 2008-05-23 14:10:10.000000000 +0200 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_process ############## + my $Version='1.10'; + # Date : Oct 12 2007 +diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_storage.pl nagios-snmp-plugins-1.1.1/check_snmp_storage.pl +--- nagios-snmp-plugins-1.1.1.orig/check_snmp_storage.pl 2008-05-23 14:05:14.000000000 +0200 ++++ nagios-snmp-plugins-1.1.1/check_snmp_storage.pl 2008-05-23 14:10:15.000000000 +0200 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_storage ############## + # Version : 1.3.3 + # Date : Jun 1 2007 +diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_vrrp.pl nagios-snmp-plugins-1.1.1/check_snmp_vrrp.pl +--- nagios-snmp-plugins-1.1.1.orig/check_snmp_vrrp.pl 2006-08-23 23:39:48.000000000 +0200 ++++ nagios-snmp-plugins-1.1.1/check_snmp_vrrp.pl 2008-05-23 14:10:21.000000000 +0200 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_vrrp ############## + # Version : 1.3 + # Date : Aug 23 2006 +diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_win.pl nagios-snmp-plugins-1.1.1/check_snmp_win.pl +--- nagios-snmp-plugins-1.1.1.orig/check_snmp_win.pl 2008-05-23 14:05:14.000000000 +0200 ++++ nagios-snmp-plugins-1.1.1/check_snmp_win.pl 2008-05-23 14:10:26.000000000 +0200 +@@ -1,4 +1,5 @@ + #!/usr/bin/perl -w ++# nagios: -epn + ############################## check_snmp_win ############## + my $Version='1.1'; + # Date : Oct 12 2007 From 0f71dd79a87294a473004f4bdad2f2dc80484fe3 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 23 May 2008 12:22:19 +0000 Subject: [PATCH 020/205] update changelog and rename epn patch --- debian/changelog | 4 +++- debian/patches/00list | 2 +- .../patches/{99_disable_epn.dpatch => 50_disable_epn.dpatch} | 0 3 files changed, 4 insertions(+), 2 deletions(-) rename debian/patches/{99_disable_epn.dpatch => 50_disable_epn.dpatch} (100%) diff --git a/debian/changelog b/debian/changelog index 2e98ffb..676b3d4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,8 @@ nagios-snmp-plugins (1.1.1-4) UNRELEASED; urgency=low - * adjust copyright, it's GPL2 (and not later) + * adjust copyright, it's GPL2 (and not later) + * update some scripts to newest available version from website + * patch plugins with epn header to not use EPN when it's available -- Jan Wagner Thu, 24 Apr 2008 01:55:58 +0200 diff --git a/debian/patches/00list b/debian/patches/00list index d2f695f..f6f0d7b 100644 --- a/debian/patches/00list +++ b/debian/patches/00list @@ -4,4 +4,4 @@ 04_check_snmp_process.dpatch 05_check_snmp_storage.dpatch 06_check_snmp_win.dpatch -99_disable_epn.dpatch +50_disable_epn.dpatch diff --git a/debian/patches/99_disable_epn.dpatch b/debian/patches/50_disable_epn.dpatch similarity index 100% rename from debian/patches/99_disable_epn.dpatch rename to debian/patches/50_disable_epn.dpatch From 015f36405317f831454a1d9de3badf9f0801d9d7 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 23 May 2008 12:58:07 +0000 Subject: [PATCH 021/205] we hat the epn patch allready included with the last package revision --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 676b3d4..5a6997a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,7 +2,7 @@ nagios-snmp-plugins (1.1.1-4) UNRELEASED; urgency=low * adjust copyright, it's GPL2 (and not later) * update some scripts to newest available version from website - * patch plugins with epn header to not use EPN when it's available + * rename 02_disable_epn.dpatch to 50_disable_epn.dpatch to be the last one -- Jan Wagner Thu, 24 Apr 2008 01:55:58 +0200 From f1d41e8f6fc2f15862bec22391e8eeb0e689b8cc Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 4 Jun 2008 08:34:50 +0000 Subject: [PATCH 022/205] add number of bugreport --- debian/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/changelog b/debian/changelog index 5a6997a..5d1cf26 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,7 @@ nagios-snmp-plugins (1.1.1-4) UNRELEASED; urgency=low * adjust copyright, it's GPL2 (and not later) * update some scripts to newest available version from website * rename 02_disable_epn.dpatch to 50_disable_epn.dpatch to be the last one + (Closes: #484462) -- Jan Wagner Thu, 24 Apr 2008 01:55:58 +0200 From 2f70a5eb26f1c0c7fafad24f1085032608d54039 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sat, 7 Jun 2008 09:42:21 +0000 Subject: [PATCH 023/205] Updating standards version to 3.8.0 --- debian/changelog | 1 + debian/control | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 5d1cf26..a73875b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,7 @@ nagios-snmp-plugins (1.1.1-4) UNRELEASED; urgency=low * update some scripts to newest available version from website * rename 02_disable_epn.dpatch to 50_disable_epn.dpatch to be the last one (Closes: #484462) + * Updating standards version to 3.8.0, no changes needed -- Jan Wagner Thu, 24 Apr 2008 01:55:58 +0200 diff --git a/debian/control b/debian/control index 3b5cf1c..f0038d2 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Build-Depends: debhelper (>= 5), dpatch Homepage: http://www.manubulon.com/nagios/index_snmp.html Vcs-Browser: http://svn.debian.org/wsvn/pkg-nagios/nagios-snmp-plugins/ Vcs-Svn: svn://svn.debian.org/pkg-nagios/nagios-snmp-plugins/ -Standards-Version: 3.7.3 +Standards-Version: 3.8.0 Package: nagios-snmp-plugins Architecture: all From 6a3958f3640b341dac1eb790d6d433a647c141c5 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 7 Jul 2008 20:41:07 +0000 Subject: [PATCH 024/205] release --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index a73875b..2c9b2a2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -nagios-snmp-plugins (1.1.1-4) UNRELEASED; urgency=low +nagios-snmp-plugins (1.1.1-4) unstable; urgency=low * adjust copyright, it's GPL2 (and not later) * update some scripts to newest available version from website @@ -6,7 +6,7 @@ nagios-snmp-plugins (1.1.1-4) UNRELEASED; urgency=low (Closes: #484462) * Updating standards version to 3.8.0, no changes needed - -- Jan Wagner Thu, 24 Apr 2008 01:55:58 +0200 + -- Jan Wagner Mon, 07 Jul 2008 22:08:37 +0200 nagios-snmp-plugins (1.1.1-3) unstable; urgency=low From 68acff0cd29cfc228be4d953410e79ede2f27b02 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 7 Jul 2008 20:41:53 +0000 Subject: [PATCH 025/205] new package version --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 2c9b2a2..14d6a93 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +nagios-snmp-plugins (1.1.1-5) UNRELEASED; urgency=low + + * NOT RELEASED YET + + -- Jan Wagner Mon, 07 Jul 2008 22:41:32 +0200 + nagios-snmp-plugins (1.1.1-4) unstable; urgency=low * adjust copyright, it's GPL2 (and not later) From 25b9c60306aadca90c94c64edb3b07710743b55c Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 20 Jul 2008 11:17:29 +0000 Subject: [PATCH 026/205] machine-interpretable copyright --- debian/changelog | 2 +- debian/copyright | 37 +++++++++++++++++++++++++++---------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/debian/changelog b/debian/changelog index 14d6a93..71ba089 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,6 @@ nagios-snmp-plugins (1.1.1-5) UNRELEASED; urgency=low - * NOT RELEASED YET + * implement machine-interpretable copyright file -- Jan Wagner Mon, 07 Jul 2008 22:41:32 +0200 diff --git a/debian/copyright b/debian/copyright index 082f763..72a937e 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,14 +1,19 @@ -This package was debianized by Jan Wagner on -Tue, 5 Dec 2006 11:52:19 +0100. - -It was downloaded from - -Upstream Author: Patrick Proy (nagios at proy.org) +Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=196 +Packaged-By: Jan Wagner +Packaged-Date: Tue, 5 Dec 2006 11:52:19 +0100 +Upstream-Name: Nagios SNMP Plugins +Upstream-Maintainer: Patrick Proy (nagios at proy.org) +Upstream-Source: http://www.manubulon.com/nagios +Files: * Copyright: (C) 2004-2007 Patrick Proy (nagios at proy.org) +License: GPL-2 -License: +Files: debian/* +Copyright: (C) 2006, 2008 Jan Wagner +License: GPL-2+ +License: GPL-2 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. @@ -22,8 +27,20 @@ License: along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +License: GPL-2+ + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL file. - -The Debian packaging is (C) 2006-2008 Jan Wagner and -is licensed under the GPL, see `/usr/share/common-licenses/GPL'. From 322a7a7b30588c975f348c3ee46770bafcc24ffa Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 20 Jul 2008 11:17:56 +0000 Subject: [PATCH 027/205] prepare release --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 71ba089..fe36f77 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -nagios-snmp-plugins (1.1.1-5) UNRELEASED; urgency=low +nagios-snmp-plugins (1.1.1-5) unstable; urgency=low * implement machine-interpretable copyright file - -- Jan Wagner Mon, 07 Jul 2008 22:41:32 +0200 + -- Jan Wagner Sun, 20 Jul 2008 13:17:39 +0200 nagios-snmp-plugins (1.1.1-4) unstable; urgency=low From 87186a998f983f2aff5cd637b2a0f0e2e399b7e4 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 20 Jul 2008 13:47:44 +0000 Subject: [PATCH 028/205] new version --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index fe36f77..916cf4f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +nagios-snmp-plugins (1.1.1-6) UNRELEASED; urgency=low + + * NOT RELEASED YET + + -- Jan Wagner Sun, 20 Jul 2008 15:47:37 +0200 + nagios-snmp-plugins (1.1.1-5) unstable; urgency=low * implement machine-interpretable copyright file From a7d70f830c3a8447276e4acf320c5f0de82023fc Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 1 Feb 2009 22:51:34 +0000 Subject: [PATCH 029/205] add dependency of nagios-plugins-basic to get command definitions installed --- debian/changelog | 9 ++++++--- debian/control | 3 +-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index 916cf4f..d78dba9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,11 @@ -nagios-snmp-plugins (1.1.1-6) UNRELEASED; urgency=low +nagios-snmp-plugins (1.1.1-6) unstable; urgency=low - * NOT RELEASED YET + * instead of suggest depend on nagios-plugins-basic to get command + definitions installed into /etc/nagios-plugins/config and registered via + ucf, since /usr/share/nagios-plugins/dpkg/functions is used in postinst + (Closes: #513872) - -- Jan Wagner Sun, 20 Jul 2008 15:47:37 +0200 + -- Jan Wagner Sun, 01 Feb 2009 23:49:10 +0100 nagios-snmp-plugins (1.1.1-5) unstable; urgency=low diff --git a/debian/control b/debian/control index f0038d2..4de3338 100644 --- a/debian/control +++ b/debian/control @@ -11,7 +11,6 @@ Standards-Version: 3.8.0 Package: nagios-snmp-plugins Architecture: all -Depends: ${perl:Depends}, ${misc:Depends}, libnet-snmp-perl, perl-base (>= 5.8.4-8), ucf -Suggests: nagios-plugins-basic (>= 1.4.5-2) +Depends: ${perl:Depends}, ${misc:Depends}, libnet-snmp-perl, nagios-plugins-basic (>= 1.4.5-2), perl-base (>= 5.8.4-8), ucf Description: SNMP Plugins for nagios A set of Nagios plugins to check hosts/devices using snmp protocol From fadc8eb8abe07ff5e06db5a3c4fb09d12294600b Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 2 Feb 2009 23:16:26 +0000 Subject: [PATCH 030/205] new version --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index d78dba9..244b4e4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +nagios-snmp-plugins (1.1.1-7) UNRELEASED; urgency=low + + * NOT RELEASED YET + + -- Jan Wagner Tue, 03 Feb 2009 00:15:20 +0100 + nagios-snmp-plugins (1.1.1-6) unstable; urgency=low * instead of suggest depend on nagios-plugins-basic to get command From de4ff5bc1c8e6424abc3e0e4658cbe35c1e2559c Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sat, 25 Jul 2009 23:40:03 +0000 Subject: [PATCH 031/205] fixup copyright --- debian/changelog | 2 +- debian/copyright | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 244b4e4..88ea99a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,6 @@ nagios-snmp-plugins (1.1.1-7) UNRELEASED; urgency=low - * NOT RELEASED YET + * add "Copyright" to all copyrights in debian/copyright -- Jan Wagner Tue, 03 Feb 2009 00:15:20 +0100 diff --git a/debian/copyright b/debian/copyright index 72a937e..d853dd9 100644 --- a/debian/copyright +++ b/debian/copyright @@ -6,11 +6,11 @@ Upstream-Maintainer: Patrick Proy (nagios at proy.org) Upstream-Source: http://www.manubulon.com/nagios Files: * -Copyright: (C) 2004-2007 Patrick Proy (nagios at proy.org) +Copyright: Copyright (C) 2004-2007 Patrick Proy (nagios at proy.org) License: GPL-2 Files: debian/* -Copyright: (C) 2006, 2008 Jan Wagner +Copyright: Copyright (C) 2006, 2008 Jan Wagner License: GPL-2+ License: GPL-2 From a293226dd791dc73c322b85fa23dc831db35c873 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sat, 25 Jul 2009 23:47:50 +0000 Subject: [PATCH 032/205] bump standard to 3.8.2 --- debian/changelog | 1 + debian/control | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 88ea99a..4da2404 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ nagios-snmp-plugins (1.1.1-7) UNRELEASED; urgency=low * add "Copyright" to all copyrights in debian/copyright + * Bump Standards-Version to 3.8.2, no changes needed -- Jan Wagner Tue, 03 Feb 2009 00:15:20 +0100 diff --git a/debian/control b/debian/control index 4de3338..f2d262d 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Build-Depends: debhelper (>= 5), dpatch Homepage: http://www.manubulon.com/nagios/index_snmp.html Vcs-Browser: http://svn.debian.org/wsvn/pkg-nagios/nagios-snmp-plugins/ Vcs-Svn: svn://svn.debian.org/pkg-nagios/nagios-snmp-plugins/ -Standards-Version: 3.8.0 +Standards-Version: 3.8.2 Package: nagios-snmp-plugins Architecture: all From fdd99257dfadc5b0401f8bf1925b4954a30bc1b8 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Tue, 23 Feb 2010 15:36:26 +0000 Subject: [PATCH 033/205] * Updating standards version to 3.8.4 * Add 1.0 to debian/source/format --- debian/README.source | 3 +++ debian/changelog | 6 ++++-- debian/control | 2 +- debian/source/format | 1 + 4 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 debian/README.source create mode 100644 debian/source/format diff --git a/debian/README.source b/debian/README.source new file mode 100644 index 0000000..f0fe49a --- /dev/null +++ b/debian/README.source @@ -0,0 +1,3 @@ +We use dpatch for patch handling inside our package(s). Please see +/usr/share/doc/dpatch/README.source.gz (if you have installed dpatch) for +documentation about dpatch. diff --git a/debian/changelog b/debian/changelog index 4da2404..0b17f45 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,9 @@ nagios-snmp-plugins (1.1.1-7) UNRELEASED; urgency=low - * add "Copyright" to all copyrights in debian/copyright - * Bump Standards-Version to 3.8.2, no changes needed + * Add "Copyright" to all copyrights in debian/copyright + * Updating standards version to 3.8.4 + - Add README.source + * Add 1.0 to debian/source/format -- Jan Wagner Tue, 03 Feb 2009 00:15:20 +0100 diff --git a/debian/control b/debian/control index f2d262d..67a4822 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Build-Depends: debhelper (>= 5), dpatch Homepage: http://www.manubulon.com/nagios/index_snmp.html Vcs-Browser: http://svn.debian.org/wsvn/pkg-nagios/nagios-snmp-plugins/ Vcs-Svn: svn://svn.debian.org/pkg-nagios/nagios-snmp-plugins/ -Standards-Version: 3.8.2 +Standards-Version: 3.8.4 Package: nagios-snmp-plugins Architecture: all diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..d3827e7 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +1.0 From 32904b139fa59cde98e1128da978846c17b59d16 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 10 Mar 2010 08:12:01 +0000 Subject: [PATCH 034/205] Add trailing trunk/ at Vcs-Svn-field --- debian/changelog | 1 + debian/control | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 0b17f45..aa90f2f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,7 @@ nagios-snmp-plugins (1.1.1-7) UNRELEASED; urgency=low * Updating standards version to 3.8.4 - Add README.source * Add 1.0 to debian/source/format + * Add trailing trunk/ at Vcs-Svn-field -- Jan Wagner Tue, 03 Feb 2009 00:15:20 +0100 diff --git a/debian/control b/debian/control index 67a4822..fcfbe67 100644 --- a/debian/control +++ b/debian/control @@ -6,7 +6,7 @@ Uploaders: Jan Wagner Build-Depends: debhelper (>= 5), dpatch Homepage: http://www.manubulon.com/nagios/index_snmp.html Vcs-Browser: http://svn.debian.org/wsvn/pkg-nagios/nagios-snmp-plugins/ -Vcs-Svn: svn://svn.debian.org/pkg-nagios/nagios-snmp-plugins/ +Vcs-Svn: svn://svn.debian.org/pkg-nagios/nagios-snmp-plugins/trunk/ Standards-Version: 3.8.4 Package: nagios-snmp-plugins From cdad01dcd83792163c048e857c150d4b803a1c53 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 10 Mar 2010 09:19:08 +0000 Subject: [PATCH 035/205] prepare release --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index aa90f2f..3b69f9a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -nagios-snmp-plugins (1.1.1-7) UNRELEASED; urgency=low +nagios-snmp-plugins (1.1.1-7) unstable; urgency=low * Add "Copyright" to all copyrights in debian/copyright * Updating standards version to 3.8.4 @@ -6,7 +6,7 @@ nagios-snmp-plugins (1.1.1-7) UNRELEASED; urgency=low * Add 1.0 to debian/source/format * Add trailing trunk/ at Vcs-Svn-field - -- Jan Wagner Tue, 03 Feb 2009 00:15:20 +0100 + -- Jan Wagner Wed, 10 Mar 2010 10:18:35 +0100 nagios-snmp-plugins (1.1.1-6) unstable; urgency=low From e78e5722a745c1b0fadf2f75fa18f401839a416a Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 10 Mar 2010 09:22:56 +0000 Subject: [PATCH 036/205] new changelog --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 3b69f9a..26db7ed 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +nagios-snmp-plugins (1.1.1-8) UNRELEASED; urgency=low + + * NOT RELEASED YET + + -- Jan Wagner Wed, 10 Mar 2010 10:22:25 +0100 + nagios-snmp-plugins (1.1.1-7) unstable; urgency=low * Add "Copyright" to all copyrights in debian/copyright From abea817afe618544f01960a952ecb936eebbf79f Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Thu, 31 Jan 2013 08:22:09 +0000 Subject: [PATCH 037/205] compatibility for recent libnet-snmp-perl package --- debian/changelog | 7 +- debian/patches/00list | 1 + debian/patches/10_fix_net_snmp_version.dpatch | 451 ++++++++++++++++++ 3 files changed, 456 insertions(+), 3 deletions(-) create mode 100755 debian/patches/10_fix_net_snmp_version.dpatch diff --git a/debian/changelog b/debian/changelog index 26db7ed..1532d71 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,9 @@ -nagios-snmp-plugins (1.1.1-8) UNRELEASED; urgency=low +nagios-snmp-plugins (1.1.1-8) unstable; urgency=low - * NOT RELEASED YET + * Add 10_fix_net_snmp_version.dpatch + - Fixing Net::SNMP version (Closes: #699413) - -- Jan Wagner Wed, 10 Mar 2010 10:22:25 +0100 + -- Jan Wagner Thu, 31 Jan 2013 08:56:00 +0100 nagios-snmp-plugins (1.1.1-7) unstable; urgency=low diff --git a/debian/patches/00list b/debian/patches/00list index f6f0d7b..8da50ff 100644 --- a/debian/patches/00list +++ b/debian/patches/00list @@ -4,4 +4,5 @@ 04_check_snmp_process.dpatch 05_check_snmp_storage.dpatch 06_check_snmp_win.dpatch +10_fix_net_snmp_version.dpatch 50_disable_epn.dpatch diff --git a/debian/patches/10_fix_net_snmp_version.dpatch b/debian/patches/10_fix_net_snmp_version.dpatch new file mode 100755 index 0000000..83a5304 --- /dev/null +++ b/debian/patches/10_fix_net_snmp_version.dpatch @@ -0,0 +1,451 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 10_fix_net_snmp_version.dpatch by Jan Wagner +## +## DP: Fixing Net::SNMP version +## DP: (see https://wiki.icinga.org/display/howtos/check_snmp#checksnmp-Argumentv601isntnumericinnumericlt) + +@DPATCH@ +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-snmp-plugins-1.1.1~/check_snmp_boostedge.pl nagios-snmp-plugins-1.1.1/check_snmp_boostedge.pl +--- nagios-snmp-plugins-1.1.1~/check_snmp_boostedge.pl 2007-01-16 23:57:14.000000000 +0100 ++++ nagios-snmp-plugins-1.1.1/check_snmp_boostedge.pl 2013-01-31 08:38:55.000000000 +0100 +@@ -249,7 +249,7 @@ + + # Get global status + my @oidlist=($be_global_status); +-my $resultat = (Net::SNMP->VERSION < 4) ? ++my $resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_request(@oidlist) + : $session->get_request(-varbindlist => \@oidlist); + +@@ -266,7 +266,7 @@ + + $resultat=undef; + # Get service table +-$resultat = (Net::SNMP->VERSION < 4) ? ++$resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_table($be_service_table) + : $session->get_table(Baseoid => $be_service_table); + +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-snmp-plugins-1.1.1~/check_snmp_css.pl nagios-snmp-plugins-1.1.1/check_snmp_css.pl +--- nagios-snmp-plugins-1.1.1~/check_snmp_css.pl 2007-01-11 17:06:08.000000000 +0100 ++++ nagios-snmp-plugins-1.1.1/check_snmp_css.pl 2013-01-31 08:38:55.000000000 +0100 +@@ -356,7 +356,7 @@ + } + close (FILE); + } else { +- $resultat = (Net::SNMP->VERSION < 4) ? ++ $resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_table($css_svc_name) + : $session->get_table(Baseoid => $css_svc_name); + +@@ -392,7 +392,7 @@ + } + + $resultat = undef; +-$resultat = (Net::SNMP->VERSION < 4) ? ++$resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_request(@oid_list) + : $session->get_request(-varbindlist => \@oid_list); + +@@ -402,7 +402,7 @@ + exit $ERRORS{"UNKNOWN"}; + } + my $resultat2 = undef; +-$resultat2 = (Net::SNMP->VERSION < 4) ? ++$resultat2 = (Net::SNMP->VERSION lt 4) ? + $session->get_request(@oid_list2) + : $session->get_request(-varbindlist => \@oid_list2); + +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-snmp-plugins-1.1.1~/check_snmp_css_main.pl nagios-snmp-plugins-1.1.1/check_snmp_css_main.pl +--- nagios-snmp-plugins-1.1.1~/check_snmp_css_main.pl 2006-10-05 23:40:55.000000000 +0200 ++++ nagios-snmp-plugins-1.1.1/check_snmp_css_main.pl 2013-01-31 08:38:55.000000000 +0100 +@@ -219,7 +219,7 @@ + ########### Cisco CSS checks ############## + + # Get load table +-my $resultat = (Net::SNMP->VERSION < 4) ? ++my $resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_table($css_svc_name) + : $session->get_table(Baseoid => $css_svc_name); + +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-snmp-plugins-1.1.1~/check_snmp_env.pl nagios-snmp-plugins-1.1.1/check_snmp_env.pl +--- nagios-snmp-plugins-1.1.1~/check_snmp_env.pl 2013-01-31 08:37:55.000000000 +0100 ++++ nagios-snmp-plugins-1.1.1/check_snmp_env.pl 2013-01-31 08:38:55.000000000 +0100 +@@ -390,7 +390,7 @@ + verb("Checking cisco env"); + + # Get load table +-my $resultat = (Net::SNMP->VERSION < 4) ? ++my $resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_table($ciscoEnvMonMIB) + : $session->get_table(Baseoid => $ciscoEnvMonMIB); + +@@ -594,7 +594,7 @@ + my $global_status=0; + my $output=""; + # get temp +-$resultat = (Net::SNMP->VERSION < 4) ? ++$resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_table($nokia_temp_tbl) + : $session->get_table(Baseoid => $nokia_temp_tbl); + if (defined($resultat)) { +@@ -609,7 +609,7 @@ + } + + # Get fan table +-$resultat = (Net::SNMP->VERSION < 4) ? ++$resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_table($nokia_fan_table) + : $session->get_table(Baseoid => $nokia_fan_table); + +@@ -631,7 +631,7 @@ + } + + # Get ps table +-$resultat = (Net::SNMP->VERSION < 4) ? ++$resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_table($nokia_ps_table) + : $session->get_table(Baseoid => $nokia_ps_table); + +@@ -697,7 +697,7 @@ + + + # get sensor table +- $resultat = (Net::SNMP->VERSION < 4) ? ++ $resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_table($bc_sensor_table) + : $session->get_table(Baseoid => $bc_sensor_table); + if (defined($resultat)) { +@@ -740,7 +740,7 @@ + } + + # Get disk table +- $resultat = (Net::SNMP->VERSION < 4) ? ++ $resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_table($bc_dsk_table) + : $session->get_table(Baseoid => $bc_dsk_table); + +@@ -811,7 +811,7 @@ + # get temp if $o_temp is defined + if (defined($o_temp)) { + verb("Checking temp < $o_temp"); +- $resultat = (Net::SNMP->VERSION < 4) ? ++ $resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_table($iron_tmp_table) + : $session->get_table(Baseoid => $iron_tmp_table); + if (defined($resultat)) { +@@ -843,7 +843,7 @@ + # Get fan status if $o_fan is defined + if (defined($o_fan)) { + verb("Checking fan > $o_fan"); +- $resultat = (Net::SNMP->VERSION < 4) ? ++ $resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_table($iron_fan_table) + : $session->get_table(Baseoid => $iron_fan_table); + if (defined($resultat)) { +@@ -874,7 +874,7 @@ + + # Get power supply status + verb("Checking PS"); +- $resultat = (Net::SNMP->VERSION < 4) ? ++ $resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_table($iron_ps_table) + : $session->get_table(Baseoid => $iron_ps_table); + if (defined($resultat)) { +@@ -966,7 +966,7 @@ + + # Get PS table (TODO : Bug in FAN table, see with Foundry). + +-my $result_ps = (Net::SNMP->VERSION < 4) ? ++my $result_ps = (Net::SNMP->VERSION lt 4) ? + $session->get_table($foundry_ps_table) + : $session->get_table(Baseoid => $foundry_ps_table); + +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-snmp-plugins-1.1.1~/check_snmp_linkproof_nhr.pl nagios-snmp-plugins-1.1.1/check_snmp_linkproof_nhr.pl +--- nagios-snmp-plugins-1.1.1~/check_snmp_linkproof_nhr.pl 2006-08-26 14:37:12.000000000 +0200 ++++ nagios-snmp-plugins-1.1.1/check_snmp_linkproof_nhr.pl 2013-01-31 08:38:56.000000000 +0100 +@@ -232,7 +232,7 @@ + my $global_status=0; + + # Get load table +-my $resultat = (Net::SNMP->VERSION < 4) ? ++my $resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_table($lp_type) + : $session->get_table(Baseoid => $lp_type); + +@@ -261,7 +261,7 @@ + } + + my $result=undef; +-if (Net::SNMP->VERSION < 4) { ++if (Net::SNMP->VERSION lt 4) { + $result = $session->get_request(@oids); + } else { + if ($session->version == 0) { +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-snmp-plugins-1.1.1~/check_snmp_load.pl nagios-snmp-plugins-1.1.1/check_snmp_load.pl +--- nagios-snmp-plugins-1.1.1~/check_snmp_load.pl 2013-01-31 08:37:55.000000000 +0100 ++++ nagios-snmp-plugins-1.1.1/check_snmp_load.pl 2013-01-31 08:38:56.000000000 +0100 +@@ -346,7 +346,7 @@ + + verb("Checking linux load"); + # Get load table +-my $resultat = (Net::SNMP->VERSION < 4) ? ++my $resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_table($linload_table) + : $session->get_table(Baseoid => $linload_table); + +@@ -410,7 +410,7 @@ + + if ($o_check_type eq "cisco") { + my @oidlists = ($cisco_cpu_5m, $cisco_cpu_1m, $cisco_cpu_5s); +-my $resultat = (Net::SNMP->VERSION < 4) ? ++my $resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_request(@oidlists) + : $session->get_request(-varbindlist => \@oidlists); + +@@ -465,7 +465,7 @@ + + if ($o_check_type eq "cata") { + my @oidlists = ($ciscocata_cpu_5m, $ciscocata_cpu_1m, $ciscocata_cpu_5s); +-my $resultat = (Net::SNMP->VERSION < 4) ? ++my $resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_request(@oidlists) + : $session->get_request(-varbindlist => \@oidlists); + +@@ -520,7 +520,7 @@ + + if ($o_check_type eq "nsc") { + my @oidlists = ($nsc_cpu_5m, $nsc_cpu_1m, $nsc_cpu_5s); +-my $resultat = (Net::SNMP->VERSION < 4) ? ++my $resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_request(@oidlists) + : $session->get_request(-varbindlist => \@oidlists); + +@@ -577,7 +577,7 @@ + # Get load table + my @oidlist = $cpu_oid{$o_check_type}; + verb("Checking OID : @oidlist"); +-my $resultat = (Net::SNMP->VERSION < 4) ? ++my $resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_request(@oidlist) + : $session->get_request(-varbindlist => \@oidlist); + if (!defined($resultat)) { +@@ -625,7 +625,7 @@ + verb("Checking hpux load"); + + my @oidlists = ($hpux_load_1_min, $hpux_load_5_min, $hpux_load_15_min); +-my $resultat = (Net::SNMP->VERSION < 4) ? ++my $resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_request(@oidlists) + : $session->get_request(-varbindlist => \@oidlists); + +@@ -678,7 +678,7 @@ + + ########## Standard cpu usage check ############ + # Get desctiption table +-my $resultat = (Net::SNMP->VERSION < 4) ? ++my $resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_table($base_proc) + : $session->get_table(Baseoid => $base_proc); + +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-snmp-plugins-1.1.1~/check_snmp_mem.pl nagios-snmp-plugins-1.1.1/check_snmp_mem.pl +--- nagios-snmp-plugins-1.1.1~/check_snmp_mem.pl 2006-07-09 22:52:37.000000000 +0200 ++++ nagios-snmp-plugins-1.1.1/check_snmp_mem.pl 2013-01-31 08:38:56.000000000 +0100 +@@ -316,7 +316,7 @@ + if (defined ($o_cisco)) { + + # Get Cisco memory table +- $resultat = (Net::SNMP->VERSION < 4) ? ++ $resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_table($cisco_mem_pool) + :$session->get_table(Baseoid => $cisco_mem_pool); + +@@ -393,7 +393,7 @@ + if (defined ($o_hp)) { + + # Get hp memory table +- $resultat = (Net::SNMP->VERSION < 4) ? ++ $resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_table($hp_mem_pool) + :$session->get_table(Baseoid => $hp_mem_pool); + +@@ -462,7 +462,7 @@ + if (defined ($o_netsnmp)) { + + # Get NetSNMP memory values +- $resultat = (Net::SNMP->VERSION < 4) ? ++ $resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_request(@nets_oids) + :$session->get_request(-varbindlist => \@nets_oids); + +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-snmp-plugins-1.1.1~/check_snmp_nsbox.pl nagios-snmp-plugins-1.1.1/check_snmp_nsbox.pl +--- nagios-snmp-plugins-1.1.1~/check_snmp_nsbox.pl 2007-01-16 23:55:21.000000000 +0100 ++++ nagios-snmp-plugins-1.1.1/check_snmp_nsbox.pl 2013-01-31 08:38:56.000000000 +0100 +@@ -265,7 +265,7 @@ + + ########### check global status ############## + my @oidlist=($ns_service_status); +-my $resultat = (Net::SNMP->VERSION < 4) ? ++my $resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_request(@oidlist) + : $session->get_request(-varbindlist => \@oidlist); + +@@ -282,7 +282,7 @@ + + ########### check vhost & diode status ############## + $resultat=undef; +-$resultat = (Net::SNMP->VERSION < 4) ? ++$resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_table($ns_service_table) + : $session->get_table(Baseoid => $ns_service_table); + +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-snmp-plugins-1.1.1~/check_snmp_process.pl nagios-snmp-plugins-1.1.1/check_snmp_process.pl +--- nagios-snmp-plugins-1.1.1~/check_snmp_process.pl 2013-01-31 08:37:55.000000000 +0100 ++++ nagios-snmp-plugins-1.1.1/check_snmp_process.pl 2013-01-31 08:38:56.000000000 +0100 +@@ -407,11 +407,11 @@ + my %result_cons=(); + my ($getall_run,$getall_cpu,$getall_mem)=(undef,undef,undef); + if ( !defined ($o_path) ) { +- $resultat = (Net::SNMP->VERSION < 4) ? ++ $resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_table($run_name_table) + : $session->get_table(Baseoid => $run_name_table); + } else { +- $resultat = (Net::SNMP->VERSION < 4) ? ++ $resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_table($run_path_table) + :$session->get_table(Baseoid => $run_path_table); + } +@@ -424,7 +424,7 @@ + + my $resultat_param=undef; + if (defined($o_param)) { # Get parameter table too +- $resultat_param = (Net::SNMP->VERSION < 4) ? ++ $resultat_param = (Net::SNMP->VERSION lt 4) ? + $session->get_table($run_param_table) + :$session->get_table(Baseoid => $run_param_table); + if (!defined($resultat_param)) { +@@ -436,7 +436,7 @@ + } + + if (defined ($o_get_all)) { +- $getall_run = (Net::SNMP->VERSION < 4) ? ++ $getall_run = (Net::SNMP->VERSION lt 4) ? + $session->get_table($proc_run_state ) + :$session->get_table(Baseoid => $proc_run_state ); + if (!defined($getall_run)) { +@@ -447,7 +447,7 @@ + foreach my $key ( keys %$getall_run) { + $result_cons{$key}=$$getall_run{$key}; + } +- $getall_cpu = (Net::SNMP->VERSION < 4) ? ++ $getall_cpu = (Net::SNMP->VERSION lt 4) ? + $session->get_table($proc_cpu_table) + : $session->get_table(Baseoid => $proc_cpu_table); + if (!defined($getall_cpu)) { +@@ -458,7 +458,7 @@ + foreach my $key ( keys %$getall_cpu) { + $result_cons{$key}=$$getall_cpu{$key}; + } +- $getall_mem = (Net::SNMP->VERSION < 4) ? ++ $getall_mem = (Net::SNMP->VERSION lt 4) ? + $session->get_table($proc_mem_table) + : $session->get_table(Baseoid => $proc_mem_table); + if (!defined($getall_mem)) { +@@ -539,7 +539,7 @@ + $toid[$i]=$oids[$i+$tmp_index]; + #verb("$i : $toid[$i] : $oids[$i+$tmp_index]"); + } +- $tmp_result = (Net::SNMP->VERSION < 4) ? ++ $tmp_result = (Net::SNMP->VERSION lt 4) ? + $session->get_request(@toid) + : $session->get_request(Varbindlist => \@toid); + if (!defined($tmp_result)) { printf("ERROR: running table : %s.\n", $session->error); $session->close; +@@ -551,7 +551,7 @@ + } + + } else { +- $result = (Net::SNMP->VERSION < 4) ? ++ $result = (Net::SNMP->VERSION lt 4) ? + $session->get_request(@oids) + : $session->get_request(Varbindlist => \@oids); + if (!defined($result)) { printf("ERROR: running table : %s.\n", $session->error); $session->close; +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-snmp-plugins-1.1.1~/check_snmp_storage.pl nagios-snmp-plugins-1.1.1/check_snmp_storage.pl +--- nagios-snmp-plugins-1.1.1~/check_snmp_storage.pl 2013-01-31 08:37:55.000000000 +0100 ++++ nagios-snmp-plugins-1.1.1/check_snmp_storage.pl 2013-01-31 08:38:56.000000000 +0100 +@@ -411,13 +411,13 @@ + # Get rid of UTF8 translation in case of accentuated caracters (thanks to Dimo Velev). + $session->translate(Net::SNMP->TRANSLATE_NONE); + if (defined ($o_index)){ +- if (Net::SNMP->VERSION < 4) { ++ if (Net::SNMP->VERSION lt 4) { + $resultat = $session->get_table($index_table); + } else { + $resultat = $session->get_table(Baseoid => $index_table); + } + } else { +- if (Net::SNMP->VERSION < 4) { ++ if (Net::SNMP->VERSION lt 4) { + $resultat = $session->get_table($descr_table); + } else { + $resultat = $session->get_table(Baseoid => $descr_table); +@@ -425,7 +425,7 @@ + } + #get storage typetable for reference + if (defined($o_storagetype)){ +- if (Net::SNMP->VERSION < 4) { ++ if (Net::SNMP->VERSION lt 4) { + $stype = $session->get_table($storagetype_table); + } else { + $stype = $session->get_table(Baseoid => $storagetype_table); +@@ -491,7 +491,7 @@ + + my $result=undef; + +-if (Net::SNMP->VERSION < 4) { ++if (Net::SNMP->VERSION lt 4) { + $result = $session->get_request(@oids); + } else { + if ($session->version == 0) { +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-snmp-plugins-1.1.1~/check_snmp_vrrp.pl nagios-snmp-plugins-1.1.1/check_snmp_vrrp.pl +--- nagios-snmp-plugins-1.1.1~/check_snmp_vrrp.pl 2006-08-23 23:39:48.000000000 +0200 ++++ nagios-snmp-plugins-1.1.1/check_snmp_vrrp.pl 2013-01-31 08:38:56.000000000 +0100 +@@ -306,7 +306,7 @@ + if ($o_type eq "ipso") { + # Get cluster table + my $resultat; +-if (Net::SNMP->VERSION < 4) { ++if (Net::SNMP->VERSION lt 4) { + $resultat = $session->get_table( $nokia_clust_table ); + } else { + $resultat = $session->get_table( Baseoid => $nokia_clust_table ); +@@ -364,7 +364,7 @@ + + # Get vrrp table + my $resultat; +-if (Net::SNMP->VERSION < 4) { ++if (Net::SNMP->VERSION lt 4) { + $resultat = $session->get_table( $base_vrrp{$o_type} ); + } else { + $resultat = $session->get_table( Baseoid => $base_vrrp{$o_type} ); +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-snmp-plugins-1.1.1~/check_snmp_win.pl nagios-snmp-plugins-1.1.1/check_snmp_win.pl +--- nagios-snmp-plugins-1.1.1~/check_snmp_win.pl 2013-01-31 08:37:55.000000000 +0100 ++++ nagios-snmp-plugins-1.1.1/check_snmp_win.pl 2013-01-31 08:38:56.000000000 +0100 +@@ -256,7 +256,7 @@ + # Look for process in name or path name table + my $resultat=undef; + +-$resultat = (Net::SNMP->VERSION < 4) ? ++$resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_table($win_serv_name) + : $session->get_table(Baseoid => $win_serv_name); + +@@ -314,7 +314,7 @@ + my $result=undef; + my $num_int_ok=0; + +-$result = (Net::SNMP->VERSION < 4) ? ++$result = (Net::SNMP->VERSION lt 4) ? + $session->get_request(@oids) + : $session->get_request(Varbindlist => \@oids); + From e45ee042fb2c8159908d35cbc1d108c1f1e54093 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Tue, 26 Nov 2013 22:40:57 +0100 Subject: [PATCH 038/205] Update Vcs-headers --- debian/control | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/control b/debian/control index fcfbe67..ab918bc 100644 --- a/debian/control +++ b/debian/control @@ -5,8 +5,8 @@ Maintainer: Debian Nagios Maintainer Group Build-Depends: debhelper (>= 5), dpatch Homepage: http://www.manubulon.com/nagios/index_snmp.html -Vcs-Browser: http://svn.debian.org/wsvn/pkg-nagios/nagios-snmp-plugins/ -Vcs-Svn: svn://svn.debian.org/pkg-nagios/nagios-snmp-plugins/trunk/ +Vcs-Browser: http://git.debian.org/?p=pkg-nagios/pkg-nagios-snmp-plugins.git +Vcs-Git: git://git.debian.org/pkg-nagios/pkg-nagios-snmp-plugins Standards-Version: 3.8.4 Package: nagios-snmp-plugins From baa90eb96d3ac332d886b99d7173c48dec6e05a3 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 17 Jan 2014 23:53:37 +0100 Subject: [PATCH 039/205] Use full binary path instead of $ macro in command definitions --- debian/README.Debian | 26 +++++++++++++------------- debian/pluginconfig/snmp_cpfw.cfg | 2 +- debian/pluginconfig/snmp_env.cfg | 6 +++--- debian/pluginconfig/snmp_int.cfg | 6 +++--- debian/pluginconfig/snmp_load.cfg | 6 +++--- debian/pluginconfig/snmp_mem.cfg | 6 +++--- debian/pluginconfig/snmp_process.cfg | 4 ++-- debian/pluginconfig/snmp_storage.cfg | 6 +++--- debian/pluginconfig/snmp_vrrp.cfg | 6 +++--- debian/pluginconfig/snmp_win.cfg | 2 +- 10 files changed, 35 insertions(+), 35 deletions(-) diff --git a/debian/README.Debian b/debian/README.Debian index e5092c7..41355cc 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -50,7 +50,7 @@ nagios-snmp-plugins for Debian define command { command_name check_snmp_cpfw_v3 - command_line $USER1$/check_snmp_cpfw.pl -H $HOSTADDRESS$ $USER8$ + command_line /usr/lib/nagios/plugins/check_snmp_cpfw.pl -H $HOSTADDRESS$ $USER8$ $ARG1$ } @@ -64,13 +64,13 @@ nagios-snmp-plugins for Debian define command { command_name check_snmp_load_v1 - command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ $USER7$ -T + command_line /usr/lib/nagios/plugins/check_snmp_load.pl -H $HOSTADDRESS$ $USER7$ -T $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } define command { command_name check_snmp_load_v3 - command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ $USER8$ -T + command_line /usr/lib/nagios/plugins/check_snmp_load.pl -H $HOSTADDRESS$ $USER8$ -T $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } @@ -98,13 +98,13 @@ nagios-snmp-plugins for Debian define command { command_name check_snmp_int_v1 - command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ $USER7$ -n + command_line /usr/lib/nagios/plugins/check_snmp_int.pl -H $HOSTADDRESS$ $USER7$ -n $ARG1$ $ARG2$ } define command{ command_name check_snmp_int_v3 - command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ $USER8$ -n + command_line /usr/lib/nagios/plugins/check_snmp_int.pl -H $HOSTADDRESS$ $USER8$ -n $ARG1$ $ARG2$ } @@ -122,13 +122,13 @@ nagios-snmp-plugins for Debian define command { command_name check_snmp_mem_v1 - command_line $USER1$/check_snmp_mem.pl -H $HOSTADDRESS$ $USER7$ $ARG1$ + command_line /usr/lib/nagios/plugins/check_snmp_mem.pl -H $HOSTADDRESS$ $USER7$ $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } define command { command_name check_snmp_mem_v3 - command_line $USER1$/check_snmp_mem.pl -H $HOSTADDRESS$ $USER8$ $ARG1$ + command_line /usr/lib/nagios/plugins/check_snmp_mem.pl -H $HOSTADDRESS$ $USER8$ $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } @@ -146,7 +146,7 @@ nagios-snmp-plugins for Debian define command { command_name check_snmp_process_v1 - command_line $USER1$/check_snmp_process.pl -H $HOSTADDRESS$ $USER7$ -n + command_line /usr/lib/nagios/plugins/check_snmp_process.pl -H $HOSTADDRESS$ $USER7$ -n $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } @@ -170,13 +170,13 @@ nagios-snmp-plugins for Debian define command { command_name check_snmp_storage_v1 - command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ $USER7$ -m + command_line /usr/lib/nagios/plugins/check_snmp_storage.pl -H $HOSTADDRESS$ $USER7$ -m $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } define command { command_name check_snmp_storage_v3 - command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ $USER8$ -m + command_line /usr/lib/nagios/plugins/check_snmp_storage.pl -H $HOSTADDRESS$ $USER8$ -m $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } @@ -208,13 +208,13 @@ nagios-snmp-plugins for Debian define command { command_name check_snmp_vrrp_v1 - command_line $USER1$/check_snmp_vrrp.pl -H $HOSTADDRESS$ $USER7$ -T + command_line /usr/lib/nagios/plugins/check_snmp_vrrp.pl -H $HOSTADDRESS$ $USER7$ -T $ARG1$ -s $ARG2$ } define command { command_name check_snmp_vrrp_v3 - command_line $USER1$/check_snmp_vrrp.pl -H $HOSTADDRESS$ $USER8$ -T + command_line /usr/lib/nagios/plugins/check_snmp_vrrp.pl -H $HOSTADDRESS$ $USER8$ -T $ARG1$ -s $ARG2$ } @@ -239,7 +239,7 @@ nagios-snmp-plugins for Debian define command { command_name check_win - command_line $USER1$/check_snmp_win.pl -H $HOSTADDRESS$ $USER7$ -n + command_line /usr/lib/nagios/plugins/check_snmp_win.pl -H $HOSTADDRESS$ $USER7$ -n $ARG2$ # comment community service(s) name } diff --git a/debian/pluginconfig/snmp_cpfw.cfg b/debian/pluginconfig/snmp_cpfw.cfg index 27810ab..eb9a5a5 100644 --- a/debian/pluginconfig/snmp_cpfw.cfg +++ b/debian/pluginconfig/snmp_cpfw.cfg @@ -4,5 +4,5 @@ # 'check_snmp_cpfw_v3' command definition define command { command_name check_snmp_cpfw_v3 - command_line $USER1$/check_snmp_cpfw.pl -H $HOSTADDRESS$ $USER9$ $ARG1$ + command_line /usr/lib/nagios/plugins/check_snmp_cpfw.pl -H $HOSTADDRESS$ $USER9$ $ARG1$ } diff --git a/debian/pluginconfig/snmp_env.cfg b/debian/pluginconfig/snmp_env.cfg index 1ab7d98..edc7f01 100644 --- a/debian/pluginconfig/snmp_env.cfg +++ b/debian/pluginconfig/snmp_env.cfg @@ -4,17 +4,17 @@ # 'check_snmp_env_v1' command definition define command { command_name check_snmp_env_v1 - command_line $USER1$/check_snmp_env.pl -H $HOSTADDRESS$ -C $ARG3$ -T $ARG1$ $ARG2$ + command_line /usr/lib/nagios/plugins/check_snmp_env.pl -H $HOSTADDRESS$ -C $ARG3$ -T $ARG1$ $ARG2$ } # 'check_snmp_env_v2' command definition define command { command_name check_snmp_env_v2 - command_line $USER1$/check_snmp_env.pl -H $HOSTADDRESS$ -C $ARG3$ -2 -T $ARG1$ $ARG2$ + command_line /usr/lib/nagios/plugins/check_snmp_env.pl -H $HOSTADDRESS$ -C $ARG3$ -2 -T $ARG1$ $ARG2$ } # 'check_snmp_env_v3' command definition define command { command_name check_snmp_env_v3 - command_line $USER1$/check_snmp_env.pl -H $HOSTADDRESS$ $USER9$ -T $ARG1$ $ARG2$ + command_line /usr/lib/nagios/plugins/check_snmp_env.pl -H $HOSTADDRESS$ $USER9$ -T $ARG1$ $ARG2$ } diff --git a/debian/pluginconfig/snmp_int.cfg b/debian/pluginconfig/snmp_int.cfg index 5e0dba6..9480b34 100644 --- a/debian/pluginconfig/snmp_int.cfg +++ b/debian/pluginconfig/snmp_int.cfg @@ -4,17 +4,17 @@ # 'check_snmp_int_v1' command definition define command { command_name check_snmp_int_v1 - command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ -C $ARG3$ -n $ARG1$ -B$ARG4$ $ARG2$ + command_line /usr/lib/nagios/plugins/check_snmp_int.pl -H $HOSTADDRESS$ -C $ARG3$ -n $ARG1$ -B$ARG4$ $ARG2$ } # 'check_snmp_int_v2' command definition define command { command_name check_snmp_int_v2 - command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ -C $ARG3$ -2 -n $ARG1$ -B$ARG4$ $ARG2$ + command_line /usr/lib/nagios/plugins/check_snmp_int.pl -H $HOSTADDRESS$ -C $ARG3$ -2 -n $ARG1$ -B$ARG4$ $ARG2$ } # 'check_snmp_int_v3' command definition define command { command_name check_snmp_int_v3 - command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ $USER9$ -n $ARG1$ -B$ARG4$ $ARG2$ + command_line /usr/lib/nagios/plugins/check_snmp_int.pl -H $HOSTADDRESS$ $USER9$ -n $ARG1$ -B$ARG4$ $ARG2$ } diff --git a/debian/pluginconfig/snmp_load.cfg b/debian/pluginconfig/snmp_load.cfg index f291d07..e3ddd55 100644 --- a/debian/pluginconfig/snmp_load.cfg +++ b/debian/pluginconfig/snmp_load.cfg @@ -4,17 +4,17 @@ # 'check_snmp_load_v1' command definition define command { command_name check_snmp_load_v1 - command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ -C $ARG5$ -T $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ + command_line /usr/lib/nagios/plugins/check_snmp_load.pl -H $HOSTADDRESS$ -C $ARG5$ -T $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } # 'check_snmp_load_v2' command definition define command { command_name check_snmp_load_v2 - command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ -C $ARG5$ -2 -T $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ + command_line /usr/lib/nagios/plugins/check_snmp_load.pl -H $HOSTADDRESS$ -C $ARG5$ -2 -T $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } # 'check_snmp_load_v3' command definition define command { command_name check_snmp_load_v3 - command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ $USER9$ -T $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ + command_line /usr/lib/nagios/plugins/check_snmp_load.pl -H $HOSTADDRESS$ $USER9$ -T $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } diff --git a/debian/pluginconfig/snmp_mem.cfg b/debian/pluginconfig/snmp_mem.cfg index 8fb3f29..29c9c6d 100644 --- a/debian/pluginconfig/snmp_mem.cfg +++ b/debian/pluginconfig/snmp_mem.cfg @@ -4,17 +4,17 @@ # 'check_snmp_mem_v1' command definition define command { command_name check_snmp_mem_v1 - command_line $USER1$/check_snmp_mem.pl -H $HOSTADDRESS$ -C $ARG5$ $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ + command_line /usr/lib/nagios/plugins/check_snmp_mem.pl -H $HOSTADDRESS$ -C $ARG5$ $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } # 'check_snmp_mem_v2' command definition define command { command_name check_snmp_mem_v2 - command_line $USER1$/check_snmp_mem.pl -H $HOSTADDRESS$ -C $ARG5$ -2 $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ + command_line /usr/lib/nagios/plugins/check_snmp_mem.pl -H $HOSTADDRESS$ -C $ARG5$ -2 $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } # 'check_snmp_mem_v3' command definition define command { command_name check_snmp_mem_v3 - command_line $USER1$/check_snmp_mem.pl -H $HOSTADDRESS$ $USER9$ $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ + command_line /usr/lib/nagios/plugins/check_snmp_mem.pl -H $HOSTADDRESS$ $USER9$ $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } diff --git a/debian/pluginconfig/snmp_process.cfg b/debian/pluginconfig/snmp_process.cfg index 1ce43e7..4692462 100644 --- a/debian/pluginconfig/snmp_process.cfg +++ b/debian/pluginconfig/snmp_process.cfg @@ -4,12 +4,12 @@ # 'check_snmp_process_v1' command definition define command { command_name check_snmp_process_v1 - command_line $USER1$/check_snmp_process.pl -H $HOSTADDRESS$ -C $ARG5$ -n $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ + command_line /usr/lib/nagios/plugins/check_snmp_process.pl -H $HOSTADDRESS$ -C $ARG5$ -n $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } # 'check_snmp_process_v2' command definition define command { command_name check_snmp_process_v2 - command_line $USER1$/check_snmp_process.pl -H $HOSTADDRESS$ -C $ARG5$ -2 -n $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ + command_line /usr/lib/nagios/plugins/check_snmp_process.pl -H $HOSTADDRESS$ -C $ARG5$ -2 -n $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } diff --git a/debian/pluginconfig/snmp_storage.cfg b/debian/pluginconfig/snmp_storage.cfg index e3df174..7d12b84 100644 --- a/debian/pluginconfig/snmp_storage.cfg +++ b/debian/pluginconfig/snmp_storage.cfg @@ -4,17 +4,17 @@ # 'check_snmp_storage_v1' command definition define command { command_name check_snmp_storage_v1 - command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ -C $ARG5$ -m $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ + command_line /usr/lib/nagios/plugins/check_snmp_storage.pl -H $HOSTADDRESS$ -C $ARG5$ -m $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } # 'check_snmp_storage_v2' command definition define command { command_name check_snmp_storage_v2 - command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ -C $ARG5$ -2 -m $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ + command_line /usr/lib/nagios/plugins/check_snmp_storage.pl -H $HOSTADDRESS$ -C $ARG5$ -2 -m $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } # 'check_snmp_storage_v3' command definition define command { command_name check_snmp_storage_v3 - command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ $USER9$ -m $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ + command_line /usr/lib/nagios/plugins/check_snmp_storage.pl -H $HOSTADDRESS$ $USER9$ -m $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } diff --git a/debian/pluginconfig/snmp_vrrp.cfg b/debian/pluginconfig/snmp_vrrp.cfg index fb5d5c3..be5ae2c 100644 --- a/debian/pluginconfig/snmp_vrrp.cfg +++ b/debian/pluginconfig/snmp_vrrp.cfg @@ -4,17 +4,17 @@ # 'check_snmp_vrrp_v1' command definition define command { command_name check_snmp_vrrp_v1 - command_line $USER1$/check_snmp_vrrp.pl -H $HOSTADDRESS$ -C $ARG3$ -T $ARG1$ -s $ARG2$ + command_line /usr/lib/nagios/plugins/check_snmp_vrrp.pl -H $HOSTADDRESS$ -C $ARG3$ -T $ARG1$ -s $ARG2$ } # 'check_snmp_vrrp_v2' command definition define command { command_name check_snmp_vrrp_v2 - command_line $USER1$/check_snmp_vrrp.pl -H $HOSTADDRESS$ -C $ARG3$ -2 -T $ARG1$ -s $ARG2$ + command_line /usr/lib/nagios/plugins/check_snmp_vrrp.pl -H $HOSTADDRESS$ -C $ARG3$ -2 -T $ARG1$ -s $ARG2$ } # 'check_snmp_vrrp_v3' command definition define command { command_name check_snmp_vrrp_v3 - command_line $USER1$/check_snmp_vrrp.pl -H $HOSTADDRESS$ $USER9$ -T $ARG1$ -s $ARG2$ + command_line /usr/lib/nagios/plugins/check_snmp_vrrp.pl -H $HOSTADDRESS$ $USER9$ -T $ARG1$ -s $ARG2$ } diff --git a/debian/pluginconfig/snmp_win.cfg b/debian/pluginconfig/snmp_win.cfg index 53fdf84..590da52 100644 --- a/debian/pluginconfig/snmp_win.cfg +++ b/debian/pluginconfig/snmp_win.cfg @@ -4,5 +4,5 @@ # 'check_win' command definition define command { command_name check_win - command_line $USER1$/check_snmp_win.pl -H $HOSTADDRESS$ -C $ARG3$ -n $ARG2$ + command_line /usr/lib/nagios/plugins/check_snmp_win.pl -H $HOSTADDRESS$ -C $ARG3$ -n $ARG2$ } From 258eb2eb89e4592a3c86a21f49bc35cc7a3f5067 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sat, 18 Jan 2014 00:19:18 +0100 Subject: [PATCH 040/205] check_snmp_storage: Add 64bit support --- debian/patches/00list | 1 + .../15_check_snmp_storage_64bit.dpatch | 168 ++++++++++++++++++ 2 files changed, 169 insertions(+) create mode 100644 debian/patches/15_check_snmp_storage_64bit.dpatch diff --git a/debian/patches/00list b/debian/patches/00list index 8da50ff..da00a76 100644 --- a/debian/patches/00list +++ b/debian/patches/00list @@ -5,4 +5,5 @@ 05_check_snmp_storage.dpatch 06_check_snmp_win.dpatch 10_fix_net_snmp_version.dpatch +15_check_snmp_storage_64bit.dpatch 50_disable_epn.dpatch diff --git a/debian/patches/15_check_snmp_storage_64bit.dpatch b/debian/patches/15_check_snmp_storage_64bit.dpatch new file mode 100644 index 0000000..e83c089 --- /dev/null +++ b/debian/patches/15_check_snmp_storage_64bit.dpatch @@ -0,0 +1,168 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 15_check_snmp_storage_64bit by Martin Fürstenau +## +## DP: Fixing Net::SNMP version +## DP: (see https://wiki.icinga.org/display/howtos/check_snmp#checksnmp-Argumentv601isntnumericinnumericlt) + +## @DPATCH@ +## From 144c57a0adda190000bef500f3274425cb90d6ba Mon Sep 17 00:00:00 2001 +## From: Michael Friedrich +## Date: Wed, 26 Sep 2012 16:32:40 +0200 +## Subject: [PATCH] =?UTF-8?q?apply=20check=5Fsnmp=5Fstorage=20patch=20and=20?= +## =?UTF-8?q?1.3.3=20from=20Martin=20F=C3=BCrstenau?= +## MIME-Version: 1.0 +## Content-Type: text/plain; charset=UTF-8 +## Content-Transfer-Encoding: 8bit +## +## http://www.monitoring-portal.org/wbb/index.php?page=Thread&threadID=12031 +--- + plugins/check_snmp_storage.pl | 54 ++++++++++++++++++++++++++++--------------- + 1 file changed, 36 insertions(+), 18 deletions(-) + +@DPATCH@ + +diff --git a/plugins/check_snmp_storage.pl b/plugins/check_snmp_storage.pl +index 1b8a398..a3c784f 100644 +--- a/plugins/check_snmp_storage.pl ++++ b/plugins/check_snmp_storage.pl +@@ -6,7 +6,7 @@ + # Help : http://nagios.manubulon.com + # Licence : GPL - http://www.fsf.org/licenses/gpl.txt + # TODO : +-# Contribs : Dimo Velev, Makina Corpus, A. Greiner-Bär ++# Contribs : Dimo Velev, Makina Corpus, A. Greiner-B\ufffdr + ################################################################# + # + # help : ./check_snmp_storage -h +@@ -80,7 +80,7 @@ + my $o_perf= undef; # Output performance data + my $o_short= undef; # Short output parameters + my @o_shortL= undef; # output type,where,cut +-my $o_reserve= 0; # % reserved blocks (A. Greiner-Bär patch) ++my $o_reserve= 0; # % reserved blocks (A. Greiner-B\ufffdr patch) + my $o_giga= undef; # output and levels in gigabytes instead of megabytes + # SNMPv3 specific + my $o_login= undef; # Login for snmpv3 +@@ -89,6 +89,7 @@ + my $o_authproto='md5'; # Auth protocol + my $o_privproto='des'; # Priv protocol + my $o_privpass= undef; # priv password ++my $UOM_float= 4; # decimal places + # SNMP Message size parameter (Makina Corpus contrib) + my $o_octetlength=undef; + +@@ -112,8 +113,10 @@ sub is_pattern_valid { # Test for things like "" or "+5-i" + + # Get the alarm signal (just in case snmp timout screws up) + $SIG{'ALRM'} = sub { +- print ("ERROR: General time-out (Alarm signal)\n"); +- exit $ERRORS{"UNKNOWN"}; ++# print ("ERROR: General time-out (Alarm signal)\n"); ++# exit $ERRORS{"UNKNOWN"}; ++ print ("Waiting for info\n"); ++ exit $ERRORS{"OK"}; + }; + + sub isnnum { # Return true if arg is not a number +@@ -315,7 +318,7 @@ sub check_options { + if (defined ($o_octetlength) && (isnnum($o_octetlength) || $o_octetlength > 65535 || $o_octetlength < 484 )) { + print "octet lenght must be < 65535 and > 484\n";print_usage(); exit $ERRORS{"UNKNOWN"}; + } +- #### reserved blocks checks (A. Greiner-Bär patch). ++ #### reserved blocks checks (A. Greiner-B\ufffdr patch). + if (defined ($o_reserve) && (isnnum($o_reserve) || $o_reserve > 99 || $o_reserve < 0 )) { + print "reserved blocks must be < 100 and >= 0\n";print_usage(); exit $ERRORS{"UNKNOWN"}; + } +@@ -348,6 +351,7 @@ sub check_options { + -authpassword => $o_passwd, + -authprotocol => $o_authproto, + -port => $o_port, ++ -retries => 10, + -timeout => $o_timeout + ); + } else { +@@ -361,6 +365,7 @@ sub check_options { + -privpassword => $o_privpass, + -privprotocol => $o_privproto, + -port => $o_port, ++ -retries => 10, + -timeout => $o_timeout + ); + } +@@ -373,6 +378,7 @@ sub check_options { + -version => 2, + -community => $o_community, + -port => $o_port, ++ -retries => 10, + -timeout => $o_timeout + ); + } else { +@@ -382,6 +388,7 @@ sub check_options { + -hostname => $o_host, + -community => $o_community, + -port => $o_port, ++ -retries => 10, + -timeout => $o_timeout + ); + } +@@ -491,18 +498,28 @@ sub check_options { + + my $result=undef; + +-if (Net::SNMP->VERSION lt 4) { +- $result = $session->get_request(@oids); +-} else { +- if ($session->version == 0) { +- # snmpv1 +- $result = $session->get_request(Varbindlist => \@oids); +- } else { +- # snmp v2c or v3 : get_bulk_request is not really good for this, so do simple get +- $result = $session->get_request(Varbindlist => \@oids); +- foreach my $key ( keys %$result) { verb("$key : $$result{$key}"); } +- } +-} ++if (Net::SNMP->VERSION lt 4) ++ { ++ $result = $session->get_request(@oids); ++ } ++else ++ { ++ $result = $session->get_request(Varbindlist => \@oids); ++ foreach my $key ( keys %$result) ++ { ++ # Fix for filesystems larger 2 TB. More than 2 TB will cause an error because ++ # as defined in the RFC hrStorageSize is a 32 bit integer. So filesystems ++ # larger 2 TB report a negative value because the first bit will be interpreted ++ # as an algebraic sign. (0 = +, all others will be -). You simply have to add ++ # 2 to the power of 32 (4294967296) and it is fixed. ++ # Martin Fuerstenau, Oce Printing Systems, 25th Sept 2012 ++ if ($$result{$key} < 0) ++ { ++ $$result{$key} = $$result{$key} + 4294967296; ++ } ++ verb("$key x $$result{$key}"); ++ } ++ } + + if (!defined($result)) { printf("ERROR: Size table :%s.\n", $session->error); $session->close; + exit $ERRORS{"UNKNOWN"}; +@@ -547,6 +564,7 @@ sub check_options { + verb("Size : $$result{$size_table . $tindex[$i]}"); + verb("Used : $$result{$used_table . $tindex[$i]}"); + verb("Alloc : $$result{$alloc_units . $tindex[$i]}"); ++ + if (!defined($$result{$size_table . $tindex[$i]}) || + !defined($$result{$used_table . $tindex[$i]}) || + !defined ($$result{$alloc_units . $tindex[$i]})) { +@@ -623,7 +641,7 @@ sub check_options { + } + } + # Performance output (in MB) +- $perf_out .= "'".$Pdescr. "'=" . round($bu,0) . $output_metric ."B;" . round($p_warn,0) ++ $perf_out .= "'".$Pdescr. "'=" . round($bu,$UOM_float) . $output_metric ."B;" . round($p_warn,0) + . ";" . round($p_crit,0) . ";0;" . round($to,0); + } + +-- +1.8.5.1 + From 1dfc537f8a1a415add0b09226a978df8de92507b Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 19 Feb 2014 22:35:36 +0100 Subject: [PATCH 041/205] Convert the package to source format 3.0 (quilt) --- debian/control | 2 +- debian/patches/00list | 9 --------- .../{01_check_snmp_env.dpatch => 01_check_snmp_env} | 5 +---- .../{02_check_snmp_int.dpatch => 02_check_snmp_int} | 5 +---- .../{03_check_snmp_load.dpatch => 03_check_snmp_load} | 5 +---- ...4_check_snmp_process.dpatch => 04_check_snmp_process} | 5 +---- ...5_check_snmp_storage.dpatch => 05_check_snmp_storage} | 5 +---- .../{06_check_snmp_win.dpatch => 06_check_snmp_win} | 5 +---- ...x_net_snmp_version.dpatch => 10_fix_net_snmp_version} | 4 +--- ..._storage_64bit.dpatch => 15_check_snmp_storage_64bit} | 4 ---- debian/patches/{50_disable_epn.dpatch => 50_disable_epn} | 5 +---- debian/patches/series | 9 +++++++++ debian/rules | 6 ++---- debian/source/format | 2 +- 14 files changed, 21 insertions(+), 50 deletions(-) delete mode 100644 debian/patches/00list rename debian/patches/{01_check_snmp_env.dpatch => 01_check_snmp_env} (97%) rename debian/patches/{02_check_snmp_int.dpatch => 02_check_snmp_int} (99%) rename debian/patches/{03_check_snmp_load.dpatch => 03_check_snmp_load} (92%) rename debian/patches/{04_check_snmp_process.dpatch => 04_check_snmp_process} (98%) rename debian/patches/{05_check_snmp_storage.dpatch => 05_check_snmp_storage} (98%) rename debian/patches/{06_check_snmp_win.dpatch => 06_check_snmp_win} (94%) rename debian/patches/{10_fix_net_snmp_version.dpatch => 10_fix_net_snmp_version} (99%) rename debian/patches/{15_check_snmp_storage_64bit.dpatch => 15_check_snmp_storage_64bit} (99%) rename debian/patches/{50_disable_epn.dpatch => 50_disable_epn} (98%) create mode 100644 debian/patches/series diff --git a/debian/control b/debian/control index ab918bc..37526c6 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: net Priority: optional Maintainer: Debian Nagios Maintainer Group Uploaders: Jan Wagner -Build-Depends: debhelper (>= 5), dpatch +Build-Depends: debhelper (>= 5) Homepage: http://www.manubulon.com/nagios/index_snmp.html Vcs-Browser: http://git.debian.org/?p=pkg-nagios/pkg-nagios-snmp-plugins.git Vcs-Git: git://git.debian.org/pkg-nagios/pkg-nagios-snmp-plugins diff --git a/debian/patches/00list b/debian/patches/00list deleted file mode 100644 index da00a76..0000000 --- a/debian/patches/00list +++ /dev/null @@ -1,9 +0,0 @@ -01_check_snmp_env.dpatch -02_check_snmp_int.dpatch -03_check_snmp_load.dpatch -04_check_snmp_process.dpatch -05_check_snmp_storage.dpatch -06_check_snmp_win.dpatch -10_fix_net_snmp_version.dpatch -15_check_snmp_storage_64bit.dpatch -50_disable_epn.dpatch diff --git a/debian/patches/01_check_snmp_env.dpatch b/debian/patches/01_check_snmp_env similarity index 97% rename from debian/patches/01_check_snmp_env.dpatch rename to debian/patches/01_check_snmp_env index 9fcd9f6..c093cf8 100644 --- a/debian/patches/01_check_snmp_env.dpatch +++ b/debian/patches/01_check_snmp_env @@ -1,10 +1,7 @@ -#!/bin/sh /usr/share/dpatch/dpatch-run -## 01_check_snmp_env.dpatch by Jan Wagner +## 01_check_snmp_env by Jan Wagner ## ## DP: Fix some issues via cvs version -@DPATCH@ - --- old/check_snmp_env.pl 2007-07-04 09:46:55.000000000 +0200 +++ new/check_snmp_env.pl 2007-07-06 22:17:06.000000000 +0200 @@ -1,7 +1,7 @@ diff --git a/debian/patches/02_check_snmp_int.dpatch b/debian/patches/02_check_snmp_int similarity index 99% rename from debian/patches/02_check_snmp_int.dpatch rename to debian/patches/02_check_snmp_int index 964478d..3ef2053 100644 --- a/debian/patches/02_check_snmp_int.dpatch +++ b/debian/patches/02_check_snmp_int @@ -1,10 +1,7 @@ -#!/bin/sh /usr/share/dpatch/dpatch-run -## 02_check_snmp_int.dpatch by Jan Wagner +## 02_check_snmp_int by Jan Wagner ## ## DP: Update script to version 1.24 -@DPATCH@ - diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_int.pl nagios-snmp-plugins-1.1.1/check_snmp_int.pl --- nagios-snmp-plugins-1.1.1.orig/check_snmp_int.pl 2007-04-23 11:40:39.000000000 +0200 diff --git a/debian/patches/03_check_snmp_load.dpatch b/debian/patches/03_check_snmp_load similarity index 92% rename from debian/patches/03_check_snmp_load.dpatch rename to debian/patches/03_check_snmp_load index e0dc967..9539b73 100644 --- a/debian/patches/03_check_snmp_load.dpatch +++ b/debian/patches/03_check_snmp_load @@ -1,10 +1,7 @@ -#!/bin/sh /usr/share/dpatch/dpatch-run -## 03_check_snmp_load.dpatch by Jan Wagner +## 03_check_snmp_load by Jan Wagner ## ## DP: Update script to version 1.12 -@DPATCH@ - diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_load.pl nagios-snmp-plugins-1.1.1/check_snmp_load.pl --- nagios-snmp-plugins-1.1.1.orig/check_snmp_load.pl 2007-04-16 19:41:20.000000000 +0200 +++ nagios-snmp-plugins-1.1.1/check_snmp_load.pl 2007-10-12 22:23:23.000000000 +0200 diff --git a/debian/patches/04_check_snmp_process.dpatch b/debian/patches/04_check_snmp_process similarity index 98% rename from debian/patches/04_check_snmp_process.dpatch rename to debian/patches/04_check_snmp_process index 858421a..4476752 100644 --- a/debian/patches/04_check_snmp_process.dpatch +++ b/debian/patches/04_check_snmp_process @@ -1,10 +1,7 @@ -#!/bin/sh /usr/share/dpatch/dpatch-run -## 04_check_snmp_process.dpatch by Jan Wagner +## 04_check_snmp_process by Jan Wagner ## ## DP: Update script to version 1.10 -@DPATCH@ - diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_process.pl nagios-snmp-plugins-1.1.1/check_snmp_process.pl --- nagios-snmp-plugins-1.1.1.orig/check_snmp_process.pl 2007-03-12 21:36:02.000000000 +0100 +++ nagios-snmp-plugins-1.1.1/check_snmp_process.pl 2007-10-12 22:23:24.000000000 +0200 diff --git a/debian/patches/05_check_snmp_storage.dpatch b/debian/patches/05_check_snmp_storage similarity index 98% rename from debian/patches/05_check_snmp_storage.dpatch rename to debian/patches/05_check_snmp_storage index 99f8208..c7c675d 100644 --- a/debian/patches/05_check_snmp_storage.dpatch +++ b/debian/patches/05_check_snmp_storage @@ -1,10 +1,7 @@ -#!/bin/sh /usr/share/dpatch/dpatch-run -## 05_check_snmp_storage.dpatch by Jan Wagner +## 05_check_snmp_storage by Jan Wagner ## ## DP: Update script to version 1.3.3 -@DPATCH@ - diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_storage.pl nagios-snmp-plugins-1.1.1/check_snmp_storage.pl --- nagios-snmp-plugins-1.1.1.orig/check_snmp_storage.pl 2007-03-12 22:01:36.000000000 +0100 +++ nagios-snmp-plugins-1.1.1/check_snmp_storage.pl 2007-10-12 22:23:24.000000000 +0200 diff --git a/debian/patches/06_check_snmp_win.dpatch b/debian/patches/06_check_snmp_win similarity index 94% rename from debian/patches/06_check_snmp_win.dpatch rename to debian/patches/06_check_snmp_win index bee1eed..01a721a 100644 --- a/debian/patches/06_check_snmp_win.dpatch +++ b/debian/patches/06_check_snmp_win @@ -1,10 +1,7 @@ -#!/bin/sh /usr/share/dpatch/dpatch-run -## 06_check_snmp_win.dpatch by Jan Wagner +## 06_check_snmp_win by Jan Wagner ## ## DP: Update script to version 1.1 -@DPATCH@ - diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_win.pl nagios-snmp-plugins-1.1.1/check_snmp_win.pl --- nagios-snmp-plugins-1.1.1.orig/check_snmp_win.pl 2006-11-29 20:59:55.000000000 +0100 +++ nagios-snmp-plugins-1.1.1/check_snmp_win.pl 2007-10-12 22:23:25.000000000 +0200 diff --git a/debian/patches/10_fix_net_snmp_version.dpatch b/debian/patches/10_fix_net_snmp_version similarity index 99% rename from debian/patches/10_fix_net_snmp_version.dpatch rename to debian/patches/10_fix_net_snmp_version index 83a5304..c8cb20c 100755 --- a/debian/patches/10_fix_net_snmp_version.dpatch +++ b/debian/patches/10_fix_net_snmp_version @@ -1,10 +1,8 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## 10_fix_net_snmp_version.dpatch by Jan Wagner +## 10_fix_net_snmp_version by Jan Wagner ## ## DP: Fixing Net::SNMP version ## DP: (see https://wiki.icinga.org/display/howtos/check_snmp#checksnmp-Argumentv601isntnumericinnumericlt) -@DPATCH@ diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-snmp-plugins-1.1.1~/check_snmp_boostedge.pl nagios-snmp-plugins-1.1.1/check_snmp_boostedge.pl --- nagios-snmp-plugins-1.1.1~/check_snmp_boostedge.pl 2007-01-16 23:57:14.000000000 +0100 +++ nagios-snmp-plugins-1.1.1/check_snmp_boostedge.pl 2013-01-31 08:38:55.000000000 +0100 diff --git a/debian/patches/15_check_snmp_storage_64bit.dpatch b/debian/patches/15_check_snmp_storage_64bit similarity index 99% rename from debian/patches/15_check_snmp_storage_64bit.dpatch rename to debian/patches/15_check_snmp_storage_64bit index e83c089..aaa291a 100644 --- a/debian/patches/15_check_snmp_storage_64bit.dpatch +++ b/debian/patches/15_check_snmp_storage_64bit @@ -1,10 +1,8 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run ## 15_check_snmp_storage_64bit by Martin Fürstenau ## ## DP: Fixing Net::SNMP version ## DP: (see https://wiki.icinga.org/display/howtos/check_snmp#checksnmp-Argumentv601isntnumericinnumericlt) -## @DPATCH@ ## From 144c57a0adda190000bef500f3274425cb90d6ba Mon Sep 17 00:00:00 2001 ## From: Michael Friedrich ## Date: Wed, 26 Sep 2012 16:32:40 +0200 @@ -19,8 +17,6 @@ plugins/check_snmp_storage.pl | 54 ++++++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 18 deletions(-) -@DPATCH@ - diff --git a/plugins/check_snmp_storage.pl b/plugins/check_snmp_storage.pl index 1b8a398..a3c784f 100644 --- a/plugins/check_snmp_storage.pl diff --git a/debian/patches/50_disable_epn.dpatch b/debian/patches/50_disable_epn similarity index 98% rename from debian/patches/50_disable_epn.dpatch rename to debian/patches/50_disable_epn index 1c504fd..5cec8b8 100644 --- a/debian/patches/50_disable_epn.dpatch +++ b/debian/patches/50_disable_epn @@ -1,10 +1,7 @@ -#!/bin/sh /usr/share/dpatch/dpatch-run -## 50_disable_epn.dpatch by Jan Wagner +## 50_disable_epn by Jan Wagner ## ## DP: leave marks to disable epn -@DPATCH@ - diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_boostedge.pl nagios-snmp-plugins-1.1.1/check_snmp_boostedge.pl --- nagios-snmp-plugins-1.1.1.orig/check_snmp_boostedge.pl 2007-01-16 23:57:14.000000000 +0100 +++ nagios-snmp-plugins-1.1.1/check_snmp_boostedge.pl 2008-05-23 14:09:04.000000000 +0200 diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..919403b --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,9 @@ +01_check_snmp_env +02_check_snmp_int +03_check_snmp_load +04_check_snmp_process +05_check_snmp_storage +06_check_snmp_win +10_fix_net_snmp_version +15_check_snmp_storage_64bit +50_disable_epn diff --git a/debian/rules b/debian/rules index c5fdedd..6e83254 100755 --- a/debian/rules +++ b/debian/rules @@ -3,8 +3,6 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -include /usr/share/dpatch/dpatch.make - COMMANDDEFPATH:=/etc/nagios-plugins/config/ NP_DIR:=debian/nagios-snmp-plugins NP_TEMPLATES:=$(NP_DIR)/usr/share/nagios-snmp-plugins/pluginconfig @@ -13,9 +11,9 @@ NP_LIBEXEC:=/usr/lib/nagios/plugins plugin_cfgs:=snmp_cpfw snmp_env snmp_int snmp_load snmp_mem snmp_process \ snmp_storage snmp_vrrp snmp_win -build: patch-stamp +build: -clean: unpatch +clean: dh_testdir dh_testroot diff --git a/debian/source/format b/debian/source/format index d3827e7..163aaf8 100644 --- a/debian/source/format +++ b/debian/source/format @@ -1 +1 @@ -1.0 +3.0 (quilt) From 09c4c1b92b30cf8c7709888541c35959fa213343 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 19 Feb 2014 22:40:41 +0100 Subject: [PATCH 042/205] Fix 15_check_snmp_storage_64bit --- debian/patches/15_check_snmp_storage_64bit | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/debian/patches/15_check_snmp_storage_64bit b/debian/patches/15_check_snmp_storage_64bit index aaa291a..4fbb0d7 100644 --- a/debian/patches/15_check_snmp_storage_64bit +++ b/debian/patches/15_check_snmp_storage_64bit @@ -14,13 +14,13 @@ ## ## http://www.monitoring-portal.org/wbb/index.php?page=Thread&threadID=12031 --- - plugins/check_snmp_storage.pl | 54 ++++++++++++++++++++++++++++--------------- + check_snmp_storage.pl | 54 ++++++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 18 deletions(-) -diff --git a/plugins/check_snmp_storage.pl b/plugins/check_snmp_storage.pl +diff --git a/check_snmp_storage.pl b/check_snmp_storage.pl index 1b8a398..a3c784f 100644 ---- a/plugins/check_snmp_storage.pl -+++ b/plugins/check_snmp_storage.pl +--- a/check_snmp_storage.pl ++++ b/check_snmp_storage.pl @@ -6,7 +6,7 @@ # Help : http://nagios.manubulon.com # Licence : GPL - http://www.fsf.org/licenses/gpl.txt From 1bb96e11dd202201ca5635217351912e53995337 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Thu, 13 Feb 2014 22:43:33 +0100 Subject: [PATCH 043/205] Add travis-ci config --- .travis.yml | 15 +++++++++++++++ debian/source/options | 1 + 2 files changed, 16 insertions(+) create mode 100644 .travis.yml create mode 100644 debian/source/options diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..52fa260 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,15 @@ +language: c + +install: + - sudo apt-get update -qq + - sudo apt-get install -qq --no-install-recommends devscripts libwww-perl + - uscan --force-download + - sudo apt-get purge -qq libwww-perl + - sudo apt-get autoremove -qq + - sudo apt-get install -qq --no-install-recommends debhelper dpatch + +script: + - debuild -uc -us + +#notifications: +# email: false diff --git a/debian/source/options b/debian/source/options new file mode 100644 index 0000000..a729099 --- /dev/null +++ b/debian/source/options @@ -0,0 +1 @@ +extend-diff-ignore = '^\.travis' From b8ad984e16d5dd94d70ad76bf8cadf0fbc7ac156 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 16 Feb 2014 23:10:52 +0100 Subject: [PATCH 044/205] Reorder and comment .travis.yml --- .travis.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 52fa260..08d63ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,22 @@ language: c -install: +before_install: + # update package list - sudo apt-get update -qq + # installneeded packages for uscan - sudo apt-get install -qq --no-install-recommends devscripts libwww-perl + # download original tarball - uscan --force-download + # remove packages needed for uscan - sudo apt-get purge -qq libwww-perl - sudo apt-get autoremove -qq + +install: + # install build dependencies - sudo apt-get install -qq --no-install-recommends debhelper dpatch script: + # build the debian package - debuild -uc -us #notifications: From 95479b578fb8c47116a8c86e6cb4c629c9e46dbc Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 16 Feb 2014 23:21:16 +0100 Subject: [PATCH 045/205] update git ignore regex --- debian/source/options | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/source/options b/debian/source/options index a729099..f9deab5 100644 --- a/debian/source/options +++ b/debian/source/options @@ -1 +1 @@ -extend-diff-ignore = '^\.travis' +extend-diff-ignore = '(^|/)(\.travis\.yml|\.git|\.gitgnore|config\.sub|config\.guess)$' From be2cd6ae28e0dcf2b1d5372a31a41a5ddb4ee11a Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Tue, 25 Feb 2014 14:06:22 +0100 Subject: [PATCH 046/205] Add lintian checks after build --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 08d63ff..f0db5e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,5 +19,9 @@ script: # build the debian package - debuild -uc -us +after_script: + # run lintian after build + - sudo apt-get install -qq --no-install-recommends lintian + - lintian --info --display-info --display-experimental --pedantic --show-overrides ../*.deb && lintian --info --display-info --display-experimental --pedantic --show-overrides ../*.dsc #notifications: # email: false From 976e30772041b8d3e97ccfbc10ff87f2f3d92060 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Tue, 26 Nov 2013 22:40:57 +0100 Subject: [PATCH 047/205] Update Vcs-headers --- debian/control | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/control b/debian/control index fcfbe67..73e1bc2 100644 --- a/debian/control +++ b/debian/control @@ -5,8 +5,8 @@ Maintainer: Debian Nagios Maintainer Group Build-Depends: debhelper (>= 5), dpatch Homepage: http://www.manubulon.com/nagios/index_snmp.html -Vcs-Browser: http://svn.debian.org/wsvn/pkg-nagios/nagios-snmp-plugins/ -Vcs-Svn: svn://svn.debian.org/pkg-nagios/nagios-snmp-plugins/trunk/ +Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-nagios/pkg-nagios-snmp-plugins.git +Vcs-Git: git://anonscm.debian.org/pkg-nagios/pkg-nagios-snmp-plugins Standards-Version: 3.8.4 Package: nagios-snmp-plugins From 950a63f57cc7268329da0c9cee9a06830a106ef1 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 17 Jan 2014 23:53:37 +0100 Subject: [PATCH 048/205] Use full binary path instead of $ macro in command definitions --- debian/README.Debian | 26 +++++++++++++------------- debian/pluginconfig/snmp_cpfw.cfg | 2 +- debian/pluginconfig/snmp_env.cfg | 6 +++--- debian/pluginconfig/snmp_int.cfg | 6 +++--- debian/pluginconfig/snmp_load.cfg | 6 +++--- debian/pluginconfig/snmp_mem.cfg | 6 +++--- debian/pluginconfig/snmp_process.cfg | 4 ++-- debian/pluginconfig/snmp_storage.cfg | 6 +++--- debian/pluginconfig/snmp_vrrp.cfg | 6 +++--- debian/pluginconfig/snmp_win.cfg | 2 +- 10 files changed, 35 insertions(+), 35 deletions(-) diff --git a/debian/README.Debian b/debian/README.Debian index e5092c7..41355cc 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -50,7 +50,7 @@ nagios-snmp-plugins for Debian define command { command_name check_snmp_cpfw_v3 - command_line $USER1$/check_snmp_cpfw.pl -H $HOSTADDRESS$ $USER8$ + command_line /usr/lib/nagios/plugins/check_snmp_cpfw.pl -H $HOSTADDRESS$ $USER8$ $ARG1$ } @@ -64,13 +64,13 @@ nagios-snmp-plugins for Debian define command { command_name check_snmp_load_v1 - command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ $USER7$ -T + command_line /usr/lib/nagios/plugins/check_snmp_load.pl -H $HOSTADDRESS$ $USER7$ -T $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } define command { command_name check_snmp_load_v3 - command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ $USER8$ -T + command_line /usr/lib/nagios/plugins/check_snmp_load.pl -H $HOSTADDRESS$ $USER8$ -T $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } @@ -98,13 +98,13 @@ nagios-snmp-plugins for Debian define command { command_name check_snmp_int_v1 - command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ $USER7$ -n + command_line /usr/lib/nagios/plugins/check_snmp_int.pl -H $HOSTADDRESS$ $USER7$ -n $ARG1$ $ARG2$ } define command{ command_name check_snmp_int_v3 - command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ $USER8$ -n + command_line /usr/lib/nagios/plugins/check_snmp_int.pl -H $HOSTADDRESS$ $USER8$ -n $ARG1$ $ARG2$ } @@ -122,13 +122,13 @@ nagios-snmp-plugins for Debian define command { command_name check_snmp_mem_v1 - command_line $USER1$/check_snmp_mem.pl -H $HOSTADDRESS$ $USER7$ $ARG1$ + command_line /usr/lib/nagios/plugins/check_snmp_mem.pl -H $HOSTADDRESS$ $USER7$ $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } define command { command_name check_snmp_mem_v3 - command_line $USER1$/check_snmp_mem.pl -H $HOSTADDRESS$ $USER8$ $ARG1$ + command_line /usr/lib/nagios/plugins/check_snmp_mem.pl -H $HOSTADDRESS$ $USER8$ $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } @@ -146,7 +146,7 @@ nagios-snmp-plugins for Debian define command { command_name check_snmp_process_v1 - command_line $USER1$/check_snmp_process.pl -H $HOSTADDRESS$ $USER7$ -n + command_line /usr/lib/nagios/plugins/check_snmp_process.pl -H $HOSTADDRESS$ $USER7$ -n $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } @@ -170,13 +170,13 @@ nagios-snmp-plugins for Debian define command { command_name check_snmp_storage_v1 - command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ $USER7$ -m + command_line /usr/lib/nagios/plugins/check_snmp_storage.pl -H $HOSTADDRESS$ $USER7$ -m $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } define command { command_name check_snmp_storage_v3 - command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ $USER8$ -m + command_line /usr/lib/nagios/plugins/check_snmp_storage.pl -H $HOSTADDRESS$ $USER8$ -m $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } @@ -208,13 +208,13 @@ nagios-snmp-plugins for Debian define command { command_name check_snmp_vrrp_v1 - command_line $USER1$/check_snmp_vrrp.pl -H $HOSTADDRESS$ $USER7$ -T + command_line /usr/lib/nagios/plugins/check_snmp_vrrp.pl -H $HOSTADDRESS$ $USER7$ -T $ARG1$ -s $ARG2$ } define command { command_name check_snmp_vrrp_v3 - command_line $USER1$/check_snmp_vrrp.pl -H $HOSTADDRESS$ $USER8$ -T + command_line /usr/lib/nagios/plugins/check_snmp_vrrp.pl -H $HOSTADDRESS$ $USER8$ -T $ARG1$ -s $ARG2$ } @@ -239,7 +239,7 @@ nagios-snmp-plugins for Debian define command { command_name check_win - command_line $USER1$/check_snmp_win.pl -H $HOSTADDRESS$ $USER7$ -n + command_line /usr/lib/nagios/plugins/check_snmp_win.pl -H $HOSTADDRESS$ $USER7$ -n $ARG2$ # comment community service(s) name } diff --git a/debian/pluginconfig/snmp_cpfw.cfg b/debian/pluginconfig/snmp_cpfw.cfg index 27810ab..eb9a5a5 100644 --- a/debian/pluginconfig/snmp_cpfw.cfg +++ b/debian/pluginconfig/snmp_cpfw.cfg @@ -4,5 +4,5 @@ # 'check_snmp_cpfw_v3' command definition define command { command_name check_snmp_cpfw_v3 - command_line $USER1$/check_snmp_cpfw.pl -H $HOSTADDRESS$ $USER9$ $ARG1$ + command_line /usr/lib/nagios/plugins/check_snmp_cpfw.pl -H $HOSTADDRESS$ $USER9$ $ARG1$ } diff --git a/debian/pluginconfig/snmp_env.cfg b/debian/pluginconfig/snmp_env.cfg index 1ab7d98..edc7f01 100644 --- a/debian/pluginconfig/snmp_env.cfg +++ b/debian/pluginconfig/snmp_env.cfg @@ -4,17 +4,17 @@ # 'check_snmp_env_v1' command definition define command { command_name check_snmp_env_v1 - command_line $USER1$/check_snmp_env.pl -H $HOSTADDRESS$ -C $ARG3$ -T $ARG1$ $ARG2$ + command_line /usr/lib/nagios/plugins/check_snmp_env.pl -H $HOSTADDRESS$ -C $ARG3$ -T $ARG1$ $ARG2$ } # 'check_snmp_env_v2' command definition define command { command_name check_snmp_env_v2 - command_line $USER1$/check_snmp_env.pl -H $HOSTADDRESS$ -C $ARG3$ -2 -T $ARG1$ $ARG2$ + command_line /usr/lib/nagios/plugins/check_snmp_env.pl -H $HOSTADDRESS$ -C $ARG3$ -2 -T $ARG1$ $ARG2$ } # 'check_snmp_env_v3' command definition define command { command_name check_snmp_env_v3 - command_line $USER1$/check_snmp_env.pl -H $HOSTADDRESS$ $USER9$ -T $ARG1$ $ARG2$ + command_line /usr/lib/nagios/plugins/check_snmp_env.pl -H $HOSTADDRESS$ $USER9$ -T $ARG1$ $ARG2$ } diff --git a/debian/pluginconfig/snmp_int.cfg b/debian/pluginconfig/snmp_int.cfg index 5e0dba6..9480b34 100644 --- a/debian/pluginconfig/snmp_int.cfg +++ b/debian/pluginconfig/snmp_int.cfg @@ -4,17 +4,17 @@ # 'check_snmp_int_v1' command definition define command { command_name check_snmp_int_v1 - command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ -C $ARG3$ -n $ARG1$ -B$ARG4$ $ARG2$ + command_line /usr/lib/nagios/plugins/check_snmp_int.pl -H $HOSTADDRESS$ -C $ARG3$ -n $ARG1$ -B$ARG4$ $ARG2$ } # 'check_snmp_int_v2' command definition define command { command_name check_snmp_int_v2 - command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ -C $ARG3$ -2 -n $ARG1$ -B$ARG4$ $ARG2$ + command_line /usr/lib/nagios/plugins/check_snmp_int.pl -H $HOSTADDRESS$ -C $ARG3$ -2 -n $ARG1$ -B$ARG4$ $ARG2$ } # 'check_snmp_int_v3' command definition define command { command_name check_snmp_int_v3 - command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ $USER9$ -n $ARG1$ -B$ARG4$ $ARG2$ + command_line /usr/lib/nagios/plugins/check_snmp_int.pl -H $HOSTADDRESS$ $USER9$ -n $ARG1$ -B$ARG4$ $ARG2$ } diff --git a/debian/pluginconfig/snmp_load.cfg b/debian/pluginconfig/snmp_load.cfg index f291d07..e3ddd55 100644 --- a/debian/pluginconfig/snmp_load.cfg +++ b/debian/pluginconfig/snmp_load.cfg @@ -4,17 +4,17 @@ # 'check_snmp_load_v1' command definition define command { command_name check_snmp_load_v1 - command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ -C $ARG5$ -T $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ + command_line /usr/lib/nagios/plugins/check_snmp_load.pl -H $HOSTADDRESS$ -C $ARG5$ -T $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } # 'check_snmp_load_v2' command definition define command { command_name check_snmp_load_v2 - command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ -C $ARG5$ -2 -T $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ + command_line /usr/lib/nagios/plugins/check_snmp_load.pl -H $HOSTADDRESS$ -C $ARG5$ -2 -T $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } # 'check_snmp_load_v3' command definition define command { command_name check_snmp_load_v3 - command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ $USER9$ -T $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ + command_line /usr/lib/nagios/plugins/check_snmp_load.pl -H $HOSTADDRESS$ $USER9$ -T $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } diff --git a/debian/pluginconfig/snmp_mem.cfg b/debian/pluginconfig/snmp_mem.cfg index 8fb3f29..29c9c6d 100644 --- a/debian/pluginconfig/snmp_mem.cfg +++ b/debian/pluginconfig/snmp_mem.cfg @@ -4,17 +4,17 @@ # 'check_snmp_mem_v1' command definition define command { command_name check_snmp_mem_v1 - command_line $USER1$/check_snmp_mem.pl -H $HOSTADDRESS$ -C $ARG5$ $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ + command_line /usr/lib/nagios/plugins/check_snmp_mem.pl -H $HOSTADDRESS$ -C $ARG5$ $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } # 'check_snmp_mem_v2' command definition define command { command_name check_snmp_mem_v2 - command_line $USER1$/check_snmp_mem.pl -H $HOSTADDRESS$ -C $ARG5$ -2 $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ + command_line /usr/lib/nagios/plugins/check_snmp_mem.pl -H $HOSTADDRESS$ -C $ARG5$ -2 $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } # 'check_snmp_mem_v3' command definition define command { command_name check_snmp_mem_v3 - command_line $USER1$/check_snmp_mem.pl -H $HOSTADDRESS$ $USER9$ $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ + command_line /usr/lib/nagios/plugins/check_snmp_mem.pl -H $HOSTADDRESS$ $USER9$ $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } diff --git a/debian/pluginconfig/snmp_process.cfg b/debian/pluginconfig/snmp_process.cfg index 1ce43e7..4692462 100644 --- a/debian/pluginconfig/snmp_process.cfg +++ b/debian/pluginconfig/snmp_process.cfg @@ -4,12 +4,12 @@ # 'check_snmp_process_v1' command definition define command { command_name check_snmp_process_v1 - command_line $USER1$/check_snmp_process.pl -H $HOSTADDRESS$ -C $ARG5$ -n $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ + command_line /usr/lib/nagios/plugins/check_snmp_process.pl -H $HOSTADDRESS$ -C $ARG5$ -n $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } # 'check_snmp_process_v2' command definition define command { command_name check_snmp_process_v2 - command_line $USER1$/check_snmp_process.pl -H $HOSTADDRESS$ -C $ARG5$ -2 -n $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ + command_line /usr/lib/nagios/plugins/check_snmp_process.pl -H $HOSTADDRESS$ -C $ARG5$ -2 -n $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } diff --git a/debian/pluginconfig/snmp_storage.cfg b/debian/pluginconfig/snmp_storage.cfg index e3df174..7d12b84 100644 --- a/debian/pluginconfig/snmp_storage.cfg +++ b/debian/pluginconfig/snmp_storage.cfg @@ -4,17 +4,17 @@ # 'check_snmp_storage_v1' command definition define command { command_name check_snmp_storage_v1 - command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ -C $ARG5$ -m $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ + command_line /usr/lib/nagios/plugins/check_snmp_storage.pl -H $HOSTADDRESS$ -C $ARG5$ -m $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } # 'check_snmp_storage_v2' command definition define command { command_name check_snmp_storage_v2 - command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ -C $ARG5$ -2 -m $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ + command_line /usr/lib/nagios/plugins/check_snmp_storage.pl -H $HOSTADDRESS$ -C $ARG5$ -2 -m $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } # 'check_snmp_storage_v3' command definition define command { command_name check_snmp_storage_v3 - command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ $USER9$ -m $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ + command_line /usr/lib/nagios/plugins/check_snmp_storage.pl -H $HOSTADDRESS$ $USER9$ -m $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$ } diff --git a/debian/pluginconfig/snmp_vrrp.cfg b/debian/pluginconfig/snmp_vrrp.cfg index fb5d5c3..be5ae2c 100644 --- a/debian/pluginconfig/snmp_vrrp.cfg +++ b/debian/pluginconfig/snmp_vrrp.cfg @@ -4,17 +4,17 @@ # 'check_snmp_vrrp_v1' command definition define command { command_name check_snmp_vrrp_v1 - command_line $USER1$/check_snmp_vrrp.pl -H $HOSTADDRESS$ -C $ARG3$ -T $ARG1$ -s $ARG2$ + command_line /usr/lib/nagios/plugins/check_snmp_vrrp.pl -H $HOSTADDRESS$ -C $ARG3$ -T $ARG1$ -s $ARG2$ } # 'check_snmp_vrrp_v2' command definition define command { command_name check_snmp_vrrp_v2 - command_line $USER1$/check_snmp_vrrp.pl -H $HOSTADDRESS$ -C $ARG3$ -2 -T $ARG1$ -s $ARG2$ + command_line /usr/lib/nagios/plugins/check_snmp_vrrp.pl -H $HOSTADDRESS$ -C $ARG3$ -2 -T $ARG1$ -s $ARG2$ } # 'check_snmp_vrrp_v3' command definition define command { command_name check_snmp_vrrp_v3 - command_line $USER1$/check_snmp_vrrp.pl -H $HOSTADDRESS$ $USER9$ -T $ARG1$ -s $ARG2$ + command_line /usr/lib/nagios/plugins/check_snmp_vrrp.pl -H $HOSTADDRESS$ $USER9$ -T $ARG1$ -s $ARG2$ } diff --git a/debian/pluginconfig/snmp_win.cfg b/debian/pluginconfig/snmp_win.cfg index 53fdf84..590da52 100644 --- a/debian/pluginconfig/snmp_win.cfg +++ b/debian/pluginconfig/snmp_win.cfg @@ -4,5 +4,5 @@ # 'check_win' command definition define command { command_name check_win - command_line $USER1$/check_snmp_win.pl -H $HOSTADDRESS$ -C $ARG3$ -n $ARG2$ + command_line /usr/lib/nagios/plugins/check_snmp_win.pl -H $HOSTADDRESS$ -C $ARG3$ -n $ARG2$ } From 3acf2029d2297376720c1190133085e877e2e7df Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sat, 18 Jan 2014 00:19:18 +0100 Subject: [PATCH 049/205] check_snmp_storage: Add 64bit support --- debian/patches/00list | 1 + .../15_check_snmp_storage_64bit.dpatch | 168 ++++++++++++++++++ 2 files changed, 169 insertions(+) create mode 100644 debian/patches/15_check_snmp_storage_64bit.dpatch diff --git a/debian/patches/00list b/debian/patches/00list index 8da50ff..da00a76 100644 --- a/debian/patches/00list +++ b/debian/patches/00list @@ -5,4 +5,5 @@ 05_check_snmp_storage.dpatch 06_check_snmp_win.dpatch 10_fix_net_snmp_version.dpatch +15_check_snmp_storage_64bit.dpatch 50_disable_epn.dpatch diff --git a/debian/patches/15_check_snmp_storage_64bit.dpatch b/debian/patches/15_check_snmp_storage_64bit.dpatch new file mode 100644 index 0000000..e83c089 --- /dev/null +++ b/debian/patches/15_check_snmp_storage_64bit.dpatch @@ -0,0 +1,168 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 15_check_snmp_storage_64bit by Martin Fürstenau +## +## DP: Fixing Net::SNMP version +## DP: (see https://wiki.icinga.org/display/howtos/check_snmp#checksnmp-Argumentv601isntnumericinnumericlt) + +## @DPATCH@ +## From 144c57a0adda190000bef500f3274425cb90d6ba Mon Sep 17 00:00:00 2001 +## From: Michael Friedrich +## Date: Wed, 26 Sep 2012 16:32:40 +0200 +## Subject: [PATCH] =?UTF-8?q?apply=20check=5Fsnmp=5Fstorage=20patch=20and=20?= +## =?UTF-8?q?1.3.3=20from=20Martin=20F=C3=BCrstenau?= +## MIME-Version: 1.0 +## Content-Type: text/plain; charset=UTF-8 +## Content-Transfer-Encoding: 8bit +## +## http://www.monitoring-portal.org/wbb/index.php?page=Thread&threadID=12031 +--- + plugins/check_snmp_storage.pl | 54 ++++++++++++++++++++++++++++--------------- + 1 file changed, 36 insertions(+), 18 deletions(-) + +@DPATCH@ + +diff --git a/plugins/check_snmp_storage.pl b/plugins/check_snmp_storage.pl +index 1b8a398..a3c784f 100644 +--- a/plugins/check_snmp_storage.pl ++++ b/plugins/check_snmp_storage.pl +@@ -6,7 +6,7 @@ + # Help : http://nagios.manubulon.com + # Licence : GPL - http://www.fsf.org/licenses/gpl.txt + # TODO : +-# Contribs : Dimo Velev, Makina Corpus, A. Greiner-Bär ++# Contribs : Dimo Velev, Makina Corpus, A. Greiner-B\ufffdr + ################################################################# + # + # help : ./check_snmp_storage -h +@@ -80,7 +80,7 @@ + my $o_perf= undef; # Output performance data + my $o_short= undef; # Short output parameters + my @o_shortL= undef; # output type,where,cut +-my $o_reserve= 0; # % reserved blocks (A. Greiner-Bär patch) ++my $o_reserve= 0; # % reserved blocks (A. Greiner-B\ufffdr patch) + my $o_giga= undef; # output and levels in gigabytes instead of megabytes + # SNMPv3 specific + my $o_login= undef; # Login for snmpv3 +@@ -89,6 +89,7 @@ + my $o_authproto='md5'; # Auth protocol + my $o_privproto='des'; # Priv protocol + my $o_privpass= undef; # priv password ++my $UOM_float= 4; # decimal places + # SNMP Message size parameter (Makina Corpus contrib) + my $o_octetlength=undef; + +@@ -112,8 +113,10 @@ sub is_pattern_valid { # Test for things like "" or "+5-i" + + # Get the alarm signal (just in case snmp timout screws up) + $SIG{'ALRM'} = sub { +- print ("ERROR: General time-out (Alarm signal)\n"); +- exit $ERRORS{"UNKNOWN"}; ++# print ("ERROR: General time-out (Alarm signal)\n"); ++# exit $ERRORS{"UNKNOWN"}; ++ print ("Waiting for info\n"); ++ exit $ERRORS{"OK"}; + }; + + sub isnnum { # Return true if arg is not a number +@@ -315,7 +318,7 @@ sub check_options { + if (defined ($o_octetlength) && (isnnum($o_octetlength) || $o_octetlength > 65535 || $o_octetlength < 484 )) { + print "octet lenght must be < 65535 and > 484\n";print_usage(); exit $ERRORS{"UNKNOWN"}; + } +- #### reserved blocks checks (A. Greiner-Bär patch). ++ #### reserved blocks checks (A. Greiner-B\ufffdr patch). + if (defined ($o_reserve) && (isnnum($o_reserve) || $o_reserve > 99 || $o_reserve < 0 )) { + print "reserved blocks must be < 100 and >= 0\n";print_usage(); exit $ERRORS{"UNKNOWN"}; + } +@@ -348,6 +351,7 @@ sub check_options { + -authpassword => $o_passwd, + -authprotocol => $o_authproto, + -port => $o_port, ++ -retries => 10, + -timeout => $o_timeout + ); + } else { +@@ -361,6 +365,7 @@ sub check_options { + -privpassword => $o_privpass, + -privprotocol => $o_privproto, + -port => $o_port, ++ -retries => 10, + -timeout => $o_timeout + ); + } +@@ -373,6 +378,7 @@ sub check_options { + -version => 2, + -community => $o_community, + -port => $o_port, ++ -retries => 10, + -timeout => $o_timeout + ); + } else { +@@ -382,6 +388,7 @@ sub check_options { + -hostname => $o_host, + -community => $o_community, + -port => $o_port, ++ -retries => 10, + -timeout => $o_timeout + ); + } +@@ -491,18 +498,28 @@ sub check_options { + + my $result=undef; + +-if (Net::SNMP->VERSION lt 4) { +- $result = $session->get_request(@oids); +-} else { +- if ($session->version == 0) { +- # snmpv1 +- $result = $session->get_request(Varbindlist => \@oids); +- } else { +- # snmp v2c or v3 : get_bulk_request is not really good for this, so do simple get +- $result = $session->get_request(Varbindlist => \@oids); +- foreach my $key ( keys %$result) { verb("$key : $$result{$key}"); } +- } +-} ++if (Net::SNMP->VERSION lt 4) ++ { ++ $result = $session->get_request(@oids); ++ } ++else ++ { ++ $result = $session->get_request(Varbindlist => \@oids); ++ foreach my $key ( keys %$result) ++ { ++ # Fix for filesystems larger 2 TB. More than 2 TB will cause an error because ++ # as defined in the RFC hrStorageSize is a 32 bit integer. So filesystems ++ # larger 2 TB report a negative value because the first bit will be interpreted ++ # as an algebraic sign. (0 = +, all others will be -). You simply have to add ++ # 2 to the power of 32 (4294967296) and it is fixed. ++ # Martin Fuerstenau, Oce Printing Systems, 25th Sept 2012 ++ if ($$result{$key} < 0) ++ { ++ $$result{$key} = $$result{$key} + 4294967296; ++ } ++ verb("$key x $$result{$key}"); ++ } ++ } + + if (!defined($result)) { printf("ERROR: Size table :%s.\n", $session->error); $session->close; + exit $ERRORS{"UNKNOWN"}; +@@ -547,6 +564,7 @@ sub check_options { + verb("Size : $$result{$size_table . $tindex[$i]}"); + verb("Used : $$result{$used_table . $tindex[$i]}"); + verb("Alloc : $$result{$alloc_units . $tindex[$i]}"); ++ + if (!defined($$result{$size_table . $tindex[$i]}) || + !defined($$result{$used_table . $tindex[$i]}) || + !defined ($$result{$alloc_units . $tindex[$i]})) { +@@ -623,7 +641,7 @@ sub check_options { + } + } + # Performance output (in MB) +- $perf_out .= "'".$Pdescr. "'=" . round($bu,0) . $output_metric ."B;" . round($p_warn,0) ++ $perf_out .= "'".$Pdescr. "'=" . round($bu,$UOM_float) . $output_metric ."B;" . round($p_warn,0) + . ";" . round($p_crit,0) . ";0;" . round($to,0); + } + +-- +1.8.5.1 + From 73c21a07e150f80e3dcc55eb232ba42fc466fe04 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 19 Feb 2014 22:35:36 +0100 Subject: [PATCH 050/205] Convert the package to source format 3.0 (quilt) --- debian/control | 2 +- debian/patches/00list | 9 --------- .../{01_check_snmp_env.dpatch => 01_check_snmp_env} | 5 +---- .../{02_check_snmp_int.dpatch => 02_check_snmp_int} | 5 +---- .../{03_check_snmp_load.dpatch => 03_check_snmp_load} | 5 +---- ...4_check_snmp_process.dpatch => 04_check_snmp_process} | 5 +---- ...5_check_snmp_storage.dpatch => 05_check_snmp_storage} | 5 +---- .../{06_check_snmp_win.dpatch => 06_check_snmp_win} | 5 +---- ...x_net_snmp_version.dpatch => 10_fix_net_snmp_version} | 4 +--- ..._storage_64bit.dpatch => 15_check_snmp_storage_64bit} | 4 ---- debian/patches/{50_disable_epn.dpatch => 50_disable_epn} | 5 +---- debian/patches/series | 9 +++++++++ debian/rules | 6 ++---- debian/source/format | 2 +- 14 files changed, 21 insertions(+), 50 deletions(-) delete mode 100644 debian/patches/00list rename debian/patches/{01_check_snmp_env.dpatch => 01_check_snmp_env} (97%) rename debian/patches/{02_check_snmp_int.dpatch => 02_check_snmp_int} (99%) rename debian/patches/{03_check_snmp_load.dpatch => 03_check_snmp_load} (92%) rename debian/patches/{04_check_snmp_process.dpatch => 04_check_snmp_process} (98%) rename debian/patches/{05_check_snmp_storage.dpatch => 05_check_snmp_storage} (98%) rename debian/patches/{06_check_snmp_win.dpatch => 06_check_snmp_win} (94%) rename debian/patches/{10_fix_net_snmp_version.dpatch => 10_fix_net_snmp_version} (99%) rename debian/patches/{15_check_snmp_storage_64bit.dpatch => 15_check_snmp_storage_64bit} (99%) rename debian/patches/{50_disable_epn.dpatch => 50_disable_epn} (98%) create mode 100644 debian/patches/series diff --git a/debian/control b/debian/control index 73e1bc2..c7c2d05 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: net Priority: optional Maintainer: Debian Nagios Maintainer Group Uploaders: Jan Wagner -Build-Depends: debhelper (>= 5), dpatch +Build-Depends: debhelper (>= 5) Homepage: http://www.manubulon.com/nagios/index_snmp.html Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-nagios/pkg-nagios-snmp-plugins.git Vcs-Git: git://anonscm.debian.org/pkg-nagios/pkg-nagios-snmp-plugins diff --git a/debian/patches/00list b/debian/patches/00list deleted file mode 100644 index da00a76..0000000 --- a/debian/patches/00list +++ /dev/null @@ -1,9 +0,0 @@ -01_check_snmp_env.dpatch -02_check_snmp_int.dpatch -03_check_snmp_load.dpatch -04_check_snmp_process.dpatch -05_check_snmp_storage.dpatch -06_check_snmp_win.dpatch -10_fix_net_snmp_version.dpatch -15_check_snmp_storage_64bit.dpatch -50_disable_epn.dpatch diff --git a/debian/patches/01_check_snmp_env.dpatch b/debian/patches/01_check_snmp_env similarity index 97% rename from debian/patches/01_check_snmp_env.dpatch rename to debian/patches/01_check_snmp_env index 9fcd9f6..c093cf8 100644 --- a/debian/patches/01_check_snmp_env.dpatch +++ b/debian/patches/01_check_snmp_env @@ -1,10 +1,7 @@ -#!/bin/sh /usr/share/dpatch/dpatch-run -## 01_check_snmp_env.dpatch by Jan Wagner +## 01_check_snmp_env by Jan Wagner ## ## DP: Fix some issues via cvs version -@DPATCH@ - --- old/check_snmp_env.pl 2007-07-04 09:46:55.000000000 +0200 +++ new/check_snmp_env.pl 2007-07-06 22:17:06.000000000 +0200 @@ -1,7 +1,7 @@ diff --git a/debian/patches/02_check_snmp_int.dpatch b/debian/patches/02_check_snmp_int similarity index 99% rename from debian/patches/02_check_snmp_int.dpatch rename to debian/patches/02_check_snmp_int index 964478d..3ef2053 100644 --- a/debian/patches/02_check_snmp_int.dpatch +++ b/debian/patches/02_check_snmp_int @@ -1,10 +1,7 @@ -#!/bin/sh /usr/share/dpatch/dpatch-run -## 02_check_snmp_int.dpatch by Jan Wagner +## 02_check_snmp_int by Jan Wagner ## ## DP: Update script to version 1.24 -@DPATCH@ - diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_int.pl nagios-snmp-plugins-1.1.1/check_snmp_int.pl --- nagios-snmp-plugins-1.1.1.orig/check_snmp_int.pl 2007-04-23 11:40:39.000000000 +0200 diff --git a/debian/patches/03_check_snmp_load.dpatch b/debian/patches/03_check_snmp_load similarity index 92% rename from debian/patches/03_check_snmp_load.dpatch rename to debian/patches/03_check_snmp_load index e0dc967..9539b73 100644 --- a/debian/patches/03_check_snmp_load.dpatch +++ b/debian/patches/03_check_snmp_load @@ -1,10 +1,7 @@ -#!/bin/sh /usr/share/dpatch/dpatch-run -## 03_check_snmp_load.dpatch by Jan Wagner +## 03_check_snmp_load by Jan Wagner ## ## DP: Update script to version 1.12 -@DPATCH@ - diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_load.pl nagios-snmp-plugins-1.1.1/check_snmp_load.pl --- nagios-snmp-plugins-1.1.1.orig/check_snmp_load.pl 2007-04-16 19:41:20.000000000 +0200 +++ nagios-snmp-plugins-1.1.1/check_snmp_load.pl 2007-10-12 22:23:23.000000000 +0200 diff --git a/debian/patches/04_check_snmp_process.dpatch b/debian/patches/04_check_snmp_process similarity index 98% rename from debian/patches/04_check_snmp_process.dpatch rename to debian/patches/04_check_snmp_process index 858421a..4476752 100644 --- a/debian/patches/04_check_snmp_process.dpatch +++ b/debian/patches/04_check_snmp_process @@ -1,10 +1,7 @@ -#!/bin/sh /usr/share/dpatch/dpatch-run -## 04_check_snmp_process.dpatch by Jan Wagner +## 04_check_snmp_process by Jan Wagner ## ## DP: Update script to version 1.10 -@DPATCH@ - diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_process.pl nagios-snmp-plugins-1.1.1/check_snmp_process.pl --- nagios-snmp-plugins-1.1.1.orig/check_snmp_process.pl 2007-03-12 21:36:02.000000000 +0100 +++ nagios-snmp-plugins-1.1.1/check_snmp_process.pl 2007-10-12 22:23:24.000000000 +0200 diff --git a/debian/patches/05_check_snmp_storage.dpatch b/debian/patches/05_check_snmp_storage similarity index 98% rename from debian/patches/05_check_snmp_storage.dpatch rename to debian/patches/05_check_snmp_storage index 99f8208..c7c675d 100644 --- a/debian/patches/05_check_snmp_storage.dpatch +++ b/debian/patches/05_check_snmp_storage @@ -1,10 +1,7 @@ -#!/bin/sh /usr/share/dpatch/dpatch-run -## 05_check_snmp_storage.dpatch by Jan Wagner +## 05_check_snmp_storage by Jan Wagner ## ## DP: Update script to version 1.3.3 -@DPATCH@ - diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_storage.pl nagios-snmp-plugins-1.1.1/check_snmp_storage.pl --- nagios-snmp-plugins-1.1.1.orig/check_snmp_storage.pl 2007-03-12 22:01:36.000000000 +0100 +++ nagios-snmp-plugins-1.1.1/check_snmp_storage.pl 2007-10-12 22:23:24.000000000 +0200 diff --git a/debian/patches/06_check_snmp_win.dpatch b/debian/patches/06_check_snmp_win similarity index 94% rename from debian/patches/06_check_snmp_win.dpatch rename to debian/patches/06_check_snmp_win index bee1eed..01a721a 100644 --- a/debian/patches/06_check_snmp_win.dpatch +++ b/debian/patches/06_check_snmp_win @@ -1,10 +1,7 @@ -#!/bin/sh /usr/share/dpatch/dpatch-run -## 06_check_snmp_win.dpatch by Jan Wagner +## 06_check_snmp_win by Jan Wagner ## ## DP: Update script to version 1.1 -@DPATCH@ - diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_win.pl nagios-snmp-plugins-1.1.1/check_snmp_win.pl --- nagios-snmp-plugins-1.1.1.orig/check_snmp_win.pl 2006-11-29 20:59:55.000000000 +0100 +++ nagios-snmp-plugins-1.1.1/check_snmp_win.pl 2007-10-12 22:23:25.000000000 +0200 diff --git a/debian/patches/10_fix_net_snmp_version.dpatch b/debian/patches/10_fix_net_snmp_version similarity index 99% rename from debian/patches/10_fix_net_snmp_version.dpatch rename to debian/patches/10_fix_net_snmp_version index 83a5304..c8cb20c 100755 --- a/debian/patches/10_fix_net_snmp_version.dpatch +++ b/debian/patches/10_fix_net_snmp_version @@ -1,10 +1,8 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## 10_fix_net_snmp_version.dpatch by Jan Wagner +## 10_fix_net_snmp_version by Jan Wagner ## ## DP: Fixing Net::SNMP version ## DP: (see https://wiki.icinga.org/display/howtos/check_snmp#checksnmp-Argumentv601isntnumericinnumericlt) -@DPATCH@ diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-snmp-plugins-1.1.1~/check_snmp_boostedge.pl nagios-snmp-plugins-1.1.1/check_snmp_boostedge.pl --- nagios-snmp-plugins-1.1.1~/check_snmp_boostedge.pl 2007-01-16 23:57:14.000000000 +0100 +++ nagios-snmp-plugins-1.1.1/check_snmp_boostedge.pl 2013-01-31 08:38:55.000000000 +0100 diff --git a/debian/patches/15_check_snmp_storage_64bit.dpatch b/debian/patches/15_check_snmp_storage_64bit similarity index 99% rename from debian/patches/15_check_snmp_storage_64bit.dpatch rename to debian/patches/15_check_snmp_storage_64bit index e83c089..aaa291a 100644 --- a/debian/patches/15_check_snmp_storage_64bit.dpatch +++ b/debian/patches/15_check_snmp_storage_64bit @@ -1,10 +1,8 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run ## 15_check_snmp_storage_64bit by Martin Fürstenau ## ## DP: Fixing Net::SNMP version ## DP: (see https://wiki.icinga.org/display/howtos/check_snmp#checksnmp-Argumentv601isntnumericinnumericlt) -## @DPATCH@ ## From 144c57a0adda190000bef500f3274425cb90d6ba Mon Sep 17 00:00:00 2001 ## From: Michael Friedrich ## Date: Wed, 26 Sep 2012 16:32:40 +0200 @@ -19,8 +17,6 @@ plugins/check_snmp_storage.pl | 54 ++++++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 18 deletions(-) -@DPATCH@ - diff --git a/plugins/check_snmp_storage.pl b/plugins/check_snmp_storage.pl index 1b8a398..a3c784f 100644 --- a/plugins/check_snmp_storage.pl diff --git a/debian/patches/50_disable_epn.dpatch b/debian/patches/50_disable_epn similarity index 98% rename from debian/patches/50_disable_epn.dpatch rename to debian/patches/50_disable_epn index 1c504fd..5cec8b8 100644 --- a/debian/patches/50_disable_epn.dpatch +++ b/debian/patches/50_disable_epn @@ -1,10 +1,7 @@ -#!/bin/sh /usr/share/dpatch/dpatch-run -## 50_disable_epn.dpatch by Jan Wagner +## 50_disable_epn by Jan Wagner ## ## DP: leave marks to disable epn -@DPATCH@ - diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_boostedge.pl nagios-snmp-plugins-1.1.1/check_snmp_boostedge.pl --- nagios-snmp-plugins-1.1.1.orig/check_snmp_boostedge.pl 2007-01-16 23:57:14.000000000 +0100 +++ nagios-snmp-plugins-1.1.1/check_snmp_boostedge.pl 2008-05-23 14:09:04.000000000 +0200 diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..919403b --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,9 @@ +01_check_snmp_env +02_check_snmp_int +03_check_snmp_load +04_check_snmp_process +05_check_snmp_storage +06_check_snmp_win +10_fix_net_snmp_version +15_check_snmp_storage_64bit +50_disable_epn diff --git a/debian/rules b/debian/rules index c5fdedd..6e83254 100755 --- a/debian/rules +++ b/debian/rules @@ -3,8 +3,6 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -include /usr/share/dpatch/dpatch.make - COMMANDDEFPATH:=/etc/nagios-plugins/config/ NP_DIR:=debian/nagios-snmp-plugins NP_TEMPLATES:=$(NP_DIR)/usr/share/nagios-snmp-plugins/pluginconfig @@ -13,9 +11,9 @@ NP_LIBEXEC:=/usr/lib/nagios/plugins plugin_cfgs:=snmp_cpfw snmp_env snmp_int snmp_load snmp_mem snmp_process \ snmp_storage snmp_vrrp snmp_win -build: patch-stamp +build: -clean: unpatch +clean: dh_testdir dh_testroot diff --git a/debian/source/format b/debian/source/format index d3827e7..163aaf8 100644 --- a/debian/source/format +++ b/debian/source/format @@ -1 +1 @@ -1.0 +3.0 (quilt) From 6adaea0ef171f7081dba6409db6e6371fa39345a Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 19 Feb 2014 22:40:41 +0100 Subject: [PATCH 051/205] Fix 15_check_snmp_storage_64bit --- debian/patches/15_check_snmp_storage_64bit | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/debian/patches/15_check_snmp_storage_64bit b/debian/patches/15_check_snmp_storage_64bit index aaa291a..4fbb0d7 100644 --- a/debian/patches/15_check_snmp_storage_64bit +++ b/debian/patches/15_check_snmp_storage_64bit @@ -14,13 +14,13 @@ ## ## http://www.monitoring-portal.org/wbb/index.php?page=Thread&threadID=12031 --- - plugins/check_snmp_storage.pl | 54 ++++++++++++++++++++++++++++--------------- + check_snmp_storage.pl | 54 ++++++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 18 deletions(-) -diff --git a/plugins/check_snmp_storage.pl b/plugins/check_snmp_storage.pl +diff --git a/check_snmp_storage.pl b/check_snmp_storage.pl index 1b8a398..a3c784f 100644 ---- a/plugins/check_snmp_storage.pl -+++ b/plugins/check_snmp_storage.pl +--- a/check_snmp_storage.pl ++++ b/check_snmp_storage.pl @@ -6,7 +6,7 @@ # Help : http://nagios.manubulon.com # Licence : GPL - http://www.fsf.org/licenses/gpl.txt From 074ed9675104476f7d835af0ba2b489542948f01 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Thu, 13 Feb 2014 22:43:33 +0100 Subject: [PATCH 052/205] Add travis-ci config --- .travis.yml | 15 +++++++++++++++ debian/source/options | 1 + 2 files changed, 16 insertions(+) create mode 100644 .travis.yml create mode 100644 debian/source/options diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..52fa260 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,15 @@ +language: c + +install: + - sudo apt-get update -qq + - sudo apt-get install -qq --no-install-recommends devscripts libwww-perl + - uscan --force-download + - sudo apt-get purge -qq libwww-perl + - sudo apt-get autoremove -qq + - sudo apt-get install -qq --no-install-recommends debhelper dpatch + +script: + - debuild -uc -us + +#notifications: +# email: false diff --git a/debian/source/options b/debian/source/options new file mode 100644 index 0000000..a729099 --- /dev/null +++ b/debian/source/options @@ -0,0 +1 @@ +extend-diff-ignore = '^\.travis' From 36857aaa2aaf40ad47f85ac6cc18fa141b066cad Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 16 Feb 2014 23:10:52 +0100 Subject: [PATCH 053/205] Reorder and comment .travis.yml --- .travis.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 52fa260..08d63ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,22 @@ language: c -install: +before_install: + # update package list - sudo apt-get update -qq + # installneeded packages for uscan - sudo apt-get install -qq --no-install-recommends devscripts libwww-perl + # download original tarball - uscan --force-download + # remove packages needed for uscan - sudo apt-get purge -qq libwww-perl - sudo apt-get autoremove -qq + +install: + # install build dependencies - sudo apt-get install -qq --no-install-recommends debhelper dpatch script: + # build the debian package - debuild -uc -us #notifications: From 9ac5f8ce976627eedaf2a667a34e8142934fe307 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 16 Feb 2014 23:21:16 +0100 Subject: [PATCH 054/205] update git ignore regex --- debian/source/options | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/source/options b/debian/source/options index a729099..f9deab5 100644 --- a/debian/source/options +++ b/debian/source/options @@ -1 +1 @@ -extend-diff-ignore = '^\.travis' +extend-diff-ignore = '(^|/)(\.travis\.yml|\.git|\.gitgnore|config\.sub|config\.guess)$' From f82ac54371646a49ffe756637dfc59aea655ad8b Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Tue, 25 Feb 2014 14:06:22 +0100 Subject: [PATCH 055/205] Add lintian checks after build --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 08d63ff..f0db5e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,5 +19,9 @@ script: # build the debian package - debuild -uc -us +after_script: + # run lintian after build + - sudo apt-get install -qq --no-install-recommends lintian + - lintian --info --display-info --display-experimental --pedantic --show-overrides ../*.deb && lintian --info --display-info --display-experimental --pedantic --show-overrides ../*.dsc #notifications: # email: false From 1ea98779dceb58a75cbe478b0205336a8ebe746b Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 2 Mar 2014 20:43:21 +0100 Subject: [PATCH 056/205] Add build-indep and build-arch target into debian/rules --- debian/rules | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index 6e83254..f3f6be8 100755 --- a/debian/rules +++ b/debian/rules @@ -11,7 +11,10 @@ NP_LIBEXEC:=/usr/lib/nagios/plugins plugin_cfgs:=snmp_cpfw snmp_env snmp_int snmp_load snmp_mem snmp_process \ snmp_storage snmp_vrrp snmp_win -build: +build: build-arch build-indep +build-arch: build-stamp +build-indep: build-stamp +build-stamp: clean: dh_testdir From 36735a875fc59db571503845faa170d718640e05 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 2 Mar 2014 20:52:22 +0100 Subject: [PATCH 057/205] Update to recent copyright format --- debian/copyright | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/debian/copyright b/debian/copyright index d853dd9..c47e1d7 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,9 +1,7 @@ -Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=196 -Packaged-By: Jan Wagner -Packaged-Date: Tue, 5 Dec 2006 11:52:19 +0100 +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Nagios SNMP Plugins -Upstream-Maintainer: Patrick Proy (nagios at proy.org) -Upstream-Source: http://www.manubulon.com/nagios +Upstream-Contact: Patrick Proy (nagios at proy.org) +Source: http://www.manubulon.com/nagios Files: * Copyright: Copyright (C) 2004-2007 Patrick Proy (nagios at proy.org) @@ -17,12 +15,12 @@ License: GPL-2 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. - + . This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + . You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -32,15 +30,15 @@ License: GPL-2+ it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + . This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + . You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -On Debian systems, the complete text of the GNU General Public License -can be found in /usr/share/common-licenses/GPL file. + . + On Debian systems, the complete text of the GNU General Public License + can be found in /usr/share/common-licenses/GPL file. From 8a119de7b8bab23429cf45862451447c05fdef94 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 2 Mar 2014 21:00:19 +0100 Subject: [PATCH 058/205] Updating standards version to 3.9.5, no changes needed --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index c7c2d05..fd34049 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Build-Depends: debhelper (>= 5) Homepage: http://www.manubulon.com/nagios/index_snmp.html Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-nagios/pkg-nagios-snmp-plugins.git Vcs-Git: git://anonscm.debian.org/pkg-nagios/pkg-nagios-snmp-plugins -Standards-Version: 3.8.4 +Standards-Version: 3.9.5 Package: nagios-snmp-plugins Architecture: all From aaa7106667fbca0fbcd81cc40806ca19d7e881c4 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 2 Mar 2014 21:06:06 +0100 Subject: [PATCH 059/205] Set set -e in the body in body of the maintainers scripts --- debian/postinst | 4 +++- debian/postrm.in | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/debian/postinst b/debian/postinst index 7db878e..55a755d 100644 --- a/debian/postinst +++ b/debian/postinst @@ -1,4 +1,6 @@ -#!/bin/sh -e +#!/bin/sh + +set -e templdir=/usr/share/nagios-snmp-plugins/pluginconfig diff --git a/debian/postrm.in b/debian/postrm.in index c4dcc12..e48c8cf 100644 --- a/debian/postrm.in +++ b/debian/postrm.in @@ -1,4 +1,6 @@ -#!/bin/sh -e +#!/bin/sh + +set -e PLUGINS="@PLUGINS@" From d03e055c32f752ac73a48b130943b802029bd670 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 2 Mar 2014 21:14:13 +0100 Subject: [PATCH 060/205] Extend the extended package description --- debian/control | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/control b/debian/control index fd34049..f3645ef 100644 --- a/debian/control +++ b/debian/control @@ -14,3 +14,10 @@ Architecture: all Depends: ${perl:Depends}, ${misc:Depends}, libnet-snmp-perl, nagios-plugins-basic (>= 1.4.5-2), perl-base (>= 5.8.4-8), ucf Description: SNMP Plugins for nagios A set of Nagios plugins to check hosts/devices using snmp protocol + . + The general idea of these scripts is to check as many things as possible with + snmp (how do you install NRPE on Cisco or AS/400 ?) : disks, memory, load, + interface, running procsses, etc... + . + The other idea is to select disks, interfaces, process using regular + expressions From 2fcaf9a4a69893ed82cd6a5f4af207da8fa7922b Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 2 Mar 2014 21:29:56 +0100 Subject: [PATCH 061/205] Fix potential privacy breach of HTML documentation --- debian/patches/11_fix_privacy_doc | 188 ++++++++++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 189 insertions(+) create mode 100644 debian/patches/11_fix_privacy_doc diff --git a/debian/patches/11_fix_privacy_doc b/debian/patches/11_fix_privacy_doc new file mode 100644 index 0000000..2750b6a --- /dev/null +++ b/debian/patches/11_fix_privacy_doc @@ -0,0 +1,188 @@ +## 11_fix_privacy_doc by Jan Wagner +## +## DP: Fixing potential privacy breach by fetching data from sourceforge.net + +commit 084af86fe6ee55135144ac44f661ff139434fdc3 +Author: Jan Wagner +Date: Sun Mar 2 21:22:42 2014 +0100 + + Fix potential privacy breach of HTML documentation + +diff --git a/doc/faq.html b/doc/faq.html +index 69c3a97..b421495 100755 +--- a/doc/faq.html ++++ b/doc/faq.html +@@ -225,7 +225,7 @@ + +

This project is also hosted by :
+ +- SourceForge.net Logo ++ http://sourceforge.net/projects/nagios-snmp +

+ + +diff --git a/doc/index.html b/doc/index.html +index e58666b..21adf06 100755 +--- a/doc/index.html ++++ b/doc/index.html +@@ -324,7 +324,7 @@ + +
+

This project is hosted on :
+- SourceForge.net Logo ++ http://sourceforge.net/projects/nagios-snmp +

+

Nagios and the Nagios logo are registered + trademarks of Ethan Galstad.

+diff --git a/doc/index_commands.html b/doc/index_commands.html +index 66bac6c..3c8f03a 100755 +--- a/doc/index_commands.html ++++ b/doc/index_commands.html +@@ -109,7 +109,7 @@ + + + +- SourceForge.net Logo ++ http://sourceforge.net/projects/nagios-snmp + + + +@@ -2014,7 +2014,7 @@ + +

This project is hosted on :
+ +- SourceForge.net Logo ++ http://sourceforge.net/projects/nagios-snmp + +

+ +diff --git a/doc/snmp_cpfw.html b/doc/snmp_cpfw.html +index ac84d46..89bf324 100755 +--- a/doc/snmp_cpfw.html ++++ b/doc/snmp_cpfw.html +@@ -439,7 +439,7 @@ + +

This project is hosted on :
+ +- SourceForge.net Logo ++ http://sourceforge.net/projects/nagios-snmp + +

+ +diff --git a/doc/snmp_css.html b/doc/snmp_css.html +index 84fe3f4..c581d85 100755 +--- a/doc/snmp_css.html ++++ b/doc/snmp_css.html +@@ -353,7 +353,7 @@ Usage: ./check_snmp_css_main.pl [-v] -H <host> -C <snmp_community> [ + +

This project is hosted on :
+ +- SourceForge.net Logo ++ http://sourceforge.net/projects/nagios-snmp + +

+ +diff --git a/doc/snmp_env.html b/doc/snmp_env.html +index f847bd9..576d6a5 100755 +--- a/doc/snmp_env.html ++++ b/doc/snmp_env.html +@@ -342,7 +342,7 @@ + +

This project is hosted on :
+ +- SourceForge.net Logo ++ http://sourceforge.net/projects/nagios-snmp + +

+ +diff --git a/doc/snmp_int.html b/doc/snmp_int.html +index aac15fc..6284623 100755 +--- a/doc/snmp_int.html ++++ b/doc/snmp_int.html +@@ -660,7 +660,7 @@ + +

This project is hosted on :
+ +- SourceForge.net Logo ++ http://sourceforge.net/projects/nagios-snmp + +

+ +diff --git a/doc/snmp_load.html b/doc/snmp_load.html +index 0c48eb8..78697db 100755 +--- a/doc/snmp_load.html ++++ b/doc/snmp_load.html +@@ -379,7 +379,7 @@ SNMP Load & CPU Monitor for Nagios version 1.3
+ +

This project is hosted on :
+ +- SourceForge.net Logo ++ http://sourceforge.net/projects/nagios-snmp + +

+ +diff --git a/doc/snmp_mem.html b/doc/snmp_mem.html +index 1a51886..c93c185 100755 +--- a/doc/snmp_mem.html ++++ b/doc/snmp_mem.html +@@ -457,7 +457,7 @@ Usage: ./check_snmp_mem.pl [-v] -H <host> -C <snmp_community> [-2] | + +

This project is hosted on :
+ +- SourceForge.net Logo ++ http://sourceforge.net/projects/nagios-snmp + +

+ +diff --git a/doc/snmp_process.html b/doc/snmp_process.html +index 50c3735..4af115a 100755 +--- a/doc/snmp_process.html ++++ b/doc/snmp_process.html +@@ -332,7 +332,7 @@ + + +

This project is hosted on :
+- SourceForge.net Logo ++ http://sourceforge.net/projects/nagios-snmp +

+

Nagios and the Nagios logo are registered + trademarks of Ethan Galstad.

+diff --git a/doc/snmp_storage.html b/doc/snmp_storage.html +index 98bc5e1..14488bf 100755 +--- a/doc/snmp_storage.html ++++ b/doc/snmp_storage.html +@@ -1285,7 +1285,7 @@ + + + +- SourceForge.net Logo ++ http://sourceforge.net/projects/nagios-snmp + + + +diff --git a/doc/snmp_vrrp.html b/doc/snmp_vrrp.html +index 66e37be..ca8300d 100755 +--- a/doc/snmp_vrrp.html ++++ b/doc/snmp_vrrp.html +@@ -324,7 +324,7 @@ + +

This project is hosted on :
+ +- SourceForge.net Logo ++ http://sourceforge.net/projects/nagios-snmp + +

+ +diff --git a/doc/snmp_windows.html b/doc/snmp_windows.html +index 4a8f513..2ae468c 100755 +--- a/doc/snmp_windows.html ++++ b/doc/snmp_windows.html +@@ -243,7 +243,7 @@ + + +

This project is hosted on :
+- SourceForge.net Logo ++ http://sourceforge.net/projects/nagios-snmp +

+

Nagios and the Nagios logo are registered + trademarks of Ethan Galstad.

diff --git a/debian/patches/series b/debian/patches/series index 919403b..fb1cd65 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -5,5 +5,6 @@ 05_check_snmp_storage 06_check_snmp_win 10_fix_net_snmp_version +11_fix_privacy_doc 15_check_snmp_storage_64bit 50_disable_epn From 1ae942a30aabbf76f6619382f5b20be54307c923 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 2 Mar 2014 21:36:36 +0100 Subject: [PATCH 062/205] Add upstream changelog into package --- debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index f3f6be8..c7ef9c2 100755 --- a/debian/rules +++ b/debian/rules @@ -53,7 +53,7 @@ install: build binary-indep: build install dh_testdir dh_testroot - dh_installchangelogs + dh_installchangelogs Changelog dh_installdocs dh_link dh_compress From ab802e45d7333a3add245a53f86945e14fe07afb Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 2 Mar 2014 22:33:40 +0100 Subject: [PATCH 063/205] Merge latest CVS patches into one --- debian/patches/01_check_snmp_env | 130 ---- debian/patches/01_update_pre_1.1.2 | 1041 ++++++++++++++++++++++++++ debian/patches/02_check_snmp_int | 372 --------- debian/patches/03_check_snmp_load | 43 -- debian/patches/04_check_snmp_process | 207 ----- debian/patches/05_check_snmp_storage | 222 ------ debian/patches/06_check_snmp_win | 67 -- debian/patches/series | 7 +- 8 files changed, 1042 insertions(+), 1047 deletions(-) delete mode 100644 debian/patches/01_check_snmp_env create mode 100644 debian/patches/01_update_pre_1.1.2 delete mode 100644 debian/patches/02_check_snmp_int delete mode 100644 debian/patches/03_check_snmp_load delete mode 100644 debian/patches/04_check_snmp_process delete mode 100644 debian/patches/05_check_snmp_storage delete mode 100644 debian/patches/06_check_snmp_win diff --git a/debian/patches/01_check_snmp_env b/debian/patches/01_check_snmp_env deleted file mode 100644 index c093cf8..0000000 --- a/debian/patches/01_check_snmp_env +++ /dev/null @@ -1,130 +0,0 @@ -## 01_check_snmp_env by Jan Wagner -## -## DP: Fix some issues via cvs version - ---- old/check_snmp_env.pl 2007-07-04 09:46:55.000000000 +0200 -+++ new/check_snmp_env.pl 2007-07-06 22:17:06.000000000 +0200 -@@ -1,7 +1,7 @@ - #!/usr/bin/perl -w - ############################## check_snmp_env ################# --# Version : 1.2 --# Date : April 19 2007 -+# Version : 1.3 -+# Date : May 24 2007 - # Author : Patrick Proy ( patrick at proy.org) - # Help : http://www.manubulon.com/nagios/ - # Licence : GPL - http://www.fsf.org/licenses/gpl.txt -@@ -145,9 +145,24 @@ - - my @foundry_status = (3,0,2); # oper status : 1:other, 2: Normal, 3: Failure - -+# Linux Net-SNMP with LM-SENSORS -+my $linux_temp = "1.3.6.1.4.1.2021.13.16.2.1"; # temperature table -+my $linux_temp_descr = "1.3.6.1.4.1.2021.13.16.2.1.2"; # temperature entry description -+my $linux_temp_value = "1.3.6.1.4.1.2021.13.16.2.1.3"; # temperature entry value (mC) -+my $linux_fan = "1.3.6.1.4.1.2021.13.16.3.1"; # fan table -+my $linux_fan_descr = "1.3.6.1.4.1.2021.13.16.3.1.2"; # fan entry description -+my $linux_fan_value = "1.3.6.1.4.1.2021.13.16.3.1.3"; # fan entry value (RPM) -+my $linux_volt = "1.3.6.1.4.1.2021.13.16.4.1"; # voltage table -+my $linux_volt_descr = "1.3.6.1.4.1.2021.13.16.4.1.2"; # voltage entry description -+my $linux_volt_value = "1.3.6.1.4.1.2021.13.16.4.1.3"; # voltage entry value (mV) -+my $linux_misc = "1.3.6.1.4.1.2021.13.16.4.1"; # misc table -+my $linux_misc_descr = "1.3.6.1.4.1.2021.13.16.4.1.2"; # misc entry description -+my $linux_misc_value = "1.3.6.1.4.1.2021.13.16.4.1.3"; # misc entry value -+ -+ - # Globals - --my $Version='1.2'; -+my $Version='1.3'; - - my $o_host = undef; # hostname - my $o_community = undef; # community -@@ -160,7 +175,7 @@ - my $o_version2= undef; # use snmp v2c - # check type - my $o_check_type= "cisco"; # default Cisco --my @valid_types =("cisco","nokia","bc","iron","foundry"); -+my @valid_types =("cisco","nokia","bc","iron","foundry","linux"); - my $o_temp= undef; # max temp - my $o_fan= undef; # min fan speed - -@@ -177,7 +192,7 @@ - sub p_version { print "check_snmp_env version : $Version\n"; } - - sub print_usage { -- print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -T (cisco|nokia|bc|iron|foundry) [-F ] [-c ] [-f] [-t ] [-V]\n"; -+ print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -T (cisco|nokia|bc|iron|foundry|linux) [-F ] [-c ] [-f] [-t ] [-V]\n"; - } - - sub isnnum { # Return true if arg is not a number -@@ -221,17 +236,18 @@ - -P, --port=PORT - SNMP port (Default 161) - -T, --type=cisco|nokia|bc|iron|foundry -- Environemental check : -- cisco : voltage,temp,fan,power supply status -- will try to check everything present -- nokia : fan and power supply -- bc : fans, power supply, voltage, disks -- iron : fans, power supply, temp -- foundry : power supply, temp -+ Environemental check : -+ cisco : All Cisco equipements : voltage,temp,fan,power supply -+ (will try to check everything in the env mib) -+ nokia : Nokia IP platforms : fan and power supply -+ bc : BlueCoat platforms : fans, power supply, voltage, disks -+ iron : IronPort platforms : fans, power supply, temp -+ foundry : Foundry Network platforms : power supply, temp -+ linux : Net-SNMP with LM-SENSORS : temp, fan, volt, misc - -F, --fan= -- Minimum fan rpm value -+ Minimum fan rpm value (only needed for 'iron' & 'linux') - -c, --celcius= -- Maximum temp in degree celcius -+ Maximum temp in degree celcius (only needed for 'iron' & 'linux') - -f, --perfparse - Perfparse compatible output - -t, --timeout=INTEGER -@@ -428,8 +444,10 @@ - if (!defined ($cur_status)) { ### Error TODO - $volt_global=1; - } -- $perf_output.=" '".$$resultat{$ciscoVoltageTableDesc .".".$voltindex[$i]}."'=" ; -- $perf_output.=$$resultat{$ciscoVoltageTableValue."." . $voltindex[$i]}; -+ if (defined($$resultat{$ciscoVoltageTableValue."." . $voltindex[$i]})) { -+ $perf_output.=" '".$$resultat{$ciscoVoltageTableDesc .".".$voltindex[$i]}."'=" ; -+ $perf_output.=$$resultat{$ciscoVoltageTableValue."." . $voltindex[$i]}; -+ } - if ($Nagios_state[$CiscoEnvMonNagios{$cur_status}] ne "OK") { - $volt_global= 1; - $volt_status{$$resultat{$ciscoVoltageTableDesc .".".$voltindex[$i]}}=$cur_status; -@@ -448,8 +466,10 @@ - if (!defined ($cur_status)) { ### Error TODO - $temp_global=1; - } -- $perf_output.=" '".$$resultat{$ciscoTempTableDesc .".".$tempindex[$i]}."'=" ; -- $perf_output.=$$resultat{$ciscoTempTableValue."." . $tempindex[$i]}; -+ if (defined($$resultat{$ciscoTempTableValue."." . $tempindex[$i]})) { -+ $perf_output.=" '".$$resultat{$ciscoTempTableDesc .".".$tempindex[$i]}."'=" ; -+ $perf_output.=$$resultat{$ciscoTempTableValue."." . $tempindex[$i]}; -+ } - if ($Nagios_state[$CiscoEnvMonNagios{$cur_status}] ne "OK") { - $temp_global= 1; - $temp_status{$$resultat{$ciscoTempTableDesc .".".$tempindex[$i]}}=$cur_status; -@@ -1003,4 +1023,14 @@ - - } - --exit (3); -+########### Cisco env checks ############## -+if ($o_check_type eq "linux") { -+ -+ verb("Checking linux env"); -+ -+ print "Not implemented yet : UNKNOWN\n"; -+ exit $ERRORS{"UNKNOWN"}; -+} -+ -+print "Unknown check type : UNKNOWN\n"; -+exit $ERRORS{"UNKNOWN"}; diff --git a/debian/patches/01_update_pre_1.1.2 b/debian/patches/01_update_pre_1.1.2 new file mode 100644 index 0000000..15fde6c --- /dev/null +++ b/debian/patches/01_update_pre_1.1.2 @@ -0,0 +1,1041 @@ +## 01_check_snmp_env by Jan Wagner +## +## DP: Fix some issues via cvs version + +--- old/check_snmp_env.pl 2007-07-04 09:46:55.000000000 +0200 ++++ new/check_snmp_env.pl 2007-07-06 22:17:06.000000000 +0200 +@@ -1,7 +1,7 @@ + #!/usr/bin/perl -w + ############################## check_snmp_env ################# +-# Version : 1.2 +-# Date : April 19 2007 ++# Version : 1.3 ++# Date : May 24 2007 + # Author : Patrick Proy ( patrick at proy.org) + # Help : http://www.manubulon.com/nagios/ + # Licence : GPL - http://www.fsf.org/licenses/gpl.txt +@@ -145,9 +145,24 @@ + + my @foundry_status = (3,0,2); # oper status : 1:other, 2: Normal, 3: Failure + ++# Linux Net-SNMP with LM-SENSORS ++my $linux_temp = "1.3.6.1.4.1.2021.13.16.2.1"; # temperature table ++my $linux_temp_descr = "1.3.6.1.4.1.2021.13.16.2.1.2"; # temperature entry description ++my $linux_temp_value = "1.3.6.1.4.1.2021.13.16.2.1.3"; # temperature entry value (mC) ++my $linux_fan = "1.3.6.1.4.1.2021.13.16.3.1"; # fan table ++my $linux_fan_descr = "1.3.6.1.4.1.2021.13.16.3.1.2"; # fan entry description ++my $linux_fan_value = "1.3.6.1.4.1.2021.13.16.3.1.3"; # fan entry value (RPM) ++my $linux_volt = "1.3.6.1.4.1.2021.13.16.4.1"; # voltage table ++my $linux_volt_descr = "1.3.6.1.4.1.2021.13.16.4.1.2"; # voltage entry description ++my $linux_volt_value = "1.3.6.1.4.1.2021.13.16.4.1.3"; # voltage entry value (mV) ++my $linux_misc = "1.3.6.1.4.1.2021.13.16.4.1"; # misc table ++my $linux_misc_descr = "1.3.6.1.4.1.2021.13.16.4.1.2"; # misc entry description ++my $linux_misc_value = "1.3.6.1.4.1.2021.13.16.4.1.3"; # misc entry value ++ ++ + # Globals + +-my $Version='1.2'; ++my $Version='1.3'; + + my $o_host = undef; # hostname + my $o_community = undef; # community +@@ -160,7 +175,7 @@ + my $o_version2= undef; # use snmp v2c + # check type + my $o_check_type= "cisco"; # default Cisco +-my @valid_types =("cisco","nokia","bc","iron","foundry"); ++my @valid_types =("cisco","nokia","bc","iron","foundry","linux"); + my $o_temp= undef; # max temp + my $o_fan= undef; # min fan speed + +@@ -177,7 +192,7 @@ + sub p_version { print "check_snmp_env version : $Version\n"; } + + sub print_usage { +- print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -T (cisco|nokia|bc|iron|foundry) [-F ] [-c ] [-f] [-t ] [-V]\n"; ++ print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -T (cisco|nokia|bc|iron|foundry|linux) [-F ] [-c ] [-f] [-t ] [-V]\n"; + } + + sub isnnum { # Return true if arg is not a number +@@ -221,17 +236,18 @@ + -P, --port=PORT + SNMP port (Default 161) + -T, --type=cisco|nokia|bc|iron|foundry +- Environemental check : +- cisco : voltage,temp,fan,power supply status +- will try to check everything present +- nokia : fan and power supply +- bc : fans, power supply, voltage, disks +- iron : fans, power supply, temp +- foundry : power supply, temp ++ Environemental check : ++ cisco : All Cisco equipements : voltage,temp,fan,power supply ++ (will try to check everything in the env mib) ++ nokia : Nokia IP platforms : fan and power supply ++ bc : BlueCoat platforms : fans, power supply, voltage, disks ++ iron : IronPort platforms : fans, power supply, temp ++ foundry : Foundry Network platforms : power supply, temp ++ linux : Net-SNMP with LM-SENSORS : temp, fan, volt, misc + -F, --fan= +- Minimum fan rpm value ++ Minimum fan rpm value (only needed for 'iron' & 'linux') + -c, --celcius= +- Maximum temp in degree celcius ++ Maximum temp in degree celcius (only needed for 'iron' & 'linux') + -f, --perfparse + Perfparse compatible output + -t, --timeout=INTEGER +@@ -428,8 +444,10 @@ + if (!defined ($cur_status)) { ### Error TODO + $volt_global=1; + } +- $perf_output.=" '".$$resultat{$ciscoVoltageTableDesc .".".$voltindex[$i]}."'=" ; +- $perf_output.=$$resultat{$ciscoVoltageTableValue."." . $voltindex[$i]}; ++ if (defined($$resultat{$ciscoVoltageTableValue."." . $voltindex[$i]})) { ++ $perf_output.=" '".$$resultat{$ciscoVoltageTableDesc .".".$voltindex[$i]}."'=" ; ++ $perf_output.=$$resultat{$ciscoVoltageTableValue."." . $voltindex[$i]}; ++ } + if ($Nagios_state[$CiscoEnvMonNagios{$cur_status}] ne "OK") { + $volt_global= 1; + $volt_status{$$resultat{$ciscoVoltageTableDesc .".".$voltindex[$i]}}=$cur_status; +@@ -448,8 +466,10 @@ + if (!defined ($cur_status)) { ### Error TODO + $temp_global=1; + } +- $perf_output.=" '".$$resultat{$ciscoTempTableDesc .".".$tempindex[$i]}."'=" ; +- $perf_output.=$$resultat{$ciscoTempTableValue."." . $tempindex[$i]}; ++ if (defined($$resultat{$ciscoTempTableValue."." . $tempindex[$i]})) { ++ $perf_output.=" '".$$resultat{$ciscoTempTableDesc .".".$tempindex[$i]}."'=" ; ++ $perf_output.=$$resultat{$ciscoTempTableValue."." . $tempindex[$i]}; ++ } + if ($Nagios_state[$CiscoEnvMonNagios{$cur_status}] ne "OK") { + $temp_global= 1; + $temp_status{$$resultat{$ciscoTempTableDesc .".".$tempindex[$i]}}=$cur_status; +@@ -1003,4 +1023,14 @@ + + } + +-exit (3); ++########### Cisco env checks ############## ++if ($o_check_type eq "linux") { ++ ++ verb("Checking linux env"); ++ ++ print "Not implemented yet : UNKNOWN\n"; ++ exit $ERRORS{"UNKNOWN"}; ++} ++ ++print "Unknown check type : UNKNOWN\n"; ++exit $ERRORS{"UNKNOWN"}; +## 02_check_snmp_int by Jan Wagner +## +## DP: Update script to version 1.24 + + +diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_int.pl nagios-snmp-plugins-1.1.1/check_snmp_int.pl +--- nagios-snmp-plugins-1.1.1.orig/check_snmp_int.pl 2007-04-23 11:40:39.000000000 +0200 ++++ nagios-snmp-plugins-1.1.1/check_snmp_int.pl 2007-10-12 22:23:22.000000000 +0200 +@@ -1,13 +1,12 @@ + #!/usr/bin/perl -w + ############################## check_snmp_int ############## +-# Version : 1.4.6 +-# Date : April 23 2007 ++my $Version='1.24'; ++# Date : Oct 10 2007 + # Author : Patrick Proy ( patrick at proy.org ) + # Help : http://nagios.manubulon.com + # Licence : GPL - http://www.fsf.org/licenses/gpl.txt + # Contrib : J. Jungmann, S. Probst, R. Leroy, M. Berger + # TODO : +-# Check isdn "dormant" state + # Maybe put base directory for performance as an option + ################################################################# + # +@@ -23,10 +22,8 @@ + + # Nagios specific + +-use lib "/usr/local/nagios/libexec"; +-use utils qw(%ERRORS $TIMEOUT); +-#my $TIMEOUT = 5; +-#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); ++my $TIMEOUT = 15; ++my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); + + # SNMP Datas + +@@ -36,6 +33,7 @@ + my $oper_table = '1.3.6.1.2.1.2.2.1.8.'; + my $admin_table = '1.3.6.1.2.1.2.2.1.7.'; + my $speed_table = '1.3.6.1.2.1.2.2.1.5.'; ++my $speed_table_64 = '1.3.6.1.2.1.31.1.1.1.15.'; + my $in_octet_table = '1.3.6.1.2.1.2.2.1.10.'; + my $in_octet_table_64 = '1.3.6.1.2.1.31.1.1.1.6.'; + my $in_error_table = '1.3.6.1.2.1.2.2.1.14.'; +@@ -49,7 +47,6 @@ + + # Globals + +-my $Version='1.4.6'; + + # Standard options + my $o_host = undef; # hostname +@@ -58,6 +55,7 @@ + my $o_help= undef; # wan't some help ? + my $o_admin= undef; # admin status instead of oper + my $o_inverse= undef; # Critical when up ++my $o_dormant= undef; # Dormant state is OK + my $o_verb= undef; # verbose mode + my $o_version= undef; # print version + my $o_noreg= undef; # Do not use Regexp for name +@@ -66,16 +64,16 @@ + # Performance data options + my $o_perf= undef; # Output performance data + my $o_perfe= undef; # Output discard/error also in perf data +-my $o_perfs= undef; # include speed in performance output (-S) +-my $o_perfp= undef; # output performance data in % of max speed (-y) +-my $o_perfr= undef; # output performance data in bits/s or Bytes/s (-Y) ++my $o_perfs= undef; # include speed in performance output (-S) ++my $o_perfp= undef; # output performance data in % of max speed (-y) ++my $o_perfr= undef; # output performance data in bits/s or Bytes/s (-Y) + # Speed/error checks + my $o_checkperf= undef; # checks in/out/err/disc values + my $o_delta= 300; # delta of time of perfcheck (default 5min) + my $o_ext_checkperf= undef; # extended perf checks (+error+discard) + my $o_warn_opt= undef; # warning options + my $o_crit_opt= undef; # critical options +-my $o_kbits= undef; # Warn and critical in Kbits instead of KBytes ++my $o_kbits= undef; # Warn and critical in Kbits instead of KBytes + my @o_warn= undef; # warning levels of perfcheck + my @o_crit= undef; # critical levels of perfcheck + my $o_highperf= undef; # Use 64 bits counters +@@ -152,7 +150,7 @@ + sub p_version { print "check_snmp_int version : $Version\n"; } + + sub print_usage { +- print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,) [-p ] -n [-i] [-a] [-r] [-f[eSyY]] [-k[qBMGu] -g -w -c -d] [-o ] [-t ] [-s] --label [-V]\n"; ++ print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,) [-p ] -n [-i -a -D] [-r] [-f[eSyY]] [-k[qBMGu] -g -w -c -d] [-o ] [-t ] [-s] --label [-V]\n"; + } + + sub isnnum { # Return true if arg is not a number +@@ -195,6 +193,8 @@ + Make critical when up + -a, --admin + Use administrative status instead of operational ++-D, --dormant ++ Dormant state is an OK state + -o, --octetlength=INTEGER + max-size of the SNMP message, usefull in case of Too Long responses. + Be carefull with network filters. Range 484 - 65535, default are +@@ -214,8 +214,8 @@ + --label + Add label before speed in output : in=, out=, errors-out=, etc... + -g, --64bits +- Use 64 bits counters instead of the standard counters +- when checking bandwidth & performance data. ++ Use 64 bits counters instead of the standard counters when checking ++ bandwidth & performance data for interface >= 1Gbps. + You must use snmp v2c or v3 to get 64 bits counters. + -d, --delta=seconds + make an average of seconds (default 300=5min) +@@ -284,7 +284,8 @@ + 'u' => \$o_prct, 'prct' => \$o_prct, + 'o:i' => \$o_octetlength, 'octetlength:i' => \$o_octetlength, + 'label' => \$o_label, +- 'd:i' => \$o_delta, 'delta:i' => \$o_delta ++ 'd:i' => \$o_delta, 'delta:i' => \$o_delta, ++ 'D' => \$o_dormant, 'dormant' => \$o_dormant + ); + if (defined ($o_help) ) { help(); exit $ERRORS{"UNKNOWN"}}; + if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"}}; +@@ -460,6 +461,7 @@ + my (@oid_perf,@oid_perf_outoct,@oid_perf_inoct,@oid_perf_inerr,@oid_perf_outerr,@oid_perf_indisc,@oid_perf_outdisc)= + (undef,undef,undef,undef,undef,undef,undef); + my @oid_speed=undef; ++my @oid_speed_high=undef; + my $num_int = 0; + + # Change to 64 bit counters if option is set : +@@ -494,7 +496,8 @@ + if (defined($o_perf) || defined($o_checkperf)) { + $oid_perf_inoct[$num_int]= $in_octet_table . $tindex[$num_int]; + $oid_perf_outoct[$num_int]= $out_octet_table . $tindex[$num_int]; +- $oid_speed[$num_int]=$speed_table . $tindex[$num_int]; ++ $oid_speed[$num_int]=$speed_table . $tindex[$num_int]; ++ $oid_speed_high[$num_int]=$speed_table_64 . $tindex[$num_int]; + if (defined($o_ext_checkperf) || defined($o_perfe)) { + $oid_perf_indisc[$num_int]= $in_discard_table . $tindex[$num_int]; + $oid_perf_outdisc[$num_int]= $out_discard_table . $tindex[$num_int]; +@@ -509,25 +512,25 @@ + # No interface found -> error + if ( $num_int == 0 ) { print "ERROR : Unknown interface $o_descr\n" ; exit $ERRORS{"UNKNOWN"};} + +-my ($result,$resultf)=(undef,undef); ++my $result=undef; ++# Add performance oids if requested ++if (defined($o_perf)||defined($o_checkperf)) { ++ @oids=(@oids,@oid_perf_outoct,@oid_perf_inoct,@oid_speed); ++ if (defined($o_highperf)) { ++ @oids=(@oids,@oid_speed_high); ++ } ++ if (defined ($o_ext_checkperf) || defined($o_perfe)) { ++ @oids=(@oids,@oid_perf_inerr,@oid_perf_outerr,@oid_perf_indisc,@oid_perf_outdisc); ++ } ++} ++ + # Get the requested oid values + $result = $session->get_request( + Varbindlist => \@oids + ); +-if (!defined($result)) { printf("ERROR: Status table : %s.\n", $session->error); $session->close; ++if (!defined($result)) { printf("ERROR: Status/statistics table : %s.\n", $session->error); $session->close; + exit $ERRORS{"UNKNOWN"}; + } +-# Get the perf value if -f (performance) option defined or -k (check bandwidth) +-if (defined($o_perf)||defined($o_checkperf)) { +- @oid_perf=(@oid_perf_outoct,@oid_perf_inoct,@oid_perf_inerr,@oid_perf_outerr,@oid_perf_indisc,@oid_perf_outdisc,@oid_speed); +- $resultf = $session->get_request( +- Varbindlist => \@oid_perf +- ); +- if (!defined($resultf)) { printf("ERROR: Statistics table : %s.\n", $session->error); $session->close; +- exit $ERRORS{"UNKNOWN"}; +- } +-} +- + + $session->close; + +@@ -544,6 +547,7 @@ + my $trigger_low=$timenow - 3*$o_delta; + my ($old_value,$old_time)=undef; + my $speed_unit=undef; ++my $speed_real=undef; # speed of interface using either standard or highperf mib. + + # define the OK value depending on -i option + my $ok_val= defined ($o_inverse) ? 2 : 1; +@@ -570,7 +574,22 @@ + $n_rows = shift(@ret_array); + if ($n_rows != 0) { @file_values = @ret_array }; + verb ("File read returns : $return with $n_rows rows"); +- verb ("Interface speed : $$resultf{$oid_speed[$i]}"); ++ # Get the speed in normal or highperf speed counters ++ if ($$result{$oid_speed[$i]} == 4294967295) { # Too high for this counter (cf IF-MIB) ++ if (! defined($o_highperf) && (defined($o_prct) || defined ($o_perfs) || defined ($o_perfp))) { ++ print "Cannot get interface speed with standard MIB, use highperf mib (-g) : UNKNOWN\n"; ++ exit $ERRORS{"UNKNOWN"} ++ } ++ if (defined ($$result{$oid_speed_high[$i]}) && $$result{$oid_speed_high[$i]} != 0) { ++ $speed_real=$$result{$oid_speed_high[$i]} * 1000000; ++ } else { ++ print "Cannot get interface speed using highperf mib : UNKNOWN\n"; ++ exit $ERRORS{"UNKNOWN"} ++ } ++ } else { ++ $speed_real=$$result{$oid_speed[$i]}; ++ } ++ verb ("Interface speed : $speed_real"); + #make the checks if the file is OK + if ($return ==0) { + my $j=$n_rows-1; +@@ -583,7 +602,7 @@ + my $speed_metric=undef; + if (defined($o_prct)) { # in % of speed + # Speed is in bits/s, calculated speed is in Bytes/s +- $speed_metric=$$resultf{$oid_speed[$i]}/800; ++ $speed_metric=$speed_real/800; + $speed_unit="%"; + } else { + if (defined($o_kbits)) { # metric in bits +@@ -614,24 +633,24 @@ + # First set the modulus depending on highperf counters or not + my $overfl_mod = defined ($o_highperf) ? 18446744073709551616 : 4294967296; + # Check counter (s) +- my $overfl = ($$resultf{$oid_perf_inoct[$i]} >= $file_values[$j][1] ) ? 0 : $overfl_mod; +- $checkperf_out_raw[0] = ( ($overfl + $$resultf{$oid_perf_inoct[$i]} - $file_values[$j][1])/ ++ my $overfl = ($$result{$oid_perf_inoct[$i]} >= $file_values[$j][1] ) ? 0 : $overfl_mod; ++ $checkperf_out_raw[0] = ( ($overfl + $$result{$oid_perf_inoct[$i]} - $file_values[$j][1])/ + ($timenow - $file_values[$j][0] )); + $checkperf_out[0] = $checkperf_out_raw[0] / $speed_metric; + +- $overfl = ($$resultf{$oid_perf_outoct[$i]} >= $file_values[$j][2] ) ? 0 : $overfl_mod; +- $checkperf_out_raw[1] = ( ($overfl + $$resultf{$oid_perf_outoct[$i]} - $file_values[$j][2])/ ++ $overfl = ($$result{$oid_perf_outoct[$i]} >= $file_values[$j][2] ) ? 0 : $overfl_mod; ++ $checkperf_out_raw[1] = ( ($overfl + $$result{$oid_perf_outoct[$i]} - $file_values[$j][2])/ + ($timenow - $file_values[$j][0] )); + $checkperf_out[1] = $checkperf_out_raw[1] / $speed_metric; + + if (defined($o_ext_checkperf)) { +- $checkperf_out[2] = ( ($$resultf{$oid_perf_inerr[$i]} - $file_values[$j][3])/ ++ $checkperf_out[2] = ( ($$result{$oid_perf_inerr[$i]} - $file_values[$j][3])/ + ($timenow - $file_values[$j][0] ))*60; +- $checkperf_out[3] = ( ($$resultf{$oid_perf_outerr[$i]} - $file_values[$j][4])/ ++ $checkperf_out[3] = ( ($$result{$oid_perf_outerr[$i]} - $file_values[$j][4])/ + ($timenow - $file_values[$j][0] ))*60; +- $checkperf_out[4] = ( ($$resultf{$oid_perf_indisc[$i]} - $file_values[$j][5])/ ++ $checkperf_out[4] = ( ($$result{$oid_perf_indisc[$i]} - $file_values[$j][5])/ + ($timenow - $file_values[$j][0] ))*60; +- $checkperf_out[5] = ( ($$resultf{$oid_perf_outdisc[$i]} - $file_values[$j][6])/ ++ $checkperf_out[5] = ( ($$result{$oid_perf_outdisc[$i]} - $file_values[$j][6])/ + ($timenow - $file_values[$j][0] ))*60; + } + } +@@ -641,13 +660,13 @@ + } + # Put the new values in the array and write the file + $file_values[$n_rows][0]=$timenow; +- $file_values[$n_rows][1]=$$resultf{$oid_perf_inoct[$i]}; +- $file_values[$n_rows][2]=$$resultf{$oid_perf_outoct[$i]}; ++ $file_values[$n_rows][1]=$$result{$oid_perf_inoct[$i]}; ++ $file_values[$n_rows][2]=$$result{$oid_perf_outoct[$i]}; + if (defined($o_ext_checkperf)) { # Add other values (error & disc) +- $file_values[$n_rows][3]=$$resultf{$oid_perf_inerr[$i]}; +- $file_values[$n_rows][4]=$$resultf{$oid_perf_outerr[$i]}; +- $file_values[$n_rows][5]=$$resultf{$oid_perf_indisc[$i]}; +- $file_values[$n_rows][6]=$$resultf{$oid_perf_outdisc[$i]}; ++ $file_values[$n_rows][3]=$$result{$oid_perf_inerr[$i]}; ++ $file_values[$n_rows][4]=$$result{$oid_perf_outerr[$i]}; ++ $file_values[$n_rows][5]=$$result{$oid_perf_indisc[$i]}; ++ $file_values[$n_rows][6]=$$result{$oid_perf_outdisc[$i]}; + } + $n_rows++; + $return=write_file($temp_file_name,$n_rows,$n_items_check,@file_values); +@@ -703,62 +722,79 @@ + } + # Get rid of special caracters for performance in description + $descr[$i] =~ s/'\/\(\)/_/g; +- if ( $int_status == $ok_val) { ++ if (( $int_status == $ok_val)||(defined($o_dormant) && $int_status == 5)) { + $num_ok++; + } + if (( $int_status == 1 ) && defined ($o_perf)) { + if (defined ($o_perfp)) { # output in % of speed + if ($usable_data==1) { ++ my $warn_factor=1; ++ if (!defined($o_prct)) { # warn&crit in K|M|G B|bps -> put warn_factor to make % ++ $warn_factor = (defined($o_meg)) ? 1000000 : (defined($o_gig)) ? 1000000000 : 1000; ++ if (!defined($o_kbits)) { $warn_factor*=8;} ++ $warn_factor/=$speed_real; ++ $warn_factor*=100; # now turn into displayed % : 0,1 = 10% ++ } + $perf_out .= "'" . $descr[$i] ."_in_prct'="; +- $perf_out .= sprintf("%.0f",$checkperf_out_raw[0] * 800 / $$resultf{$oid_speed[$i]}) ."%;"; +- $perf_out .= ($o_warn[0]!=0) ? $o_warn[0] . ";" : ";"; +- $perf_out .= ($o_crit[0]!=0) ? $o_crit[0] . ";" : ";"; ++ $perf_out .= sprintf("%.0f",$checkperf_out_raw[0] * 800 / $speed_real) ."%;"; ++ $perf_out .= ($o_warn[0]!=0) ? sprintf("%.0f",$o_warn[0]*$warn_factor) . ";" : ";"; ++ $perf_out .= ($o_crit[0]!=0) ? sprintf("%.0f",$o_crit[0]*$warn_factor) . ";" : ";"; + $perf_out .= "0;100 "; + $perf_out .= "'" . $descr[$i] ."_out_prct'="; +- $perf_out .= sprintf("%.0f",$checkperf_out_raw[1] * 800 / $$resultf{$oid_speed[$i]}) ."%;"; +- $perf_out .= ($o_warn[1]!=0) ? $o_warn[1] . ";" : ";"; +- $perf_out .= ($o_crit[1]!=0) ? $o_crit[1] . ";" : ";"; ++ $perf_out .= sprintf("%.0f",$checkperf_out_raw[1] * 800 / $speed_real) ."%;"; ++ $perf_out .= ($o_warn[1]!=0) ? sprintf("%.0f",$o_warn[1]*$warn_factor) . ";" : ";"; ++ $perf_out .= ($o_crit[1]!=0) ? sprintf("%.0f",$o_crit[1]*$warn_factor) . ";" : ";"; + $perf_out .= "0;100 "; + } + } elsif (defined ($o_perfr)) { # output in bites or Bytes /s + if ($usable_data==1) { + if (defined($o_kbits)) { # bps + # put warning and critical levels into bps or Bps +- my $warn_factor = (defined($o_meg)) ? 1000000 : (defined($o_gig)) ? 1000000000 : 1000; ++ my $warn_factor; ++ if (defined($o_prct)) { # warn&crit in % -> put warn_factor to 1% of speed in bps ++ $warn_factor=$speed_real/100; ++ } else { # just convert from K|M|G bps ++ $warn_factor = (defined($o_meg)) ? 1000000 : (defined($o_gig)) ? 1000000000 : 1000; ++ } + $perf_out .= "'" . $descr[$i] ."_in_bps'="; + $perf_out .= sprintf("%.0f",$checkperf_out_raw[0] * 8) .";"; + $perf_out .= ($o_warn[0]!=0) ? $o_warn[0]*$warn_factor . ";" : ";"; + $perf_out .= ($o_crit[0]!=0) ? $o_crit[0]*$warn_factor . ";" : ";"; +- $perf_out .= "0;". $$resultf{$oid_speed[$i]} ." "; ++ $perf_out .= "0;". $speed_real ." "; + $perf_out .= "'" . $descr[$i] ."_out_bps'="; + $perf_out .= sprintf("%.0f",$checkperf_out_raw[1] * 8) .";"; + $perf_out .= ($o_warn[1]!=0) ? $o_warn[1]*$warn_factor . ";" : ";"; + $perf_out .= ($o_crit[1]!=0) ? $o_crit[1]*$warn_factor . ";" : ";"; +- $perf_out .= "0;". $$resultf{$oid_speed[$i]} ." "; ++ $perf_out .= "0;". $speed_real ." "; + } else { # Bps +- my $warn_factor = (defined($o_meg)) ? 1048576 : (defined($o_gig)) ? 1073741824 : 1024; ++ my $warn_factor; ++ if (defined($o_prct)) { # warn&crit in % -> put warn_factor to 1% of speed in Bps ++ $warn_factor=$speed_real/800; ++ } else { # just convert from K|M|G bps ++ $warn_factor = (defined($o_meg)) ? 1048576 : (defined($o_gig)) ? 1073741824 : 1024; ++ } + $perf_out .= "'" . $descr[$i] ."_in_Bps'=" . sprintf("%.0f",$checkperf_out_raw[0]) .";"; + $perf_out .= ($o_warn[0]!=0) ? $o_warn[0]*$warn_factor . ";" : ";"; + $perf_out .= ($o_crit[0]!=0) ? $o_crit[0]*$warn_factor . ";" : ";"; +- $perf_out .= "0;". $$resultf{$oid_speed[$i]} ." "; ++ $perf_out .= "0;". $speed_real / 8 ." "; + $perf_out .= "'" . $descr[$i] ."_out_Bps'=" . sprintf("%.0f",$checkperf_out_raw[1]) .";" ; + $perf_out .= ($o_warn[1]!=0) ? $o_warn[1]*$warn_factor . ";" : ";"; + $perf_out .= ($o_crit[1]!=0) ? $o_crit[1]*$warn_factor . ";" : ";"; +- $perf_out .= "0;". $$resultf{$oid_speed[$i]} ." "; ++ $perf_out .= "0;". $speed_real / 8 ." "; + } + } + } else { # output in octet counter +- $perf_out .= "'" . $descr[$i] ."_in_octet'=". $$resultf{$oid_perf_inoct[$i]} ."c "; +- $perf_out .= "'" . $descr[$i] ."_out_octet'=". $$resultf{$oid_perf_outoct[$i]} ."c"; ++ $perf_out .= "'" . $descr[$i] ."_in_octet'=". $$result{$oid_perf_inoct[$i]} ."c "; ++ $perf_out .= "'" . $descr[$i] ."_out_octet'=". $$result{$oid_perf_outoct[$i]} ."c "; + } + if (defined ($o_perfe)) { +- $perf_out .= " '" . $descr[$i] ."_in_error'=". $$resultf{$oid_perf_inerr[$i]} ."c "; +- $perf_out .= "'" . $descr[$i] ."_in_discard'=". $$resultf{$oid_perf_indisc[$i]} ."c "; +- $perf_out .= "'" . $descr[$i] ."_out_error'=". $$resultf{$oid_perf_outerr[$i]} ."c "; +- $perf_out .= "'" . $descr[$i] ."_out_discard'=". $$resultf{$oid_perf_outdisc[$i]} ."c"; ++ $perf_out .= "'" . $descr[$i] ."_in_error'=". $$result{$oid_perf_inerr[$i]} ."c "; ++ $perf_out .= "'" . $descr[$i] ."_in_discard'=". $$result{$oid_perf_indisc[$i]} ."c "; ++ $perf_out .= "'" . $descr[$i] ."_out_error'=". $$result{$oid_perf_outerr[$i]} ."c "; ++ $perf_out .= "'" . $descr[$i] ."_out_discard'=". $$result{$oid_perf_outdisc[$i]} ."c "; + } + if (defined ($o_perfs)) { +- $perf_out .= " '" . $descr[$i] ."_speed_bps'=".$$resultf{$oid_speed[$i]}; ++ $perf_out .= "'" . $descr[$i] ."_speed_bps'=".$speed_real; + } + } + } +## 03_check_snmp_load by Jan Wagner +## +## DP: Update script to version 1.12 + +diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_load.pl nagios-snmp-plugins-1.1.1/check_snmp_load.pl +--- nagios-snmp-plugins-1.1.1.orig/check_snmp_load.pl 2007-04-16 19:41:20.000000000 +0200 ++++ nagios-snmp-plugins-1.1.1/check_snmp_load.pl 2007-10-12 22:23:23.000000000 +0200 +@@ -1,11 +1,10 @@ + #!/usr/bin/perl -w + ############################## check_snmp_load ################# +-# Version : 1.3.2 +-# Date : Jan 16 2007 ++my $Version='1.12'; ++# Date : Oct 12 2007 + # Author : Patrick Proy ( patrick at proy.org) +-# Help : http://www.manubulon.com/nagios/ ++# Help : http://nagios.manubulon.com/ + # Licence : GPL - http://www.fsf.org/licenses/gpl.txt +-# Changelog : HP-UX load added. + # Contributors : F. Lacroix and many others !!! + ################################################################# + # +@@ -18,10 +17,8 @@ + + # Nagios specific + +-use lib "/usr/local/nagios/libexec"; +-use utils qw(%ERRORS $TIMEOUT); +-#my $TIMEOUT = 15; +-#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); ++my $TIMEOUT = 15; ++my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); + + # SNMP Datas + +@@ -94,7 +91,6 @@ + + # Globals + +-my $Version='1.3.2'; + + my $o_host = undef; # hostname + my $o_community = undef; # community +## 04_check_snmp_process by Jan Wagner +## +## DP: Update script to version 1.10 + +diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_process.pl nagios-snmp-plugins-1.1.1/check_snmp_process.pl +--- nagios-snmp-plugins-1.1.1.orig/check_snmp_process.pl 2007-03-12 21:36:02.000000000 +0100 ++++ nagios-snmp-plugins-1.1.1/check_snmp_process.pl 2007-10-12 22:23:24.000000000 +0200 +@@ -1,45 +1,43 @@ + #!/usr/bin/perl -w + ############################## check_snmp_process ############## +-# Version : 1.4 +-# Date : March 12 2007 +-# Author : Patrick Proy (patrick at proy.org) ++my $Version='1.10'; ++# Date : Oct 12 2007 ++# Author : Patrick Proy (patrick at proy dot org) + # Help : http://nagios.manubulon.com + # Licence : GPL - http://www.fsf.org/licenses/gpl.txt +-# Contrib : Makina Corpus ++# Contrib : Makina Corpus, adam At greekattic d0t com + # TODO : put $o_delta as an option +-# Contrib : ++# If testing on localhost, selects itself.... + ############################################################### + # + # help : ./check_snmp_process -h + ++use strict; ++use Net::SNMP; ++use Getopt::Long; ++ + ############### BASE DIRECTORY FOR TEMP FILE ######## + my $o_base_dir="/tmp/tmp_Nagios_proc."; + my $file_history=200; # number of data to keep in files. + my $delta_of_time_to_make_average=300; # 5minutes by default +- +-use strict; +-use Net::SNMP; +-use Getopt::Long; + + # Nagios specific + +-use lib "/usr/local/nagios/libexec"; +-use utils qw(%ERRORS $TIMEOUT); +-#my $TIMEOUT = 5; +-#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); ++my $TIMEOUT = 15; ++my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); + + # SNMP Datas + my $process_table= '1.3.6.1.2.1.25.4.2.1'; + my $index_table = '1.3.6.1.2.1.25.4.2.1.1'; + my $run_name_table = '1.3.6.1.2.1.25.4.2.1.2'; + my $run_path_table = '1.3.6.1.2.1.25.4.2.1.4'; ++my $run_param_table = '1.3.6.1.2.1.25.4.2.1.5'; + my $proc_mem_table = '1.3.6.1.2.1.25.5.1.1.2'; # Kbytes + my $proc_cpu_table = '1.3.6.1.2.1.25.5.1.1.1'; # Centi sec of CPU + my $proc_run_state = '1.3.6.1.2.1.25.4.2.1.7'; + + # Globals + +-my $Version='1.4'; + + my $o_host = undef; # hostname + my $o_community =undef; # community +@@ -57,6 +55,8 @@ + my $o_path= undef; # check path instead of name + my $o_inverse= undef; # checks max instead of min number of process + my $o_get_all= undef; # get all tables at once ++my $o_param= undef; # Add process parameters for selection ++my $o_perf= undef; # Add performance output + my $o_timeout= 5; # Default 5s Timeout + # SNMP V3 specific + my $o_login= undef; # snmp v3 login +@@ -80,7 +80,7 @@ + sub p_version { print "check_snmp_process version : $Version\n"; } + + sub print_usage { +- print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd) [-p ] -n [-w [,] -c [,max_proc] ] [-m, -a -u, ] [-t ] [-o ] [-f ] [-r] [-V] [-g]\n"; ++ print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd) [-p ] -n [-w [,] -c [,max_proc] ] [-m, -a -u, -d ] [-t ] [-o ] [-f -A -F ] [-r] [-V] [-g]\n"; + } + + sub isnotnum { # Return true if arg is not a number +@@ -174,6 +174,12 @@ + -f, --fullpath + Use full path name instead of process name + (Windows doesn't provide full path name) ++-A, --param ++ Add parameters to select processes. ++ ex : "named.*-t /var/named/chroot" will only select named process with this parameter ++-F, --perfout ++ Add performance output ++ outputs : memory_usage, num_process, cpu_usage + -w, --warn=MIN[,MAX] + Number of process that will cause a warning + -1 for no warning, MAX must be >0. Ex : -w-1,50 +@@ -193,6 +199,8 @@ + checks cpu usage of all process + values are warning and critical values in % of CPU usage + if more than one CPU, value can be > 100% : 100%=1 CPU ++-d, --delta=seconds ++ make an average of seconds for CPU (default 300=5min) + -g, --getall + In some cases, it is necessary to get all data at once because + process die very frequently. +@@ -242,6 +250,9 @@ + '2' => \$o_version2, 'v2c' => \$o_version2, + 'o:i' => \$o_octetlength, 'octetlength:i' => \$o_octetlength, + 'g' => \$o_get_all, 'getall' => \$o_get_all, ++ 'A' => \$o_param, 'param' => \$o_param, ++ 'F' => \$o_perf, 'perfout' => \$o_perf, ++ 'd:i' => \$o_delta, 'delta:i' => \$o_delta, + 'V' => \$o_version, 'version' => \$o_version + ); + if (defined ($o_help)) { help(); exit $ERRORS{"UNKNOWN"}}; +@@ -411,6 +422,19 @@ + exit $ERRORS{"UNKNOWN"}; + } + ++my $resultat_param=undef; ++if (defined($o_param)) { # Get parameter table too ++ $resultat_param = (Net::SNMP->VERSION < 4) ? ++ $session->get_table($run_param_table) ++ :$session->get_table(Baseoid => $run_param_table); ++ if (!defined($resultat_param)) { ++ printf("ERROR: Process param table : %s.\n", $session->error); ++ $session->close; ++ exit $ERRORS{"UNKNOWN"}; ++ } ++ ++} ++ + if (defined ($o_get_all)) { + $getall_run = (Net::SNMP->VERSION < 4) ? + $session->get_table($proc_run_state ) +@@ -458,8 +482,14 @@ + verb("Filter : $o_descr"); + + foreach my $key ( keys %$resultat) { +- verb("OID : $key, Desc : $$resultat{$key}"); + # test by regexp or exact match ++ # First add param if necessary ++ if (defined($o_param)){ ++ my $pid = (split /\./,$key)[-1]; ++ $pid = $run_param_table .".".$pid; ++ $$resultat{$key} .= " " . $$resultat_param{$pid}; ++ } ++ verb("OID : $key, Desc : $$resultat{$key}"); + my $test = defined($o_noreg) + ? $$resultat{$key} eq $o_descr + : $$resultat{$key} =~ /$o_descr/; +@@ -545,6 +575,7 @@ + } + + my $final_status=0; ++my $perf_output; + my ($res_memory,$res_cpu)=(0,0); + my $memory_print=""; + my $cpu_print=""; +@@ -571,6 +602,9 @@ + } else { + $memory_print=", Mem : ".sprintf("%.1f",$res_memory)."Mb OK"; + } ++ if (defined($o_perf)) { ++ $perf_output= "'memory_usage'=".sprintf("%.1f",$res_memory) ."MB;".$o_memL[0].";".$o_memL[1]; ++ } + } + + ######## Checks CPU usage +@@ -609,6 +643,10 @@ + if ($file_values[$j][0] > $trigger_low) { + # found value = centiseconds / seconds = %cpu + $found_value= ($res_cpu-$file_values[$j][1]) / ($timenow - $file_values[$j][0] ); ++ if ($found_value <0) { # in case of program restart ++ $j=0;$found_value=undef; # don't look for more values ++ $n_rows=0; # reset file ++ } + } + } + $j--; +@@ -631,6 +669,10 @@ + } else { + $cpu_print.=", Cpu : ".sprintf("%.0f",$found_value)."% OK"; + } ++ if (defined($o_perf)) { ++ if (!defined($perf_output)) {$perf_output="";} else {$perf_output.=" ";} ++ $perf_output.= "'cpu_usage'=". sprintf("%.0f",$found_value)."%;".$o_cpuL[0].";".$o_cpuL[1]; ++ } + } else { + if ($final_status==0) { $final_status=3 }; + $cpu_print.=", No data for CPU (".$n_rows." line(s)):UNKNOWN"; +@@ -659,7 +701,14 @@ + print " (<= ",$o_warnL[1],"):OK"; + } + +-print $memory_print,$cpu_print,"\n"; ++print $memory_print,$cpu_print; ++ ++if (defined($o_perf)) { ++ if (!defined($perf_output)) {$perf_output="";} else {$perf_output.=" ";} ++ $perf_output.= "'num_process'=". $num_int_ok.";".$o_warnL[0].";".$o_critL[0]; ++ print " | ",$perf_output; ++} ++print "\n"; + + if ($final_status==2) { exit $ERRORS{"CRITICAL"};} + if ($final_status==1) { exit $ERRORS{"WARNING"};} +## 05_check_snmp_storage by Jan Wagner +## +## DP: Update script to version 1.3.3 + +diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_storage.pl nagios-snmp-plugins-1.1.1/check_snmp_storage.pl +--- nagios-snmp-plugins-1.1.1.orig/check_snmp_storage.pl 2007-03-12 22:01:36.000000000 +0100 ++++ nagios-snmp-plugins-1.1.1/check_snmp_storage.pl 2007-10-12 22:23:24.000000000 +0200 +@@ -1,12 +1,12 @@ + #!/usr/bin/perl -w + ############################## check_snmp_storage ############## +-# Version : 1.3.2 +-# Date : March 12 2007 ++# Version : 1.3.3 ++# Date : Jun 1 2007 + # Author : Patrick Proy ( patrick at proy.org) + # Help : http://nagios.manubulon.com + # Licence : GPL - http://www.fsf.org/licenses/gpl.txt + # TODO : +-# Contribs : Dimo Velev, Makina Corpus ++# Contribs : Dimo Velev, Makina Corpus, A. Greiner-Bär + ################################################################# + # + # help : ./check_snmp_storage -h +@@ -57,7 +57,7 @@ + # Globals + + my $Name='check_snmp_storage'; +-my $Version='1.3.2'; ++my $Version='1.3.3'; + + my $o_host = undef; # hostname + my $o_community = undef; # community +@@ -80,6 +80,8 @@ + my $o_perf= undef; # Output performance data + my $o_short= undef; # Short output parameters + my @o_shortL= undef; # output type,where,cut ++my $o_reserve= 0; # % reserved blocks (A. Greiner-Bär patch) ++my $o_giga= undef; # output and levels in gigabytes instead of megabytes + # SNMPv3 specific + my $o_login= undef; # Login for snmpv3 + my $o_passwd= undef; # Pass for snmpv3 +@@ -95,7 +97,7 @@ + sub p_version { print "$Name version : $Version\n"; } + + sub print_usage { +- print "Usage: $Name [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -m [-q storagetype] -w -c [-t ] [-T pl|pu|bl|bu ] [-r] [-s] [-i] [-e] [-S 0|1[,1,]] [-o ]\n"; ++ print "Usage: $Name [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -m [-q storagetype] -w -c [-t ] [-T pl|pu|bl|bu ] [-r -s -i -G] [-e] [-S 0|1[,1,]] [-o ] [-R <% reserved>]\n"; + } + + sub round ($$) { +@@ -122,7 +124,7 @@ + + sub help { + print "\nSNMP Disk Monitor for Nagios version ",$Version,"\n"; +- print "(c)2004-2006 Patrick Proy\n\n"; ++ print "(c)2004-2007 Patrick Proy\n\n"; + print_usage(); + print <[,,] +@@ -245,7 +252,9 @@ + 'q:s' => \$o_storagetype, 'storagetype:s'=> \$o_storagetype, + 'S:s' => \$o_short, 'short:s' => \$o_short, + 'o:i' => \$o_octetlength, 'octetlength:i' => \$o_octetlength, +- 'f' => \$o_perf, 'perfparse' => \$o_perf ++ 'f' => \$o_perf, 'perfparse' => \$o_perf, ++ 'R:i' => \$o_reserve, 'reserved:i' => \$o_reserve, ++ 'G' => \$o_giga, 'gigabyte' => \$o_giga + ); + if (defined($o_help) ) { help(); exit $ERRORS{"UNKNOWN"}}; + if (defined($o_version) ) { p_version(); exit $ERRORS{"UNKNOWN"}}; +@@ -271,6 +280,9 @@ + # Check compulsory attributes + if ( ! defined($o_descr) || ! defined($o_host) || !defined($o_warn) || + !defined($o_crit)) { print_usage(); exit $ERRORS{"UNKNOWN"}}; ++ # Get rid of % sign if any ++ $o_warn =~ s/\%//; ++ $o_crit =~ s/\%//; + # Check for positive numbers + if (($o_warn < 0) || ($o_crit < 0)) { print " warn and critical > 0 \n";print_usage(); exit $ERRORS{"UNKNOWN"}}; + # check if warn or crit in % and MB is tested +@@ -278,9 +290,6 @@ + print "warning or critical cannot be in % when MB are tested\n"; + print_usage(); exit $ERRORS{"UNKNOWN"}; + } +- # Get rid of % sign +- $o_warn =~ s/\%//; +- $o_crit =~ s/\%//; + # Check warning and critical values + if ( ( $o_type eq 'pu' ) || ( $o_type eq 'bu' )) { + if ($o_warn >= $o_crit) { print " warn < crit if type=",$o_type,"\n";print_usage(); exit $ERRORS{"UNKNOWN"}}; +@@ -306,6 +315,10 @@ + if (defined ($o_octetlength) && (isnnum($o_octetlength) || $o_octetlength > 65535 || $o_octetlength < 484 )) { + print "octet lenght must be < 65535 and > 484\n";print_usage(); exit $ERRORS{"UNKNOWN"}; + } ++ #### reserved blocks checks (A. Greiner-Bär patch). ++ if (defined ($o_reserve) && (isnnum($o_reserve) || $o_reserve > 99 || $o_reserve < 0 )) { ++ print "reserved blocks must be < 100 and >= 0\n";print_usage(); exit $ERRORS{"UNKNOWN"}; ++ } + } + + ########## MAIN ####### +@@ -521,21 +534,35 @@ + my $crit_state=0; + my ($p_warn,$p_crit); + my $output=undef; ++my $output_metric_val = 1024**2; ++my $output_metric = "M"; ++# Set the metric ++if (defined($o_giga)) { ++ $output_metric_val *= 1024; ++ $output_metric='G'; ++} ++ + for ($i=0;$i<$num_int;$i++) { + verb("Descr : $descr[$i]"); + verb("Size : $$result{$size_table . $tindex[$i]}"); + verb("Used : $$result{$used_table . $tindex[$i]}"); + verb("Alloc : $$result{$alloc_units . $tindex[$i]}"); +- my $to = $$result{$size_table . $tindex[$i]} * $$result{$alloc_units . $tindex[$i]} / 1024**2; ++ if (!defined($$result{$size_table . $tindex[$i]}) || ++ !defined($$result{$used_table . $tindex[$i]}) || ++ !defined ($$result{$alloc_units . $tindex[$i]})) { ++ print "Data not fully defined for storage ",$descr[$i]," : UNKNOWN\n"; ++ exit $ERRORS{"UNKNOWN"}; ++ } ++ my $to = $$result{$size_table . $tindex[$i]} * ( ( 100 - $o_reserve ) / 100 ) * $$result{$alloc_units . $tindex[$i]} / $output_metric_val; + my $pu=undef; + if ( $$result{$used_table . $tindex[$i]} != 0 ) { +- $pu = $$result{$used_table . $tindex[$i]}*100 / $$result{$size_table . $tindex[$i]}; ++ $pu = $$result{$used_table . $tindex[$i]}* 100 / ( $$result{$size_table . $tindex[$i]} * ( 100 - $o_reserve ) / 100 ); + }else { + $pu=0; + } +- my $bu = $$result{$used_table . $tindex[$i]} * $$result{$alloc_units . $tindex[$i]} / 1024**2; ++ my $bu = $$result{$used_table . $tindex[$i]} * $$result{$alloc_units . $tindex[$i]} / $output_metric_val; + my $pl = 100 - $pu; +- my $bl = ($$result{$size_table . $tindex[$i]}- $$result{$used_table . $tindex[$i]}) * $$result{$alloc_units . $tindex[$i]} / 1024**2; ++ my $bl = ( ( $$result{$size_table . $tindex[$i]} * ( ( 100 - $o_reserve ) / 100 ) - ( $$result{$used_table . $tindex[$i]} ) ) * $$result{$alloc_units . $tindex[$i]} / $output_metric_val ); + # add a ' ' if some data exists in $perf_out + $perf_out .= " " if (defined ($perf_out)) ; + ##### Ouputs and checks +@@ -554,7 +581,7 @@ + || (($pu >= $o_warn) && ($locstate=$warn_state=1)); + if (defined($o_shortL[2])) {} + if (!defined($o_shortL[0]) || ($locstate==1)) { # print full output if warn or critical state +- $output.=sprintf ("%s: %.0f%%used(%.0fMB/%.0fMB) ",$descr[$i],$pu,$bu,$to); ++ $output.=sprintf ("%s: %.0f%%used(%.0f%sB/%.0f%sB) ",$descr[$i],$pu,$bu,$output_metric,$to,$output_metric); + } elsif ($o_shortL[0] == 1) { + $output.=sprintf ("%s: %.0f%% ",$descr[$i],$pu); + } +@@ -566,9 +593,9 @@ + ( ($bu >= $o_crit) && ($locstate=$crit_state=1) ) + || ( ($bu >= $o_warn) && ($locstate=$warn_state=1) ); + if (!defined($o_shortL[0]) || ($locstate==1)) { # print full output if warn or critical state +- $output.=sprintf("%s: %.0fMBused/%.0fMB (%.0f%%) ",$descr[$i],$bu,$to,$pu); ++ $output.=sprintf("%s: %.0f%sBused/%.0f%sB (%.0f%%) ",$descr[$i],$bu,$output_metric,$to,$output_metric,$pu); + } elsif ($o_shortL[0] == 1) { +- $output.=sprintf("%s: %.0fMB ",$descr[$i],$bu); ++ $output.=sprintf("%s: %.0f%sB ",$descr[$i],$bu,$output_metric); + } + } + +@@ -578,9 +605,9 @@ + ( ($bl <= $o_crit) && ($locstate=$crit_state=1) ) + || ( ($bl <= $o_warn) && ($locstate=$warn_state=1) ); + if (!defined($o_shortL[0]) || ($locstate==1)) { # print full output if warn or critical state +- $output.=sprintf ("%s: %.0fMBleft/%.0fMB (%.0f%%) ",$descr[$i],$bl,$to,$pl); ++ $output.=sprintf ("%s: %.0f%sBleft/%.0f%sB (%.0f%%) ",$descr[$i],$bl,$output_metric,$to,$output_metric,$pl); + } elsif ($o_shortL[0] == 1) { +- $output.=sprintf ("%s: %.0fMB ",$descr[$i],$bl); ++ $output.=sprintf ("%s: %.0f%sB ",$descr[$i],$bl,$output_metric); + } + } + +@@ -590,13 +617,13 @@ + ( ($pl <= $o_crit) && ($locstate=$crit_state=1) ) + || ( ($pl <= $o_warn) && ($locstate=$warn_state=1) ); + if (!defined($o_shortL[0]) || ($locstate==1)) { # print full output if warn or critical state +- $output.=sprintf ("%s: %.0f%%left(%.0fMB/%.0fMB) ",$descr[$i],$pl,$bl,$to); ++ $output.=sprintf ("%s: %.0f%%left(%.0f%sB/%.0f%sB) ",$descr[$i],$pl,$bl,$output_metric,$to,$output_metric); + } elsif ($o_shortL[0] == 1) { + $output.=sprintf ("%s: %.0f%% ",$descr[$i],$pl); + } + } + # Performance output (in MB) +- $perf_out .= "'".$Pdescr. "'=" . round($bu,0) . "MB;" . round($p_warn,0) ++ $perf_out .= "'".$Pdescr. "'=" . round($bu,0) . $output_metric ."B;" . round($p_warn,0) + . ";" . round($p_crit,0) . ";0;" . round($to,0); + } + +@@ -606,8 +633,8 @@ + my $comp_unit=undef; + ($o_type eq "pu") && ($comp_oper ="<") && ($comp_unit ="%"); + ($o_type eq "pl") && ($comp_oper =">") && ($comp_unit ="%"); +-($o_type eq "bu") && ($comp_oper ="<") && ($comp_unit ="MB"); +-($o_type eq 'bl') && ($comp_oper =">") && ($comp_unit ="MB"); ++($o_type eq "bu") && ($comp_oper ="<") && ($comp_unit = $output_metric."B"); ++($o_type eq 'bl') && ($comp_oper =">") && ($comp_unit =$output_metric."B"); + + if (!defined ($output)) { $output="All selected storages "; } + +## 06_check_snmp_win by Jan Wagner +## +## DP: Update script to version 1.1 + +diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_win.pl nagios-snmp-plugins-1.1.1/check_snmp_win.pl +--- nagios-snmp-plugins-1.1.1.orig/check_snmp_win.pl 2006-11-29 20:59:55.000000000 +0100 ++++ nagios-snmp-plugins-1.1.1/check_snmp_win.pl 2007-10-12 22:23:25.000000000 +0200 +@@ -1,10 +1,11 @@ + #!/usr/bin/perl -w + ############################## check_snmp_win ############## +-# Version : 0.6 +-# Date : Nov 29 2006 ++my $Version='1.1'; ++# Date : Oct 12 2007 + # Author : Patrick Proy (patrick at proy.org) +-# Help : http://www.manubulon.com/nagios/ ++# Help : http://nagios.manubulon.com/ + # Licence : GPL - http://www.fsf.org/licenses/gpl.txt ++# Contrib : Tenaku + # TODO : + ############################################################### + # +@@ -16,10 +17,10 @@ + + # Nagios specific + +-use lib "/usr/local/nagios/libexec"; +-use utils qw(%ERRORS $TIMEOUT); +-#my $TIMEOUT = 5; +-#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); ++#use lib "/usr/local/nagios/libexec"; ++#use utils qw(%ERRORS $TIMEOUT); ++my $TIMEOUT = 15; ++my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); + + # SNMP Datas for processes (MIB II) + my $process_table= '1.3.6.1.2.1.25.4.2.1'; +@@ -44,7 +45,6 @@ + + # Globals + +-my $Version='0.6'; + my $Name='check_snmp_win'; + + my $o_host = undef; # hostname +@@ -93,7 +93,7 @@ + + sub help { + print "\nSNMP Windows Monitor for Nagios version ",$Version,"\n"; +- print "GPL licence, (c)2004-2005 Patrick Proy\n\n"; ++ print "GPL licence, (c)2004-2007 Patrick Proy\n\n"; + print_usage(); + print < -## -## DP: Update script to version 1.24 - - -diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_int.pl nagios-snmp-plugins-1.1.1/check_snmp_int.pl ---- nagios-snmp-plugins-1.1.1.orig/check_snmp_int.pl 2007-04-23 11:40:39.000000000 +0200 -+++ nagios-snmp-plugins-1.1.1/check_snmp_int.pl 2007-10-12 22:23:22.000000000 +0200 -@@ -1,13 +1,12 @@ - #!/usr/bin/perl -w - ############################## check_snmp_int ############## --# Version : 1.4.6 --# Date : April 23 2007 -+my $Version='1.24'; -+# Date : Oct 10 2007 - # Author : Patrick Proy ( patrick at proy.org ) - # Help : http://nagios.manubulon.com - # Licence : GPL - http://www.fsf.org/licenses/gpl.txt - # Contrib : J. Jungmann, S. Probst, R. Leroy, M. Berger - # TODO : --# Check isdn "dormant" state - # Maybe put base directory for performance as an option - ################################################################# - # -@@ -23,10 +22,8 @@ - - # Nagios specific - --use lib "/usr/local/nagios/libexec"; --use utils qw(%ERRORS $TIMEOUT); --#my $TIMEOUT = 5; --#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); -+my $TIMEOUT = 15; -+my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - - # SNMP Datas - -@@ -36,6 +33,7 @@ - my $oper_table = '1.3.6.1.2.1.2.2.1.8.'; - my $admin_table = '1.3.6.1.2.1.2.2.1.7.'; - my $speed_table = '1.3.6.1.2.1.2.2.1.5.'; -+my $speed_table_64 = '1.3.6.1.2.1.31.1.1.1.15.'; - my $in_octet_table = '1.3.6.1.2.1.2.2.1.10.'; - my $in_octet_table_64 = '1.3.6.1.2.1.31.1.1.1.6.'; - my $in_error_table = '1.3.6.1.2.1.2.2.1.14.'; -@@ -49,7 +47,6 @@ - - # Globals - --my $Version='1.4.6'; - - # Standard options - my $o_host = undef; # hostname -@@ -58,6 +55,7 @@ - my $o_help= undef; # wan't some help ? - my $o_admin= undef; # admin status instead of oper - my $o_inverse= undef; # Critical when up -+my $o_dormant= undef; # Dormant state is OK - my $o_verb= undef; # verbose mode - my $o_version= undef; # print version - my $o_noreg= undef; # Do not use Regexp for name -@@ -66,16 +64,16 @@ - # Performance data options - my $o_perf= undef; # Output performance data - my $o_perfe= undef; # Output discard/error also in perf data --my $o_perfs= undef; # include speed in performance output (-S) --my $o_perfp= undef; # output performance data in % of max speed (-y) --my $o_perfr= undef; # output performance data in bits/s or Bytes/s (-Y) -+my $o_perfs= undef; # include speed in performance output (-S) -+my $o_perfp= undef; # output performance data in % of max speed (-y) -+my $o_perfr= undef; # output performance data in bits/s or Bytes/s (-Y) - # Speed/error checks - my $o_checkperf= undef; # checks in/out/err/disc values - my $o_delta= 300; # delta of time of perfcheck (default 5min) - my $o_ext_checkperf= undef; # extended perf checks (+error+discard) - my $o_warn_opt= undef; # warning options - my $o_crit_opt= undef; # critical options --my $o_kbits= undef; # Warn and critical in Kbits instead of KBytes -+my $o_kbits= undef; # Warn and critical in Kbits instead of KBytes - my @o_warn= undef; # warning levels of perfcheck - my @o_crit= undef; # critical levels of perfcheck - my $o_highperf= undef; # Use 64 bits counters -@@ -152,7 +150,7 @@ - sub p_version { print "check_snmp_int version : $Version\n"; } - - sub print_usage { -- print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,) [-p ] -n [-i] [-a] [-r] [-f[eSyY]] [-k[qBMGu] -g -w -c -d] [-o ] [-t ] [-s] --label [-V]\n"; -+ print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,) [-p ] -n [-i -a -D] [-r] [-f[eSyY]] [-k[qBMGu] -g -w -c -d] [-o ] [-t ] [-s] --label [-V]\n"; - } - - sub isnnum { # Return true if arg is not a number -@@ -195,6 +193,8 @@ - Make critical when up - -a, --admin - Use administrative status instead of operational -+-D, --dormant -+ Dormant state is an OK state - -o, --octetlength=INTEGER - max-size of the SNMP message, usefull in case of Too Long responses. - Be carefull with network filters. Range 484 - 65535, default are -@@ -214,8 +214,8 @@ - --label - Add label before speed in output : in=, out=, errors-out=, etc... - -g, --64bits -- Use 64 bits counters instead of the standard counters -- when checking bandwidth & performance data. -+ Use 64 bits counters instead of the standard counters when checking -+ bandwidth & performance data for interface >= 1Gbps. - You must use snmp v2c or v3 to get 64 bits counters. - -d, --delta=seconds - make an average of seconds (default 300=5min) -@@ -284,7 +284,8 @@ - 'u' => \$o_prct, 'prct' => \$o_prct, - 'o:i' => \$o_octetlength, 'octetlength:i' => \$o_octetlength, - 'label' => \$o_label, -- 'd:i' => \$o_delta, 'delta:i' => \$o_delta -+ 'd:i' => \$o_delta, 'delta:i' => \$o_delta, -+ 'D' => \$o_dormant, 'dormant' => \$o_dormant - ); - if (defined ($o_help) ) { help(); exit $ERRORS{"UNKNOWN"}}; - if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"}}; -@@ -460,6 +461,7 @@ - my (@oid_perf,@oid_perf_outoct,@oid_perf_inoct,@oid_perf_inerr,@oid_perf_outerr,@oid_perf_indisc,@oid_perf_outdisc)= - (undef,undef,undef,undef,undef,undef,undef); - my @oid_speed=undef; -+my @oid_speed_high=undef; - my $num_int = 0; - - # Change to 64 bit counters if option is set : -@@ -494,7 +496,8 @@ - if (defined($o_perf) || defined($o_checkperf)) { - $oid_perf_inoct[$num_int]= $in_octet_table . $tindex[$num_int]; - $oid_perf_outoct[$num_int]= $out_octet_table . $tindex[$num_int]; -- $oid_speed[$num_int]=$speed_table . $tindex[$num_int]; -+ $oid_speed[$num_int]=$speed_table . $tindex[$num_int]; -+ $oid_speed_high[$num_int]=$speed_table_64 . $tindex[$num_int]; - if (defined($o_ext_checkperf) || defined($o_perfe)) { - $oid_perf_indisc[$num_int]= $in_discard_table . $tindex[$num_int]; - $oid_perf_outdisc[$num_int]= $out_discard_table . $tindex[$num_int]; -@@ -509,25 +512,25 @@ - # No interface found -> error - if ( $num_int == 0 ) { print "ERROR : Unknown interface $o_descr\n" ; exit $ERRORS{"UNKNOWN"};} - --my ($result,$resultf)=(undef,undef); -+my $result=undef; -+# Add performance oids if requested -+if (defined($o_perf)||defined($o_checkperf)) { -+ @oids=(@oids,@oid_perf_outoct,@oid_perf_inoct,@oid_speed); -+ if (defined($o_highperf)) { -+ @oids=(@oids,@oid_speed_high); -+ } -+ if (defined ($o_ext_checkperf) || defined($o_perfe)) { -+ @oids=(@oids,@oid_perf_inerr,@oid_perf_outerr,@oid_perf_indisc,@oid_perf_outdisc); -+ } -+} -+ - # Get the requested oid values - $result = $session->get_request( - Varbindlist => \@oids - ); --if (!defined($result)) { printf("ERROR: Status table : %s.\n", $session->error); $session->close; -+if (!defined($result)) { printf("ERROR: Status/statistics table : %s.\n", $session->error); $session->close; - exit $ERRORS{"UNKNOWN"}; - } --# Get the perf value if -f (performance) option defined or -k (check bandwidth) --if (defined($o_perf)||defined($o_checkperf)) { -- @oid_perf=(@oid_perf_outoct,@oid_perf_inoct,@oid_perf_inerr,@oid_perf_outerr,@oid_perf_indisc,@oid_perf_outdisc,@oid_speed); -- $resultf = $session->get_request( -- Varbindlist => \@oid_perf -- ); -- if (!defined($resultf)) { printf("ERROR: Statistics table : %s.\n", $session->error); $session->close; -- exit $ERRORS{"UNKNOWN"}; -- } --} -- - - $session->close; - -@@ -544,6 +547,7 @@ - my $trigger_low=$timenow - 3*$o_delta; - my ($old_value,$old_time)=undef; - my $speed_unit=undef; -+my $speed_real=undef; # speed of interface using either standard or highperf mib. - - # define the OK value depending on -i option - my $ok_val= defined ($o_inverse) ? 2 : 1; -@@ -570,7 +574,22 @@ - $n_rows = shift(@ret_array); - if ($n_rows != 0) { @file_values = @ret_array }; - verb ("File read returns : $return with $n_rows rows"); -- verb ("Interface speed : $$resultf{$oid_speed[$i]}"); -+ # Get the speed in normal or highperf speed counters -+ if ($$result{$oid_speed[$i]} == 4294967295) { # Too high for this counter (cf IF-MIB) -+ if (! defined($o_highperf) && (defined($o_prct) || defined ($o_perfs) || defined ($o_perfp))) { -+ print "Cannot get interface speed with standard MIB, use highperf mib (-g) : UNKNOWN\n"; -+ exit $ERRORS{"UNKNOWN"} -+ } -+ if (defined ($$result{$oid_speed_high[$i]}) && $$result{$oid_speed_high[$i]} != 0) { -+ $speed_real=$$result{$oid_speed_high[$i]} * 1000000; -+ } else { -+ print "Cannot get interface speed using highperf mib : UNKNOWN\n"; -+ exit $ERRORS{"UNKNOWN"} -+ } -+ } else { -+ $speed_real=$$result{$oid_speed[$i]}; -+ } -+ verb ("Interface speed : $speed_real"); - #make the checks if the file is OK - if ($return ==0) { - my $j=$n_rows-1; -@@ -583,7 +602,7 @@ - my $speed_metric=undef; - if (defined($o_prct)) { # in % of speed - # Speed is in bits/s, calculated speed is in Bytes/s -- $speed_metric=$$resultf{$oid_speed[$i]}/800; -+ $speed_metric=$speed_real/800; - $speed_unit="%"; - } else { - if (defined($o_kbits)) { # metric in bits -@@ -614,24 +633,24 @@ - # First set the modulus depending on highperf counters or not - my $overfl_mod = defined ($o_highperf) ? 18446744073709551616 : 4294967296; - # Check counter (s) -- my $overfl = ($$resultf{$oid_perf_inoct[$i]} >= $file_values[$j][1] ) ? 0 : $overfl_mod; -- $checkperf_out_raw[0] = ( ($overfl + $$resultf{$oid_perf_inoct[$i]} - $file_values[$j][1])/ -+ my $overfl = ($$result{$oid_perf_inoct[$i]} >= $file_values[$j][1] ) ? 0 : $overfl_mod; -+ $checkperf_out_raw[0] = ( ($overfl + $$result{$oid_perf_inoct[$i]} - $file_values[$j][1])/ - ($timenow - $file_values[$j][0] )); - $checkperf_out[0] = $checkperf_out_raw[0] / $speed_metric; - -- $overfl = ($$resultf{$oid_perf_outoct[$i]} >= $file_values[$j][2] ) ? 0 : $overfl_mod; -- $checkperf_out_raw[1] = ( ($overfl + $$resultf{$oid_perf_outoct[$i]} - $file_values[$j][2])/ -+ $overfl = ($$result{$oid_perf_outoct[$i]} >= $file_values[$j][2] ) ? 0 : $overfl_mod; -+ $checkperf_out_raw[1] = ( ($overfl + $$result{$oid_perf_outoct[$i]} - $file_values[$j][2])/ - ($timenow - $file_values[$j][0] )); - $checkperf_out[1] = $checkperf_out_raw[1] / $speed_metric; - - if (defined($o_ext_checkperf)) { -- $checkperf_out[2] = ( ($$resultf{$oid_perf_inerr[$i]} - $file_values[$j][3])/ -+ $checkperf_out[2] = ( ($$result{$oid_perf_inerr[$i]} - $file_values[$j][3])/ - ($timenow - $file_values[$j][0] ))*60; -- $checkperf_out[3] = ( ($$resultf{$oid_perf_outerr[$i]} - $file_values[$j][4])/ -+ $checkperf_out[3] = ( ($$result{$oid_perf_outerr[$i]} - $file_values[$j][4])/ - ($timenow - $file_values[$j][0] ))*60; -- $checkperf_out[4] = ( ($$resultf{$oid_perf_indisc[$i]} - $file_values[$j][5])/ -+ $checkperf_out[4] = ( ($$result{$oid_perf_indisc[$i]} - $file_values[$j][5])/ - ($timenow - $file_values[$j][0] ))*60; -- $checkperf_out[5] = ( ($$resultf{$oid_perf_outdisc[$i]} - $file_values[$j][6])/ -+ $checkperf_out[5] = ( ($$result{$oid_perf_outdisc[$i]} - $file_values[$j][6])/ - ($timenow - $file_values[$j][0] ))*60; - } - } -@@ -641,13 +660,13 @@ - } - # Put the new values in the array and write the file - $file_values[$n_rows][0]=$timenow; -- $file_values[$n_rows][1]=$$resultf{$oid_perf_inoct[$i]}; -- $file_values[$n_rows][2]=$$resultf{$oid_perf_outoct[$i]}; -+ $file_values[$n_rows][1]=$$result{$oid_perf_inoct[$i]}; -+ $file_values[$n_rows][2]=$$result{$oid_perf_outoct[$i]}; - if (defined($o_ext_checkperf)) { # Add other values (error & disc) -- $file_values[$n_rows][3]=$$resultf{$oid_perf_inerr[$i]}; -- $file_values[$n_rows][4]=$$resultf{$oid_perf_outerr[$i]}; -- $file_values[$n_rows][5]=$$resultf{$oid_perf_indisc[$i]}; -- $file_values[$n_rows][6]=$$resultf{$oid_perf_outdisc[$i]}; -+ $file_values[$n_rows][3]=$$result{$oid_perf_inerr[$i]}; -+ $file_values[$n_rows][4]=$$result{$oid_perf_outerr[$i]}; -+ $file_values[$n_rows][5]=$$result{$oid_perf_indisc[$i]}; -+ $file_values[$n_rows][6]=$$result{$oid_perf_outdisc[$i]}; - } - $n_rows++; - $return=write_file($temp_file_name,$n_rows,$n_items_check,@file_values); -@@ -703,62 +722,79 @@ - } - # Get rid of special caracters for performance in description - $descr[$i] =~ s/'\/\(\)/_/g; -- if ( $int_status == $ok_val) { -+ if (( $int_status == $ok_val)||(defined($o_dormant) && $int_status == 5)) { - $num_ok++; - } - if (( $int_status == 1 ) && defined ($o_perf)) { - if (defined ($o_perfp)) { # output in % of speed - if ($usable_data==1) { -+ my $warn_factor=1; -+ if (!defined($o_prct)) { # warn&crit in K|M|G B|bps -> put warn_factor to make % -+ $warn_factor = (defined($o_meg)) ? 1000000 : (defined($o_gig)) ? 1000000000 : 1000; -+ if (!defined($o_kbits)) { $warn_factor*=8;} -+ $warn_factor/=$speed_real; -+ $warn_factor*=100; # now turn into displayed % : 0,1 = 10% -+ } - $perf_out .= "'" . $descr[$i] ."_in_prct'="; -- $perf_out .= sprintf("%.0f",$checkperf_out_raw[0] * 800 / $$resultf{$oid_speed[$i]}) ."%;"; -- $perf_out .= ($o_warn[0]!=0) ? $o_warn[0] . ";" : ";"; -- $perf_out .= ($o_crit[0]!=0) ? $o_crit[0] . ";" : ";"; -+ $perf_out .= sprintf("%.0f",$checkperf_out_raw[0] * 800 / $speed_real) ."%;"; -+ $perf_out .= ($o_warn[0]!=0) ? sprintf("%.0f",$o_warn[0]*$warn_factor) . ";" : ";"; -+ $perf_out .= ($o_crit[0]!=0) ? sprintf("%.0f",$o_crit[0]*$warn_factor) . ";" : ";"; - $perf_out .= "0;100 "; - $perf_out .= "'" . $descr[$i] ."_out_prct'="; -- $perf_out .= sprintf("%.0f",$checkperf_out_raw[1] * 800 / $$resultf{$oid_speed[$i]}) ."%;"; -- $perf_out .= ($o_warn[1]!=0) ? $o_warn[1] . ";" : ";"; -- $perf_out .= ($o_crit[1]!=0) ? $o_crit[1] . ";" : ";"; -+ $perf_out .= sprintf("%.0f",$checkperf_out_raw[1] * 800 / $speed_real) ."%;"; -+ $perf_out .= ($o_warn[1]!=0) ? sprintf("%.0f",$o_warn[1]*$warn_factor) . ";" : ";"; -+ $perf_out .= ($o_crit[1]!=0) ? sprintf("%.0f",$o_crit[1]*$warn_factor) . ";" : ";"; - $perf_out .= "0;100 "; - } - } elsif (defined ($o_perfr)) { # output in bites or Bytes /s - if ($usable_data==1) { - if (defined($o_kbits)) { # bps - # put warning and critical levels into bps or Bps -- my $warn_factor = (defined($o_meg)) ? 1000000 : (defined($o_gig)) ? 1000000000 : 1000; -+ my $warn_factor; -+ if (defined($o_prct)) { # warn&crit in % -> put warn_factor to 1% of speed in bps -+ $warn_factor=$speed_real/100; -+ } else { # just convert from K|M|G bps -+ $warn_factor = (defined($o_meg)) ? 1000000 : (defined($o_gig)) ? 1000000000 : 1000; -+ } - $perf_out .= "'" . $descr[$i] ."_in_bps'="; - $perf_out .= sprintf("%.0f",$checkperf_out_raw[0] * 8) .";"; - $perf_out .= ($o_warn[0]!=0) ? $o_warn[0]*$warn_factor . ";" : ";"; - $perf_out .= ($o_crit[0]!=0) ? $o_crit[0]*$warn_factor . ";" : ";"; -- $perf_out .= "0;". $$resultf{$oid_speed[$i]} ." "; -+ $perf_out .= "0;". $speed_real ." "; - $perf_out .= "'" . $descr[$i] ."_out_bps'="; - $perf_out .= sprintf("%.0f",$checkperf_out_raw[1] * 8) .";"; - $perf_out .= ($o_warn[1]!=0) ? $o_warn[1]*$warn_factor . ";" : ";"; - $perf_out .= ($o_crit[1]!=0) ? $o_crit[1]*$warn_factor . ";" : ";"; -- $perf_out .= "0;". $$resultf{$oid_speed[$i]} ." "; -+ $perf_out .= "0;". $speed_real ." "; - } else { # Bps -- my $warn_factor = (defined($o_meg)) ? 1048576 : (defined($o_gig)) ? 1073741824 : 1024; -+ my $warn_factor; -+ if (defined($o_prct)) { # warn&crit in % -> put warn_factor to 1% of speed in Bps -+ $warn_factor=$speed_real/800; -+ } else { # just convert from K|M|G bps -+ $warn_factor = (defined($o_meg)) ? 1048576 : (defined($o_gig)) ? 1073741824 : 1024; -+ } - $perf_out .= "'" . $descr[$i] ."_in_Bps'=" . sprintf("%.0f",$checkperf_out_raw[0]) .";"; - $perf_out .= ($o_warn[0]!=0) ? $o_warn[0]*$warn_factor . ";" : ";"; - $perf_out .= ($o_crit[0]!=0) ? $o_crit[0]*$warn_factor . ";" : ";"; -- $perf_out .= "0;". $$resultf{$oid_speed[$i]} ." "; -+ $perf_out .= "0;". $speed_real / 8 ." "; - $perf_out .= "'" . $descr[$i] ."_out_Bps'=" . sprintf("%.0f",$checkperf_out_raw[1]) .";" ; - $perf_out .= ($o_warn[1]!=0) ? $o_warn[1]*$warn_factor . ";" : ";"; - $perf_out .= ($o_crit[1]!=0) ? $o_crit[1]*$warn_factor . ";" : ";"; -- $perf_out .= "0;". $$resultf{$oid_speed[$i]} ." "; -+ $perf_out .= "0;". $speed_real / 8 ." "; - } - } - } else { # output in octet counter -- $perf_out .= "'" . $descr[$i] ."_in_octet'=". $$resultf{$oid_perf_inoct[$i]} ."c "; -- $perf_out .= "'" . $descr[$i] ."_out_octet'=". $$resultf{$oid_perf_outoct[$i]} ."c"; -+ $perf_out .= "'" . $descr[$i] ."_in_octet'=". $$result{$oid_perf_inoct[$i]} ."c "; -+ $perf_out .= "'" . $descr[$i] ."_out_octet'=". $$result{$oid_perf_outoct[$i]} ."c "; - } - if (defined ($o_perfe)) { -- $perf_out .= " '" . $descr[$i] ."_in_error'=". $$resultf{$oid_perf_inerr[$i]} ."c "; -- $perf_out .= "'" . $descr[$i] ."_in_discard'=". $$resultf{$oid_perf_indisc[$i]} ."c "; -- $perf_out .= "'" . $descr[$i] ."_out_error'=". $$resultf{$oid_perf_outerr[$i]} ."c "; -- $perf_out .= "'" . $descr[$i] ."_out_discard'=". $$resultf{$oid_perf_outdisc[$i]} ."c"; -+ $perf_out .= "'" . $descr[$i] ."_in_error'=". $$result{$oid_perf_inerr[$i]} ."c "; -+ $perf_out .= "'" . $descr[$i] ."_in_discard'=". $$result{$oid_perf_indisc[$i]} ."c "; -+ $perf_out .= "'" . $descr[$i] ."_out_error'=". $$result{$oid_perf_outerr[$i]} ."c "; -+ $perf_out .= "'" . $descr[$i] ."_out_discard'=". $$result{$oid_perf_outdisc[$i]} ."c "; - } - if (defined ($o_perfs)) { -- $perf_out .= " '" . $descr[$i] ."_speed_bps'=".$$resultf{$oid_speed[$i]}; -+ $perf_out .= "'" . $descr[$i] ."_speed_bps'=".$speed_real; - } - } - } diff --git a/debian/patches/03_check_snmp_load b/debian/patches/03_check_snmp_load deleted file mode 100644 index 9539b73..0000000 --- a/debian/patches/03_check_snmp_load +++ /dev/null @@ -1,43 +0,0 @@ -## 03_check_snmp_load by Jan Wagner -## -## DP: Update script to version 1.12 - -diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_load.pl nagios-snmp-plugins-1.1.1/check_snmp_load.pl ---- nagios-snmp-plugins-1.1.1.orig/check_snmp_load.pl 2007-04-16 19:41:20.000000000 +0200 -+++ nagios-snmp-plugins-1.1.1/check_snmp_load.pl 2007-10-12 22:23:23.000000000 +0200 -@@ -1,11 +1,10 @@ - #!/usr/bin/perl -w - ############################## check_snmp_load ################# --# Version : 1.3.2 --# Date : Jan 16 2007 -+my $Version='1.12'; -+# Date : Oct 12 2007 - # Author : Patrick Proy ( patrick at proy.org) --# Help : http://www.manubulon.com/nagios/ -+# Help : http://nagios.manubulon.com/ - # Licence : GPL - http://www.fsf.org/licenses/gpl.txt --# Changelog : HP-UX load added. - # Contributors : F. Lacroix and many others !!! - ################################################################# - # -@@ -18,10 +17,8 @@ - - # Nagios specific - --use lib "/usr/local/nagios/libexec"; --use utils qw(%ERRORS $TIMEOUT); --#my $TIMEOUT = 15; --#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); -+my $TIMEOUT = 15; -+my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - - # SNMP Datas - -@@ -94,7 +91,6 @@ - - # Globals - --my $Version='1.3.2'; - - my $o_host = undef; # hostname - my $o_community = undef; # community diff --git a/debian/patches/04_check_snmp_process b/debian/patches/04_check_snmp_process deleted file mode 100644 index 4476752..0000000 --- a/debian/patches/04_check_snmp_process +++ /dev/null @@ -1,207 +0,0 @@ -## 04_check_snmp_process by Jan Wagner -## -## DP: Update script to version 1.10 - -diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_process.pl nagios-snmp-plugins-1.1.1/check_snmp_process.pl ---- nagios-snmp-plugins-1.1.1.orig/check_snmp_process.pl 2007-03-12 21:36:02.000000000 +0100 -+++ nagios-snmp-plugins-1.1.1/check_snmp_process.pl 2007-10-12 22:23:24.000000000 +0200 -@@ -1,45 +1,43 @@ - #!/usr/bin/perl -w - ############################## check_snmp_process ############## --# Version : 1.4 --# Date : March 12 2007 --# Author : Patrick Proy (patrick at proy.org) -+my $Version='1.10'; -+# Date : Oct 12 2007 -+# Author : Patrick Proy (patrick at proy dot org) - # Help : http://nagios.manubulon.com - # Licence : GPL - http://www.fsf.org/licenses/gpl.txt --# Contrib : Makina Corpus -+# Contrib : Makina Corpus, adam At greekattic d0t com - # TODO : put $o_delta as an option --# Contrib : -+# If testing on localhost, selects itself.... - ############################################################### - # - # help : ./check_snmp_process -h - -+use strict; -+use Net::SNMP; -+use Getopt::Long; -+ - ############### BASE DIRECTORY FOR TEMP FILE ######## - my $o_base_dir="/tmp/tmp_Nagios_proc."; - my $file_history=200; # number of data to keep in files. - my $delta_of_time_to_make_average=300; # 5minutes by default -- --use strict; --use Net::SNMP; --use Getopt::Long; - - # Nagios specific - --use lib "/usr/local/nagios/libexec"; --use utils qw(%ERRORS $TIMEOUT); --#my $TIMEOUT = 5; --#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); -+my $TIMEOUT = 15; -+my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - - # SNMP Datas - my $process_table= '1.3.6.1.2.1.25.4.2.1'; - my $index_table = '1.3.6.1.2.1.25.4.2.1.1'; - my $run_name_table = '1.3.6.1.2.1.25.4.2.1.2'; - my $run_path_table = '1.3.6.1.2.1.25.4.2.1.4'; -+my $run_param_table = '1.3.6.1.2.1.25.4.2.1.5'; - my $proc_mem_table = '1.3.6.1.2.1.25.5.1.1.2'; # Kbytes - my $proc_cpu_table = '1.3.6.1.2.1.25.5.1.1.1'; # Centi sec of CPU - my $proc_run_state = '1.3.6.1.2.1.25.4.2.1.7'; - - # Globals - --my $Version='1.4'; - - my $o_host = undef; # hostname - my $o_community =undef; # community -@@ -57,6 +55,8 @@ - my $o_path= undef; # check path instead of name - my $o_inverse= undef; # checks max instead of min number of process - my $o_get_all= undef; # get all tables at once -+my $o_param= undef; # Add process parameters for selection -+my $o_perf= undef; # Add performance output - my $o_timeout= 5; # Default 5s Timeout - # SNMP V3 specific - my $o_login= undef; # snmp v3 login -@@ -80,7 +80,7 @@ - sub p_version { print "check_snmp_process version : $Version\n"; } - - sub print_usage { -- print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd) [-p ] -n [-w [,] -c [,max_proc] ] [-m, -a -u, ] [-t ] [-o ] [-f ] [-r] [-V] [-g]\n"; -+ print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd) [-p ] -n [-w [,] -c [,max_proc] ] [-m, -a -u, -d ] [-t ] [-o ] [-f -A -F ] [-r] [-V] [-g]\n"; - } - - sub isnotnum { # Return true if arg is not a number -@@ -174,6 +174,12 @@ - -f, --fullpath - Use full path name instead of process name - (Windows doesn't provide full path name) -+-A, --param -+ Add parameters to select processes. -+ ex : "named.*-t /var/named/chroot" will only select named process with this parameter -+-F, --perfout -+ Add performance output -+ outputs : memory_usage, num_process, cpu_usage - -w, --warn=MIN[,MAX] - Number of process that will cause a warning - -1 for no warning, MAX must be >0. Ex : -w-1,50 -@@ -193,6 +199,8 @@ - checks cpu usage of all process - values are warning and critical values in % of CPU usage - if more than one CPU, value can be > 100% : 100%=1 CPU -+-d, --delta=seconds -+ make an average of seconds for CPU (default 300=5min) - -g, --getall - In some cases, it is necessary to get all data at once because - process die very frequently. -@@ -242,6 +250,9 @@ - '2' => \$o_version2, 'v2c' => \$o_version2, - 'o:i' => \$o_octetlength, 'octetlength:i' => \$o_octetlength, - 'g' => \$o_get_all, 'getall' => \$o_get_all, -+ 'A' => \$o_param, 'param' => \$o_param, -+ 'F' => \$o_perf, 'perfout' => \$o_perf, -+ 'd:i' => \$o_delta, 'delta:i' => \$o_delta, - 'V' => \$o_version, 'version' => \$o_version - ); - if (defined ($o_help)) { help(); exit $ERRORS{"UNKNOWN"}}; -@@ -411,6 +422,19 @@ - exit $ERRORS{"UNKNOWN"}; - } - -+my $resultat_param=undef; -+if (defined($o_param)) { # Get parameter table too -+ $resultat_param = (Net::SNMP->VERSION < 4) ? -+ $session->get_table($run_param_table) -+ :$session->get_table(Baseoid => $run_param_table); -+ if (!defined($resultat_param)) { -+ printf("ERROR: Process param table : %s.\n", $session->error); -+ $session->close; -+ exit $ERRORS{"UNKNOWN"}; -+ } -+ -+} -+ - if (defined ($o_get_all)) { - $getall_run = (Net::SNMP->VERSION < 4) ? - $session->get_table($proc_run_state ) -@@ -458,8 +482,14 @@ - verb("Filter : $o_descr"); - - foreach my $key ( keys %$resultat) { -- verb("OID : $key, Desc : $$resultat{$key}"); - # test by regexp or exact match -+ # First add param if necessary -+ if (defined($o_param)){ -+ my $pid = (split /\./,$key)[-1]; -+ $pid = $run_param_table .".".$pid; -+ $$resultat{$key} .= " " . $$resultat_param{$pid}; -+ } -+ verb("OID : $key, Desc : $$resultat{$key}"); - my $test = defined($o_noreg) - ? $$resultat{$key} eq $o_descr - : $$resultat{$key} =~ /$o_descr/; -@@ -545,6 +575,7 @@ - } - - my $final_status=0; -+my $perf_output; - my ($res_memory,$res_cpu)=(0,0); - my $memory_print=""; - my $cpu_print=""; -@@ -571,6 +602,9 @@ - } else { - $memory_print=", Mem : ".sprintf("%.1f",$res_memory)."Mb OK"; - } -+ if (defined($o_perf)) { -+ $perf_output= "'memory_usage'=".sprintf("%.1f",$res_memory) ."MB;".$o_memL[0].";".$o_memL[1]; -+ } - } - - ######## Checks CPU usage -@@ -609,6 +643,10 @@ - if ($file_values[$j][0] > $trigger_low) { - # found value = centiseconds / seconds = %cpu - $found_value= ($res_cpu-$file_values[$j][1]) / ($timenow - $file_values[$j][0] ); -+ if ($found_value <0) { # in case of program restart -+ $j=0;$found_value=undef; # don't look for more values -+ $n_rows=0; # reset file -+ } - } - } - $j--; -@@ -631,6 +669,10 @@ - } else { - $cpu_print.=", Cpu : ".sprintf("%.0f",$found_value)."% OK"; - } -+ if (defined($o_perf)) { -+ if (!defined($perf_output)) {$perf_output="";} else {$perf_output.=" ";} -+ $perf_output.= "'cpu_usage'=". sprintf("%.0f",$found_value)."%;".$o_cpuL[0].";".$o_cpuL[1]; -+ } - } else { - if ($final_status==0) { $final_status=3 }; - $cpu_print.=", No data for CPU (".$n_rows." line(s)):UNKNOWN"; -@@ -659,7 +701,14 @@ - print " (<= ",$o_warnL[1],"):OK"; - } - --print $memory_print,$cpu_print,"\n"; -+print $memory_print,$cpu_print; -+ -+if (defined($o_perf)) { -+ if (!defined($perf_output)) {$perf_output="";} else {$perf_output.=" ";} -+ $perf_output.= "'num_process'=". $num_int_ok.";".$o_warnL[0].";".$o_critL[0]; -+ print " | ",$perf_output; -+} -+print "\n"; - - if ($final_status==2) { exit $ERRORS{"CRITICAL"};} - if ($final_status==1) { exit $ERRORS{"WARNING"};} diff --git a/debian/patches/05_check_snmp_storage b/debian/patches/05_check_snmp_storage deleted file mode 100644 index c7c675d..0000000 --- a/debian/patches/05_check_snmp_storage +++ /dev/null @@ -1,222 +0,0 @@ -## 05_check_snmp_storage by Jan Wagner -## -## DP: Update script to version 1.3.3 - -diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_storage.pl nagios-snmp-plugins-1.1.1/check_snmp_storage.pl ---- nagios-snmp-plugins-1.1.1.orig/check_snmp_storage.pl 2007-03-12 22:01:36.000000000 +0100 -+++ nagios-snmp-plugins-1.1.1/check_snmp_storage.pl 2007-10-12 22:23:24.000000000 +0200 -@@ -1,12 +1,12 @@ - #!/usr/bin/perl -w - ############################## check_snmp_storage ############## --# Version : 1.3.2 --# Date : March 12 2007 -+# Version : 1.3.3 -+# Date : Jun 1 2007 - # Author : Patrick Proy ( patrick at proy.org) - # Help : http://nagios.manubulon.com - # Licence : GPL - http://www.fsf.org/licenses/gpl.txt - # TODO : --# Contribs : Dimo Velev, Makina Corpus -+# Contribs : Dimo Velev, Makina Corpus, A. Greiner-Bär - ################################################################# - # - # help : ./check_snmp_storage -h -@@ -57,7 +57,7 @@ - # Globals - - my $Name='check_snmp_storage'; --my $Version='1.3.2'; -+my $Version='1.3.3'; - - my $o_host = undef; # hostname - my $o_community = undef; # community -@@ -80,6 +80,8 @@ - my $o_perf= undef; # Output performance data - my $o_short= undef; # Short output parameters - my @o_shortL= undef; # output type,where,cut -+my $o_reserve= 0; # % reserved blocks (A. Greiner-Bär patch) -+my $o_giga= undef; # output and levels in gigabytes instead of megabytes - # SNMPv3 specific - my $o_login= undef; # Login for snmpv3 - my $o_passwd= undef; # Pass for snmpv3 -@@ -95,7 +97,7 @@ - sub p_version { print "$Name version : $Version\n"; } - - sub print_usage { -- print "Usage: $Name [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -m [-q storagetype] -w -c [-t ] [-T pl|pu|bl|bu ] [-r] [-s] [-i] [-e] [-S 0|1[,1,]] [-o ]\n"; -+ print "Usage: $Name [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -m [-q storagetype] -w -c [-t ] [-T pl|pu|bl|bu ] [-r -s -i -G] [-e] [-S 0|1[,1,]] [-o ] [-R <% reserved>]\n"; - } - - sub round ($$) { -@@ -122,7 +124,7 @@ - - sub help { - print "\nSNMP Disk Monitor for Nagios version ",$Version,"\n"; -- print "(c)2004-2006 Patrick Proy\n\n"; -+ print "(c)2004-2007 Patrick Proy\n\n"; - print_usage(); - print <[,,] -@@ -245,7 +252,9 @@ - 'q:s' => \$o_storagetype, 'storagetype:s'=> \$o_storagetype, - 'S:s' => \$o_short, 'short:s' => \$o_short, - 'o:i' => \$o_octetlength, 'octetlength:i' => \$o_octetlength, -- 'f' => \$o_perf, 'perfparse' => \$o_perf -+ 'f' => \$o_perf, 'perfparse' => \$o_perf, -+ 'R:i' => \$o_reserve, 'reserved:i' => \$o_reserve, -+ 'G' => \$o_giga, 'gigabyte' => \$o_giga - ); - if (defined($o_help) ) { help(); exit $ERRORS{"UNKNOWN"}}; - if (defined($o_version) ) { p_version(); exit $ERRORS{"UNKNOWN"}}; -@@ -271,6 +280,9 @@ - # Check compulsory attributes - if ( ! defined($o_descr) || ! defined($o_host) || !defined($o_warn) || - !defined($o_crit)) { print_usage(); exit $ERRORS{"UNKNOWN"}}; -+ # Get rid of % sign if any -+ $o_warn =~ s/\%//; -+ $o_crit =~ s/\%//; - # Check for positive numbers - if (($o_warn < 0) || ($o_crit < 0)) { print " warn and critical > 0 \n";print_usage(); exit $ERRORS{"UNKNOWN"}}; - # check if warn or crit in % and MB is tested -@@ -278,9 +290,6 @@ - print "warning or critical cannot be in % when MB are tested\n"; - print_usage(); exit $ERRORS{"UNKNOWN"}; - } -- # Get rid of % sign -- $o_warn =~ s/\%//; -- $o_crit =~ s/\%//; - # Check warning and critical values - if ( ( $o_type eq 'pu' ) || ( $o_type eq 'bu' )) { - if ($o_warn >= $o_crit) { print " warn < crit if type=",$o_type,"\n";print_usage(); exit $ERRORS{"UNKNOWN"}}; -@@ -306,6 +315,10 @@ - if (defined ($o_octetlength) && (isnnum($o_octetlength) || $o_octetlength > 65535 || $o_octetlength < 484 )) { - print "octet lenght must be < 65535 and > 484\n";print_usage(); exit $ERRORS{"UNKNOWN"}; - } -+ #### reserved blocks checks (A. Greiner-Bär patch). -+ if (defined ($o_reserve) && (isnnum($o_reserve) || $o_reserve > 99 || $o_reserve < 0 )) { -+ print "reserved blocks must be < 100 and >= 0\n";print_usage(); exit $ERRORS{"UNKNOWN"}; -+ } - } - - ########## MAIN ####### -@@ -521,21 +534,35 @@ - my $crit_state=0; - my ($p_warn,$p_crit); - my $output=undef; -+my $output_metric_val = 1024**2; -+my $output_metric = "M"; -+# Set the metric -+if (defined($o_giga)) { -+ $output_metric_val *= 1024; -+ $output_metric='G'; -+} -+ - for ($i=0;$i<$num_int;$i++) { - verb("Descr : $descr[$i]"); - verb("Size : $$result{$size_table . $tindex[$i]}"); - verb("Used : $$result{$used_table . $tindex[$i]}"); - verb("Alloc : $$result{$alloc_units . $tindex[$i]}"); -- my $to = $$result{$size_table . $tindex[$i]} * $$result{$alloc_units . $tindex[$i]} / 1024**2; -+ if (!defined($$result{$size_table . $tindex[$i]}) || -+ !defined($$result{$used_table . $tindex[$i]}) || -+ !defined ($$result{$alloc_units . $tindex[$i]})) { -+ print "Data not fully defined for storage ",$descr[$i]," : UNKNOWN\n"; -+ exit $ERRORS{"UNKNOWN"}; -+ } -+ my $to = $$result{$size_table . $tindex[$i]} * ( ( 100 - $o_reserve ) / 100 ) * $$result{$alloc_units . $tindex[$i]} / $output_metric_val; - my $pu=undef; - if ( $$result{$used_table . $tindex[$i]} != 0 ) { -- $pu = $$result{$used_table . $tindex[$i]}*100 / $$result{$size_table . $tindex[$i]}; -+ $pu = $$result{$used_table . $tindex[$i]}* 100 / ( $$result{$size_table . $tindex[$i]} * ( 100 - $o_reserve ) / 100 ); - }else { - $pu=0; - } -- my $bu = $$result{$used_table . $tindex[$i]} * $$result{$alloc_units . $tindex[$i]} / 1024**2; -+ my $bu = $$result{$used_table . $tindex[$i]} * $$result{$alloc_units . $tindex[$i]} / $output_metric_val; - my $pl = 100 - $pu; -- my $bl = ($$result{$size_table . $tindex[$i]}- $$result{$used_table . $tindex[$i]}) * $$result{$alloc_units . $tindex[$i]} / 1024**2; -+ my $bl = ( ( $$result{$size_table . $tindex[$i]} * ( ( 100 - $o_reserve ) / 100 ) - ( $$result{$used_table . $tindex[$i]} ) ) * $$result{$alloc_units . $tindex[$i]} / $output_metric_val ); - # add a ' ' if some data exists in $perf_out - $perf_out .= " " if (defined ($perf_out)) ; - ##### Ouputs and checks -@@ -554,7 +581,7 @@ - || (($pu >= $o_warn) && ($locstate=$warn_state=1)); - if (defined($o_shortL[2])) {} - if (!defined($o_shortL[0]) || ($locstate==1)) { # print full output if warn or critical state -- $output.=sprintf ("%s: %.0f%%used(%.0fMB/%.0fMB) ",$descr[$i],$pu,$bu,$to); -+ $output.=sprintf ("%s: %.0f%%used(%.0f%sB/%.0f%sB) ",$descr[$i],$pu,$bu,$output_metric,$to,$output_metric); - } elsif ($o_shortL[0] == 1) { - $output.=sprintf ("%s: %.0f%% ",$descr[$i],$pu); - } -@@ -566,9 +593,9 @@ - ( ($bu >= $o_crit) && ($locstate=$crit_state=1) ) - || ( ($bu >= $o_warn) && ($locstate=$warn_state=1) ); - if (!defined($o_shortL[0]) || ($locstate==1)) { # print full output if warn or critical state -- $output.=sprintf("%s: %.0fMBused/%.0fMB (%.0f%%) ",$descr[$i],$bu,$to,$pu); -+ $output.=sprintf("%s: %.0f%sBused/%.0f%sB (%.0f%%) ",$descr[$i],$bu,$output_metric,$to,$output_metric,$pu); - } elsif ($o_shortL[0] == 1) { -- $output.=sprintf("%s: %.0fMB ",$descr[$i],$bu); -+ $output.=sprintf("%s: %.0f%sB ",$descr[$i],$bu,$output_metric); - } - } - -@@ -578,9 +605,9 @@ - ( ($bl <= $o_crit) && ($locstate=$crit_state=1) ) - || ( ($bl <= $o_warn) && ($locstate=$warn_state=1) ); - if (!defined($o_shortL[0]) || ($locstate==1)) { # print full output if warn or critical state -- $output.=sprintf ("%s: %.0fMBleft/%.0fMB (%.0f%%) ",$descr[$i],$bl,$to,$pl); -+ $output.=sprintf ("%s: %.0f%sBleft/%.0f%sB (%.0f%%) ",$descr[$i],$bl,$output_metric,$to,$output_metric,$pl); - } elsif ($o_shortL[0] == 1) { -- $output.=sprintf ("%s: %.0fMB ",$descr[$i],$bl); -+ $output.=sprintf ("%s: %.0f%sB ",$descr[$i],$bl,$output_metric); - } - } - -@@ -590,13 +617,13 @@ - ( ($pl <= $o_crit) && ($locstate=$crit_state=1) ) - || ( ($pl <= $o_warn) && ($locstate=$warn_state=1) ); - if (!defined($o_shortL[0]) || ($locstate==1)) { # print full output if warn or critical state -- $output.=sprintf ("%s: %.0f%%left(%.0fMB/%.0fMB) ",$descr[$i],$pl,$bl,$to); -+ $output.=sprintf ("%s: %.0f%%left(%.0f%sB/%.0f%sB) ",$descr[$i],$pl,$bl,$output_metric,$to,$output_metric); - } elsif ($o_shortL[0] == 1) { - $output.=sprintf ("%s: %.0f%% ",$descr[$i],$pl); - } - } - # Performance output (in MB) -- $perf_out .= "'".$Pdescr. "'=" . round($bu,0) . "MB;" . round($p_warn,0) -+ $perf_out .= "'".$Pdescr. "'=" . round($bu,0) . $output_metric ."B;" . round($p_warn,0) - . ";" . round($p_crit,0) . ";0;" . round($to,0); - } - -@@ -606,8 +633,8 @@ - my $comp_unit=undef; - ($o_type eq "pu") && ($comp_oper ="<") && ($comp_unit ="%"); - ($o_type eq "pl") && ($comp_oper =">") && ($comp_unit ="%"); --($o_type eq "bu") && ($comp_oper ="<") && ($comp_unit ="MB"); --($o_type eq 'bl') && ($comp_oper =">") && ($comp_unit ="MB"); -+($o_type eq "bu") && ($comp_oper ="<") && ($comp_unit = $output_metric."B"); -+($o_type eq 'bl') && ($comp_oper =">") && ($comp_unit =$output_metric."B"); - - if (!defined ($output)) { $output="All selected storages "; } - diff --git a/debian/patches/06_check_snmp_win b/debian/patches/06_check_snmp_win deleted file mode 100644 index 01a721a..0000000 --- a/debian/patches/06_check_snmp_win +++ /dev/null @@ -1,67 +0,0 @@ -## 06_check_snmp_win by Jan Wagner -## -## DP: Update script to version 1.1 - -diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_win.pl nagios-snmp-plugins-1.1.1/check_snmp_win.pl ---- nagios-snmp-plugins-1.1.1.orig/check_snmp_win.pl 2006-11-29 20:59:55.000000000 +0100 -+++ nagios-snmp-plugins-1.1.1/check_snmp_win.pl 2007-10-12 22:23:25.000000000 +0200 -@@ -1,10 +1,11 @@ - #!/usr/bin/perl -w - ############################## check_snmp_win ############## --# Version : 0.6 --# Date : Nov 29 2006 -+my $Version='1.1'; -+# Date : Oct 12 2007 - # Author : Patrick Proy (patrick at proy.org) --# Help : http://www.manubulon.com/nagios/ -+# Help : http://nagios.manubulon.com/ - # Licence : GPL - http://www.fsf.org/licenses/gpl.txt -+# Contrib : Tenaku - # TODO : - ############################################################### - # -@@ -16,10 +17,10 @@ - - # Nagios specific - --use lib "/usr/local/nagios/libexec"; --use utils qw(%ERRORS $TIMEOUT); --#my $TIMEOUT = 5; --#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); -+#use lib "/usr/local/nagios/libexec"; -+#use utils qw(%ERRORS $TIMEOUT); -+my $TIMEOUT = 15; -+my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - - # SNMP Datas for processes (MIB II) - my $process_table= '1.3.6.1.2.1.25.4.2.1'; -@@ -44,7 +45,6 @@ - - # Globals - --my $Version='0.6'; - my $Name='check_snmp_win'; - - my $o_host = undef; # hostname -@@ -93,7 +93,7 @@ - - sub help { - print "\nSNMP Windows Monitor for Nagios version ",$Version,"\n"; -- print "GPL licence, (c)2004-2005 Patrick Proy\n\n"; -+ print "GPL licence, (c)2004-2007 Patrick Proy\n\n"; - print_usage(); - print < Date: Sun, 2 Mar 2014 22:37:59 +0100 Subject: [PATCH 064/205] Add missing latest CVS patches --- debian/patches/01_update_pre_1.1.2 | 622 +++++++++++++++++++++++++++-- 1 file changed, 580 insertions(+), 42 deletions(-) diff --git a/debian/patches/01_update_pre_1.1.2 b/debian/patches/01_update_pre_1.1.2 index 15fde6c..97bf1d9 100644 --- a/debian/patches/01_update_pre_1.1.2 +++ b/debian/patches/01_update_pre_1.1.2 @@ -1,9 +1,249 @@ -## 01_check_snmp_env by Jan Wagner -## -## DP: Fix some issues via cvs version - ---- old/check_snmp_env.pl 2007-07-04 09:46:55.000000000 +0200 -+++ new/check_snmp_env.pl 2007-07-06 22:17:06.000000000 +0200 +diff -Nur nagios_plugins/Changelog plugins/Changelog +--- nagios_plugins/Changelog 2007-04-23 15:15:40.000000000 +0200 ++++ plugins/Changelog 2007-10-20 13:26:06.000000000 +0200 +@@ -1,4 +1,38 @@ + ################################ ++Release 1.1.2 / Jun 2007 : ++ ++Scripts, actual CVS version and changelog : ++check_snmp_mem.pl : 1.3 ++check_snmp_vrrp.pl : 1.3 ++check_snmp_linkproof_nhr.pl : 1.1 ++check_snmp_process.pl : 1.7 ++ - Added option to select process with his parameter ++ - Added option for performance output ++ - Corrected negative CPU when process restarts ++ - Added delta option for cpu average (-d option) ++check_snmp_boostedge.pl : 1.2 ++check_snmp_nsbox.pl : 1.2 ++check_snmp_css_main.pl : 1.1 ++check_snmp_cpfw.pl : 1.7 ++check_snmp_int.pl : 1.22 ++ - Correct speed query for interface > 4 Gbps ++ - Reduced snmp queries to 2 instead of 3 when perf data is on ++ - Bad maximum in perfdata when in Bps ++ - Added option to make dormant state OK ++check_snmp_storage.pl : 1.10 ++ - Return an UNKNOWN status when size/used/alloc is not defined in snmp ++ - Patch from Alexander Greiner-B?r to remove the reserved disk space for superuser on ext2/3 FS. ++ New -R option for this ++ - Added -G (giga) option for output & levels in Gigabytes ++check_snmp_win.pl : 0.6 ++check_snmp_css.pl : 1.3 ++check_snmp_env.pl : 1.8 ++ - Added test to check existence of some OIDs ++check_snmp_load.pl : 1.11 ++ - Corrected bug in performance output ++ - Added SIG{ALRM} sub and % sign in output ++ ++################################ + Release 1.1.1 / April 2007 : + + Added documentation in doc/ directory : (html format). +diff -Nur nagios_plugins/INSTALL plugins/INSTALL +--- nagios_plugins/INSTALL 1970-01-01 01:00:00.000000000 +0100 ++++ plugins/INSTALL 2007-10-20 13:26:06.000000000 +0200 +@@ -0,0 +1,15 @@ ++Installation: ++------------- ++ ++You can simply copy the .pl files to the Nagios Plugin directory if ++- Nagios plugins and utils.pm file are in /usr/local/nagios/libexec. ++- You are sure Net::SNMP is installed. (Getopt::Long is standard). ++- perl is in /usr/bin/perl ++- Temp files can be written by Nagios in /tmp ++ ++You can also use the "install.sh" script provided in this directory to install the plugins. ++Type : "./install.sh" to install all the plugins or "./install.sh " for a specific one. ++ ++The script will check for dependencies and ask for Nagios and temp directories. ++It will modify the scripts depending on these answers and install the scripts. ++ +diff -Nur nagios_plugins/README plugins/README +--- nagios_plugins/README 2007-04-20 17:04:08.000000000 +0200 ++++ plugins/README 2007-10-20 13:26:06.000000000 +0200 +@@ -1,4 +1,4 @@ +-Nagios SNMP plugins 1.1.1 README ++Nagios SNMP plugins 1.1.2 README + ------------------------------ + + +@@ -32,7 +32,7 @@ + Legal stuff: + ------------ + +- Nagios SNMP plugins version 1.1.1, Copyright (C) 2004-2007 Patrick Proy (nagios at proy.org) ++ Nagios SNMP plugins version 1.1.2, Copyright (C) 2004-2007 Patrick Proy (nagios at proy.org) + + 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 +diff -Nur nagios_plugins/check_snmp_cpfw.pl plugins/check_snmp_cpfw.pl +--- nagios_plugins/check_snmp_cpfw.pl 2007-04-20 00:03:30.000000000 +0200 ++++ plugins/check_snmp_cpfw.pl 2007-10-20 13:26:06.000000000 +0200 +@@ -1,10 +1,11 @@ + #!/usr/bin/perl -w + ############################## check_snmp_cpfw ############## +-# Version : 1.2.1 +-# Date : April 19 2007 ++my $Version='1.8'; ++# Date : Oct 20 2007 + # Author : Patrick Proy (patrick at proy.org) + # Help : http://nagios.manubulon.com + # Licence : GPL - http://www.fsf.org/licenses/gpl.txt ++# Contrib : StaGue + # TODO : + # - check sync method + ################################################################# +@@ -18,10 +19,8 @@ + + # Nagios specific + +-use lib "/usr/local/nagios/libexec"; +-use utils qw(%ERRORS $TIMEOUT); +-#my $TIMEOUT = 15; +-#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); ++my $TIMEOUT = 15; ++my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); + + ########### SNMP Datas ########### + +@@ -73,8 +72,6 @@ + + #################################### Globals ##############################"" + +-my $Version='1.2.1'; +- + my $o_host = undef; # hostname + my $o_community = undef; # community + my $o_version2 =undef; # Version 2 +@@ -247,7 +244,7 @@ + } + + $SIG{'ALRM'} = sub { +- print "No answer from host\n"; ++ print "No answer from host $o_host:$o_port\n"; + exit $ERRORS{"UNKNOWN"}; + }; + +@@ -332,15 +329,15 @@ + } + } + } else { +- $svn_print .= "cannot find oids"; ++ $svn_print .= "cannot find OIDs"; + #Critical state if not found because it means soft is not activated + $svn_state=2; + } + + if ($svn_state == 0) { +- $svn_print="SVN : OK"; ++ $svn_print="SVN: OK"; + } else { +- $svn_print="SVN : " . $svn_print; ++ $svn_print="SVN: " . $svn_print; + } + verb("$svn_print"); + } +@@ -363,14 +360,14 @@ + } + } + } else { +- $mgmt_print .= "cannot find oids"; ++ $mgmt_print .= "cannot find OIDs"; + #Critical state if not found because it means soft is not activated + $mgmt_state=2; + } + if ($mgmt_state == 0) { +- $mgmt_print="MGMT : OK"; ++ $mgmt_print="MGMT: OK"; + } else { +- $mgmt_print="MGMT : " . $mgmt_print; ++ $mgmt_print="MGMT: " . $mgmt_print; + } + verb("$svn_print"); + } +@@ -402,7 +399,7 @@ + if (defined($o_policy)) { + if ($$resultat{$policy_name} ne $o_policy) { + $fw_state=2; +- $fw_print .= "Policy installed : $$resultat{$policy_name}"; ++ $fw_print .= "Policy installed: $$resultat{$policy_name}"; + } + } + +@@ -419,15 +416,15 @@ + $perf_conn=$$resultat{$connections}; + } + } else { +- $fw_print .= "cannot find oids"; ++ $fw_print .= "cannot find OIDs"; + #Critical state if not found because it means soft is not activated + $fw_state=2; + } + + if ($fw_state==0) { +- $fw_print="FW : OK"; ++ $fw_print="FW: OK"; + } else { +- $fw_print="FW : " . $fw_print; ++ $fw_print="FW: " . $fw_print; + } + + } +@@ -460,7 +457,7 @@ + } + #my $ha_mode = "1.3.6.1.4.1.2620.1.5.11.0"; # "Sync only" : ha Working mode + } else { +- $ha_print .= "cannot find oids"; ++ $ha_print .= "cannot find OIDs"; + #Critical state if not found because it means soft is not activated + $ha_state_n=2; + } +@@ -484,7 +481,7 @@ + } + } + } else { +- $ha_print .= "cannot find oids" if ($ha_state_n ==0); ++ $ha_print .= "cannot find OIDs" if ($ha_state_n ==0); + #Critical state if not found because it means soft is not activated + $ha_state_n=2; + } +@@ -513,9 +510,9 @@ + } + + if ($ha_state_n == 0) { +- $ha_print = "HA : OK"; ++ $ha_print = "HA: OK"; + } else { +- $ha_print = "HA : " . $ha_print; ++ $ha_print = "HA: " . $ha_print; + } + + } +@@ -532,9 +529,9 @@ + if (defined ($o_mgmt)) { $f_print = (defined ($f_print)) ? $f_print . " / ". $mgmt_print : $mgmt_print } + + my $exit_status=undef; +-$f_print .= " / CPFW Status : "; ++$f_print .= " / CPFW Status: "; + if (($ha_state_n+$svn_state+$fw_state+$mgmt_state) == 0 ) { +- $f_print .= "OK"; ++ $f_print .= "OK, " . $perf_conn . " conn."; + $exit_status= $ERRORS{"OK"}; + } else { + if (($fw_state==1) || ($ha_state_n==1) || ($svn_state==1) || ($mgmt_state==1)) { +@@ -547,7 +544,7 @@ + } + + if (defined($o_perf) && defined ($perf_conn)) { +- $f_print .= " | fw_connexions=" . $perf_conn; ++ $f_print .= " | fw_connexions=" . $perf_conn . ";" . $o_warn . ";" . $o_crit . ";0"; + } + + print "$f_print\n"; +diff -Nur nagios_plugins/check_snmp_env.pl plugins/check_snmp_env.pl +--- nagios_plugins/check_snmp_env.pl 2007-04-20 11:45:22.000000000 +0200 ++++ plugins/check_snmp_env.pl 2007-10-20 13:26:06.000000000 +0200 @@ -1,7 +1,7 @@ #!/usr/bin/perl -w ############################## check_snmp_env ################# @@ -128,14 +368,9 @@ + +print "Unknown check type : UNKNOWN\n"; +exit $ERRORS{"UNKNOWN"}; -## 02_check_snmp_int by Jan Wagner -## -## DP: Update script to version 1.24 - - -diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_int.pl nagios-snmp-plugins-1.1.1/check_snmp_int.pl ---- nagios-snmp-plugins-1.1.1.orig/check_snmp_int.pl 2007-04-23 11:40:39.000000000 +0200 -+++ nagios-snmp-plugins-1.1.1/check_snmp_int.pl 2007-10-12 22:23:22.000000000 +0200 +diff -Nur nagios_plugins/check_snmp_int.pl plugins/check_snmp_int.pl +--- nagios_plugins/check_snmp_int.pl 2007-04-23 11:40:39.000000000 +0200 ++++ plugins/check_snmp_int.pl 2007-10-20 13:26:06.000000000 +0200 @@ -1,13 +1,12 @@ #!/usr/bin/perl -w ############################## check_snmp_int ############## @@ -500,13 +735,9 @@ diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_int.pl nagios-snmp-plugins-1 } } } -## 03_check_snmp_load by Jan Wagner -## -## DP: Update script to version 1.12 - -diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_load.pl nagios-snmp-plugins-1.1.1/check_snmp_load.pl ---- nagios-snmp-plugins-1.1.1.orig/check_snmp_load.pl 2007-04-16 19:41:20.000000000 +0200 -+++ nagios-snmp-plugins-1.1.1/check_snmp_load.pl 2007-10-12 22:23:23.000000000 +0200 +diff -Nur nagios_plugins/check_snmp_load.pl plugins/check_snmp_load.pl +--- nagios_plugins/check_snmp_load.pl 2007-04-16 19:41:20.000000000 +0200 ++++ plugins/check_snmp_load.pl 2007-10-20 13:26:06.000000000 +0200 @@ -1,11 +1,10 @@ #!/usr/bin/perl -w ############################## check_snmp_load ################# @@ -543,13 +774,160 @@ diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_load.pl nagios-snmp-plugins- my $o_host = undef; # hostname my $o_community = undef; # community -## 04_check_snmp_process by Jan Wagner -## -## DP: Update script to version 1.10 - -diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_process.pl nagios-snmp-plugins-1.1.1/check_snmp_process.pl ---- nagios-snmp-plugins-1.1.1.orig/check_snmp_process.pl 2007-03-12 21:36:02.000000000 +0100 -+++ nagios-snmp-plugins-1.1.1/check_snmp_process.pl 2007-10-12 22:23:24.000000000 +0200 +diff -Nur nagios_plugins/check_snmp_mem.pl plugins/check_snmp_mem.pl +--- nagios_plugins/check_snmp_mem.pl 2006-07-09 22:52:37.000000000 +0200 ++++ plugins/check_snmp_mem.pl 2007-10-20 13:26:06.000000000 +0200 +@@ -1,11 +1,11 @@ + #!/usr/bin/perl -w + ############################## check_snmp_mem ############## +-# Version : 1.1 +-# Date : Jul 09 2006 ++my $Version='1.5'; ++# Date : 17 October 2007 + # Author : Patrick Proy (nagios at proy.org) +-# Help : http://www.manubulon.com/nagios/ ++# Help : http://nagios.manubulon.com/ + # Licence : GPL - http://www.fsf.org/licenses/gpl.txt +-# Contrib : Jan Jungmann ++# Contrib : Jan Jungmann, Patrick Griffin + # TODO : + ################################################################# + # +@@ -18,10 +18,8 @@ + + # Nagios specific + +-use lib "/usr/local/nagios/libexec"; +-use utils qw(%ERRORS $TIMEOUT); +-#my $TIMEOUT = 15; +-#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); ++my $TIMEOUT = 15; ++my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); + + # SNMP Datas + +@@ -29,10 +27,11 @@ + + my $nets_ram_free = "1.3.6.1.4.1.2021.4.6.0"; # Real memory free + my $nets_ram_total = "1.3.6.1.4.1.2021.4.5.0"; # Real memory total +-my $nets_ram_cache = "1.3.6.1.4.1.2021.4.15.0"; # Real memory cached ++my $nets_ram_buffer = "1.3.6.1.4.1.2021.4.14.0"; # Real memory buffered ++my $nets_ram_cache = "1.3.6.1.4.1.2021.4.15.0"; # Real memory cached + my $nets_swap_free = "1.3.6.1.4.1.2021.4.4.0"; # swap memory free + my $nets_swap_total = "1.3.6.1.4.1.2021.4.3.0"; # Swap memory total +-my @nets_oids = ($nets_ram_free,$nets_ram_total,$nets_swap_free,$nets_swap_total,$nets_ram_cache); ++my @nets_oids = ($nets_ram_free,$nets_ram_total,$nets_swap_free,$nets_swap_total,$nets_ram_cache,$nets_ram_buffer); + + # Cisco + +@@ -60,7 +59,6 @@ + + # Globals + +-my $Version='1.1'; + + my $o_host = undef; # hostname + my $o_community = undef; # community +@@ -79,6 +77,7 @@ + my $o_critS= undef; # critical level for swap + my $o_perf= undef; # Performance data option + my $o_cache= undef; # Include cached memory as used memory ++my $o_buffer= undef; # Exclude buffered memory as used memory + my $o_timeout= undef; # Timeout (Default 5) + my $o_version2= undef; # use snmp v2c + # SNMPv3 specific +@@ -94,7 +93,7 @@ + sub p_version { print "check_snmp_mem version : $Version\n"; } + + sub print_usage { +- print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -w -c [-I|-N|-E] [-f] [-m] [-t ] [-V]\n"; ++ print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -w -c [-I|-N|-E] [-f] [-m -b] [-t ] [-V]\n"; + } + + sub isnnum { # Return true if arg is not a number +@@ -109,11 +108,11 @@ + + sub help { + print "\nSNMP Memory Monitor for Nagios version ",$Version,"\n"; +- print "(c)2004-2006 to my cat Ratoune - Author: Patrick Proy\n\n"; ++ print "GPL licence, (c)2004-2007 Patrick Proy\n\n"; + print_usage(); + print < \$o_crit, 'critical:s' => \$o_crit, + 'w:s' => \$o_warn, 'warn:s' => \$o_warn, + 'm' => \$o_cache, 'memcache' => \$o_cache, ++ 'b' => \$o_buffer, 'membuffer' => \$o_buffer, + 'f' => \$o_perf, 'perfdata' => \$o_perf + ); + if (defined ($o_help) ) { help(); exit $ERRORS{"UNKNOWN"}}; +@@ -267,6 +269,7 @@ + -username => $o_login, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, ++ -port => $o_port, + -timeout => $o_timeout + ); + } else { +@@ -279,6 +282,7 @@ + -authprotocol => $o_authproto, + -privpassword => $o_privpass, + -privprotocol => $o_privproto, ++ -port => $o_port, + -timeout => $o_timeout + ); + } +@@ -473,22 +477,23 @@ + } + + my ($realused,$swapused)=(undef,undef); ++ my $totalcachedbuffered = 0; ++ if (defined($o_buffer)) { ++ $totalcachedbuffered = $$resultat{$nets_ram_buffer}; ++ } ++ if (!defined($o_cache)) { ++ $totalcachedbuffered = $totalcachedbuffered + $$resultat{$nets_ram_cache}; ++ } ++ ++ $realused = ($$resultat{$nets_ram_total}-($$resultat{$nets_ram_free}+$totalcachedbuffered)) / $$resultat{$nets_ram_total}; + +- $realused= defined($o_cache) ? +- ($$resultat{$nets_ram_total}-$$resultat{$nets_ram_free})/$$resultat{$nets_ram_total} +- : +- ($$resultat{$nets_ram_total}-($$resultat{$nets_ram_free}+$$resultat{$nets_ram_cache}))/$$resultat{$nets_ram_total}; +- + if($$resultat{$nets_ram_total} == 0) { $realused = 0; } + + $swapused= ($$resultat{$nets_swap_total} == 0) ? 0 : + ($$resultat{$nets_swap_total}-$$resultat{$nets_swap_free})/$$resultat{$nets_swap_total}; + $realused=round($realused*100,0); + $swapused=round($swapused*100,0); +- defined($o_cache) ? +- verb ("Ram : $$resultat{$nets_ram_free} / $$resultat{$nets_ram_total} : $realused") +- : +- verb ("Ram : $$resultat{$nets_ram_free} ($$resultat{$nets_ram_cache} cached) / $$resultat{$nets_ram_total} : $realused"); ++ verb ("Ram : $$resultat{$nets_ram_free} ($$resultat{$nets_ram_cache} cached, $$resultat{$nets_ram_buffer} buff) / $$resultat{$nets_ram_total} : $realused"); + verb ("Swap : $$resultat{$nets_swap_free} / $$resultat{$nets_swap_total} : $swapused"); + + my $n_status="OK"; +diff -Nur nagios_plugins/check_snmp_process.pl plugins/check_snmp_process.pl +--- nagios_plugins/check_snmp_process.pl 2007-03-12 21:36:02.000000000 +0100 ++++ plugins/check_snmp_process.pl 2007-10-20 13:26:06.000000000 +0200 @@ -1,45 +1,43 @@ #!/usr/bin/perl -w ############################## check_snmp_process ############## @@ -750,13 +1128,9 @@ diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_process.pl nagios-snmp-plugi if ($final_status==2) { exit $ERRORS{"CRITICAL"};} if ($final_status==1) { exit $ERRORS{"WARNING"};} -## 05_check_snmp_storage by Jan Wagner -## -## DP: Update script to version 1.3.3 - -diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_storage.pl nagios-snmp-plugins-1.1.1/check_snmp_storage.pl ---- nagios-snmp-plugins-1.1.1.orig/check_snmp_storage.pl 2007-03-12 22:01:36.000000000 +0100 -+++ nagios-snmp-plugins-1.1.1/check_snmp_storage.pl 2007-10-12 22:23:24.000000000 +0200 +diff -Nur nagios_plugins/check_snmp_storage.pl plugins/check_snmp_storage.pl +--- nagios_plugins/check_snmp_storage.pl 2007-03-12 22:01:36.000000000 +0100 ++++ plugins/check_snmp_storage.pl 2007-10-20 13:26:06.000000000 +0200 @@ -1,12 +1,12 @@ #!/usr/bin/perl -w ############################## check_snmp_storage ############## @@ -972,13 +1346,177 @@ diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_storage.pl nagios-snmp-plugi if (!defined ($output)) { $output="All selected storages "; } -## 06_check_snmp_win by Jan Wagner -## -## DP: Update script to version 1.1 - -diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_win.pl nagios-snmp-plugins-1.1.1/check_snmp_win.pl ---- nagios-snmp-plugins-1.1.1.orig/check_snmp_win.pl 2006-11-29 20:59:55.000000000 +0100 -+++ nagios-snmp-plugins-1.1.1/check_snmp_win.pl 2007-10-12 22:23:25.000000000 +0200 +diff -Nur nagios_plugins/check_snmp_vrrp.pl plugins/check_snmp_vrrp.pl +--- nagios_plugins/check_snmp_vrrp.pl 2006-08-23 23:39:48.000000000 +0200 ++++ plugins/check_snmp_vrrp.pl 2007-10-20 13:26:06.000000000 +0200 +@@ -1,11 +1,11 @@ + #!/usr/bin/perl -w + ############################## check_snmp_vrrp ############## +-# Version : 1.3 +-# Date : Aug 23 2006 ++my $Version='1.4'; ++# Date : Oct 17 2007 + # Author : Patrick Proy (patrick at proy.org) +-# Help : http://www.manubulon.com/nagios/ ++# Help : http://nagios.manubulon.com/ + # Licence : GPL - http://www.fsf.org/licenses/gpl.txt +-# Contrib : C. Maser (Alteon + Netscreen) ++# Contrib : C. Maser (Alteon + Netscreen), Harm-Jan Blok (Foundry) + ################################################################# + # + # Help : ./check_snmp_vrrp.pl -h +@@ -17,10 +17,8 @@ + + # Nagios specific + +-use lib "/usr/local/nagios/libexec"; +-use utils qw(%ERRORS $TIMEOUT); +-#my $TIMEOUT = 15; +-#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); ++my $TIMEOUT = 15; ++my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); + + # SNMP Datas + +@@ -59,32 +57,43 @@ + my $ns_vrrp_admin = ""; + my $ns_vrrp_prio = "1.3.6.1.4.1.3224.6.2.2.1.4"; + ++######## Foundry ++my $foundry_base_vrrp = "1.3.6.1.4.1.1991.1.2.12.3.1.1"; # oid for vrrp ++my $foundry_vrrp_oper = "1.3.6.1.4.1.1991.1.2.12.3.1.1.10"; # vrrp operational status ++my $foundry_vrrp_admin ="1.3.6.1.4.1.1991.1.2.12.3.1.1.3"; # vrrp admin status ++my $foundry_vrrp_prio = "1.3.6.1.4.1.1991.1.2.12.3.1.1.6"; # vrrp vrid priority ++ ++ + ######### Make an array + my %base_vrrp = ("nokia",$nokia_base_vrrp, + "lp",$lp_base_vrrp, + "alteon",$alteon_base_vrrp, +- "nsc",$ns_base_vrrp ++ "nsc",$ns_base_vrrp, ++ "foundry",$foundry_base_vrrp + ); + my %vrrp_oper = ("nokia",$nokia_vrrp_oper, + "lp",$lp_vrrp_oper, + "alteon",$alteon_vrrp_oper, +- "nsc",$ns_vrrp_oper ++ "nsc",$ns_vrrp_oper, ++ "foundry",$foundry_vrrp_oper + ); + my %vrrp_admin =("nokia",$nokia_vrrp_admin, + "lp",$lp_vrrp_admin, + "alteon",$alteon_vrrp_admin, +- "nsc",$ns_vrrp_admin ++ "nsc",$ns_vrrp_admin, ++ "foundry",$foundry_vrrp_admin + ); + my %vrrp_prio = ("nokia",$nokia_vrrp_prio, + "lp",$lp_vrrp_prio, + "alteon",$alteon_vrrp_prio, +- "nsc",$ns_vrrp_prio); +-my %state_master=("nokia",3,"alteon",2,"lp",3,"nsc",2); +-my %state_backup=("nokia",2,"alteon",3,"lp",2,"nsc",3); ++ "nsc",$ns_vrrp_prio, ++ "foundry",$foundry_vrrp_oper ++ ); + +-# Globals ++my %state_master=("nokia",3,"alteon",2,"lp",3,"nsc",2,"foundry",1); ++my %state_backup=("nokia",2,"alteon",3,"lp",2,"nsc",3,"foundry",2); + +-my $Version='1.3'; ++# Globals + + my $o_host = undef; # hostname + my $o_community = undef; # community +@@ -96,7 +105,7 @@ + my $o_state= undef; # Check master or backup state for ok + my $o_clustnum= undef; # number of cluster members + my $o_clustprct= undef; # Max % assigned to one cluster. +-my $o_type= 'nokia'; # Check type : nokia|alteon|lp|nsc ++my $o_type= 'nokia'; # Check type : nokia|alteon|lp|nsc|foundry + my $o_long= undef; # Make output long + my $o_timeout= 5; # Default 5s Timeout + +@@ -113,7 +122,7 @@ + sub p_version { print "check_snmp_vrrp version : $Version\n"; } + + sub print_usage { +- print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) -s [-T ] [-p ] [-t ] [-V]\n"; ++ print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) -s [-T ] [-p ] [-t ] [-V]\n"; + } + + sub isnnum { # Return true if arg is not a number +@@ -124,11 +133,11 @@ + + sub help { + print "\nSNMP VRRP Monitor for Nagios version ",$Version,"\n"; +- print "(c)2004-2006 to my cat Ratoune - Author : Patrick Proy\n\n"; ++ print "GPL licence, (c)2004-2007 Patrick Proy\n\n"; + print_usage(); + print < + Type of vrrp router to check +- nokia (default) : Nokai vrrp. Should be working for most vrrp routers ++ nokia (default) : Nokia vrrp. Should be working for most vrrp routers + alteon : for Alteon AD4 Loadbalancers + lp : Radware Linkproof + nsc : Nescreen (ScreenOS 5.x NSRP) + ipso : Nokia IPSO clustering ++ foundry : Foundry VRRP + -s, --state=master|backup|num,% + Nokia ipso clustering : number of members, max % assigned to nodes. + Other : check vrrp interface to be master or backup +@@ -226,7 +236,7 @@ + { print "state must be master or backup\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} + } + # Check type +- if ( !defined($o_type) || (($o_type ne "nokia") && ($o_type ne "alteon") && ($o_type ne "lp") && ($o_type ne"nsc") && ($o_type ne"ipso")) ) ++ if ( !defined($o_type) || (($o_type ne "nokia") && ($o_type ne "alteon") && ($o_type ne "lp") && ($o_type ne"nsc") && ($o_type ne"ipso") && ($o_type ne "foundry")) ) + { print "type must be alteon,nokia,lp,nsc or ipso\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} + + } +@@ -257,6 +267,7 @@ + -username => $o_login, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, ++ -port => $o_port, + -timeout => $o_timeout + ); + } else { +@@ -269,6 +280,7 @@ + -authprotocol => $o_authproto, + -privpassword => $o_privpass, + -privprotocol => $o_privproto, ++ -port => $o_port, + -timeout => $o_timeout + ); + } +@@ -429,7 +441,11 @@ + $key= $vrrp_admin{$o_type} . "." . $vrid[$i]; + $value = ($$resultat{$key} == 1) ? "up" : "down"; + $output.= $value . "/"; +- ($value eq "up" ) && $ok++; ++ if (($o_type eq 'foundry') && ($o_state eq 'backup') && ($value eq "down")) { ++ $ok++ ++ } else { ++ ($value eq "up") && $ok++; ++ } + } + # Get the priority + $key=$vrrp_prio{$o_type}.".".$vrid[$i]; +diff -Nur nagios_plugins/check_snmp_win.pl plugins/check_snmp_win.pl +--- nagios_plugins/check_snmp_win.pl 2006-11-29 20:59:55.000000000 +0100 ++++ plugins/check_snmp_win.pl 2007-10-20 13:26:06.000000000 +0200 @@ -1,10 +1,11 @@ #!/usr/bin/perl -w ############################## check_snmp_win ############## From 76a78cbac072c85d980abf8e558ad15064c16bb3 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 2 Mar 2014 22:44:50 +0100 Subject: [PATCH 065/205] Refresh patchtes --- debian/patches/10_fix_net_snmp_version | 70 +++++++++------------- debian/patches/50_disable_epn | 82 +++++++++++--------------- 2 files changed, 63 insertions(+), 89 deletions(-) mode change 100755 => 100644 debian/patches/10_fix_net_snmp_version diff --git a/debian/patches/10_fix_net_snmp_version b/debian/patches/10_fix_net_snmp_version old mode 100755 new mode 100644 index c8cb20c..757d055 --- a/debian/patches/10_fix_net_snmp_version +++ b/debian/patches/10_fix_net_snmp_version @@ -3,9 +3,8 @@ ## DP: Fixing Net::SNMP version ## DP: (see https://wiki.icinga.org/display/howtos/check_snmp#checksnmp-Argumentv601isntnumericinnumericlt) -diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-snmp-plugins-1.1.1~/check_snmp_boostedge.pl nagios-snmp-plugins-1.1.1/check_snmp_boostedge.pl ---- nagios-snmp-plugins-1.1.1~/check_snmp_boostedge.pl 2007-01-16 23:57:14.000000000 +0100 -+++ nagios-snmp-plugins-1.1.1/check_snmp_boostedge.pl 2013-01-31 08:38:55.000000000 +0100 +--- a/check_snmp_boostedge.pl ++++ b/check_snmp_boostedge.pl @@ -249,7 +249,7 @@ # Get global status @@ -24,9 +23,8 @@ diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' $session->get_table($be_service_table) : $session->get_table(Baseoid => $be_service_table); -diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-snmp-plugins-1.1.1~/check_snmp_css.pl nagios-snmp-plugins-1.1.1/check_snmp_css.pl ---- nagios-snmp-plugins-1.1.1~/check_snmp_css.pl 2007-01-11 17:06:08.000000000 +0100 -+++ nagios-snmp-plugins-1.1.1/check_snmp_css.pl 2013-01-31 08:38:55.000000000 +0100 +--- a/check_snmp_css.pl ++++ b/check_snmp_css.pl @@ -356,7 +356,7 @@ } close (FILE); @@ -54,9 +52,8 @@ diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' $session->get_request(@oid_list2) : $session->get_request(-varbindlist => \@oid_list2); -diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-snmp-plugins-1.1.1~/check_snmp_css_main.pl nagios-snmp-plugins-1.1.1/check_snmp_css_main.pl ---- nagios-snmp-plugins-1.1.1~/check_snmp_css_main.pl 2006-10-05 23:40:55.000000000 +0200 -+++ nagios-snmp-plugins-1.1.1/check_snmp_css_main.pl 2013-01-31 08:38:55.000000000 +0100 +--- a/check_snmp_css_main.pl ++++ b/check_snmp_css_main.pl @@ -219,7 +219,7 @@ ########### Cisco CSS checks ############## @@ -66,9 +63,8 @@ diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' $session->get_table($css_svc_name) : $session->get_table(Baseoid => $css_svc_name); -diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-snmp-plugins-1.1.1~/check_snmp_env.pl nagios-snmp-plugins-1.1.1/check_snmp_env.pl ---- nagios-snmp-plugins-1.1.1~/check_snmp_env.pl 2013-01-31 08:37:55.000000000 +0100 -+++ nagios-snmp-plugins-1.1.1/check_snmp_env.pl 2013-01-31 08:38:55.000000000 +0100 +--- a/check_snmp_env.pl ++++ b/check_snmp_env.pl @@ -390,7 +390,7 @@ verb("Checking cisco env"); @@ -159,9 +155,8 @@ diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' $session->get_table($foundry_ps_table) : $session->get_table(Baseoid => $foundry_ps_table); -diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-snmp-plugins-1.1.1~/check_snmp_linkproof_nhr.pl nagios-snmp-plugins-1.1.1/check_snmp_linkproof_nhr.pl ---- nagios-snmp-plugins-1.1.1~/check_snmp_linkproof_nhr.pl 2006-08-26 14:37:12.000000000 +0200 -+++ nagios-snmp-plugins-1.1.1/check_snmp_linkproof_nhr.pl 2013-01-31 08:38:56.000000000 +0100 +--- a/check_snmp_linkproof_nhr.pl ++++ b/check_snmp_linkproof_nhr.pl @@ -232,7 +232,7 @@ my $global_status=0; @@ -180,9 +175,8 @@ diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' $result = $session->get_request(@oids); } else { if ($session->version == 0) { -diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-snmp-plugins-1.1.1~/check_snmp_load.pl nagios-snmp-plugins-1.1.1/check_snmp_load.pl ---- nagios-snmp-plugins-1.1.1~/check_snmp_load.pl 2013-01-31 08:37:55.000000000 +0100 -+++ nagios-snmp-plugins-1.1.1/check_snmp_load.pl 2013-01-31 08:38:56.000000000 +0100 +--- a/check_snmp_load.pl ++++ b/check_snmp_load.pl @@ -346,7 +346,7 @@ verb("Checking linux load"); @@ -246,10 +240,9 @@ diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' $session->get_table($base_proc) : $session->get_table(Baseoid => $base_proc); -diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-snmp-plugins-1.1.1~/check_snmp_mem.pl nagios-snmp-plugins-1.1.1/check_snmp_mem.pl ---- nagios-snmp-plugins-1.1.1~/check_snmp_mem.pl 2006-07-09 22:52:37.000000000 +0200 -+++ nagios-snmp-plugins-1.1.1/check_snmp_mem.pl 2013-01-31 08:38:56.000000000 +0100 -@@ -316,7 +316,7 @@ +--- a/check_snmp_mem.pl ++++ b/check_snmp_mem.pl +@@ -320,7 +320,7 @@ if (defined ($o_cisco)) { # Get Cisco memory table @@ -258,7 +251,7 @@ diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' $session->get_table($cisco_mem_pool) :$session->get_table(Baseoid => $cisco_mem_pool); -@@ -393,7 +393,7 @@ +@@ -397,7 +397,7 @@ if (defined ($o_hp)) { # Get hp memory table @@ -267,7 +260,7 @@ diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' $session->get_table($hp_mem_pool) :$session->get_table(Baseoid => $hp_mem_pool); -@@ -462,7 +462,7 @@ +@@ -466,7 +466,7 @@ if (defined ($o_netsnmp)) { # Get NetSNMP memory values @@ -276,9 +269,8 @@ diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' $session->get_request(@nets_oids) :$session->get_request(-varbindlist => \@nets_oids); -diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-snmp-plugins-1.1.1~/check_snmp_nsbox.pl nagios-snmp-plugins-1.1.1/check_snmp_nsbox.pl ---- nagios-snmp-plugins-1.1.1~/check_snmp_nsbox.pl 2007-01-16 23:55:21.000000000 +0100 -+++ nagios-snmp-plugins-1.1.1/check_snmp_nsbox.pl 2013-01-31 08:38:56.000000000 +0100 +--- a/check_snmp_nsbox.pl ++++ b/check_snmp_nsbox.pl @@ -265,7 +265,7 @@ ########### check global status ############## @@ -297,9 +289,8 @@ diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' $session->get_table($ns_service_table) : $session->get_table(Baseoid => $ns_service_table); -diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-snmp-plugins-1.1.1~/check_snmp_process.pl nagios-snmp-plugins-1.1.1/check_snmp_process.pl ---- nagios-snmp-plugins-1.1.1~/check_snmp_process.pl 2013-01-31 08:37:55.000000000 +0100 -+++ nagios-snmp-plugins-1.1.1/check_snmp_process.pl 2013-01-31 08:38:56.000000000 +0100 +--- a/check_snmp_process.pl ++++ b/check_snmp_process.pl @@ -407,11 +407,11 @@ my %result_cons=(); my ($getall_run,$getall_cpu,$getall_mem)=(undef,undef,undef); @@ -368,9 +359,8 @@ diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' $session->get_request(@oids) : $session->get_request(Varbindlist => \@oids); if (!defined($result)) { printf("ERROR: running table : %s.\n", $session->error); $session->close; -diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-snmp-plugins-1.1.1~/check_snmp_storage.pl nagios-snmp-plugins-1.1.1/check_snmp_storage.pl ---- nagios-snmp-plugins-1.1.1~/check_snmp_storage.pl 2013-01-31 08:37:55.000000000 +0100 -+++ nagios-snmp-plugins-1.1.1/check_snmp_storage.pl 2013-01-31 08:38:56.000000000 +0100 +--- a/check_snmp_storage.pl ++++ b/check_snmp_storage.pl @@ -411,13 +411,13 @@ # Get rid of UTF8 translation in case of accentuated caracters (thanks to Dimo Velev). $session->translate(Net::SNMP->TRANSLATE_NONE); @@ -405,10 +395,9 @@ diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' $result = $session->get_request(@oids); } else { if ($session->version == 0) { -diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-snmp-plugins-1.1.1~/check_snmp_vrrp.pl nagios-snmp-plugins-1.1.1/check_snmp_vrrp.pl ---- nagios-snmp-plugins-1.1.1~/check_snmp_vrrp.pl 2006-08-23 23:39:48.000000000 +0200 -+++ nagios-snmp-plugins-1.1.1/check_snmp_vrrp.pl 2013-01-31 08:38:56.000000000 +0100 -@@ -306,7 +306,7 @@ +--- a/check_snmp_vrrp.pl ++++ b/check_snmp_vrrp.pl +@@ -318,7 +318,7 @@ if ($o_type eq "ipso") { # Get cluster table my $resultat; @@ -417,7 +406,7 @@ diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' $resultat = $session->get_table( $nokia_clust_table ); } else { $resultat = $session->get_table( Baseoid => $nokia_clust_table ); -@@ -364,7 +364,7 @@ +@@ -376,7 +376,7 @@ # Get vrrp table my $resultat; @@ -426,9 +415,8 @@ diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' $resultat = $session->get_table( $base_vrrp{$o_type} ); } else { $resultat = $session->get_table( Baseoid => $base_vrrp{$o_type} ); -diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' nagios-snmp-plugins-1.1.1~/check_snmp_win.pl nagios-snmp-plugins-1.1.1/check_snmp_win.pl ---- nagios-snmp-plugins-1.1.1~/check_snmp_win.pl 2013-01-31 08:37:55.000000000 +0100 -+++ nagios-snmp-plugins-1.1.1/check_snmp_win.pl 2013-01-31 08:38:56.000000000 +0100 +--- a/check_snmp_win.pl ++++ b/check_snmp_win.pl @@ -256,7 +256,7 @@ # Look for process in name or path name table my $resultat=undef; diff --git a/debian/patches/50_disable_epn b/debian/patches/50_disable_epn index 5cec8b8..8b51cd6 100644 --- a/debian/patches/50_disable_epn +++ b/debian/patches/50_disable_epn @@ -2,126 +2,112 @@ ## ## DP: leave marks to disable epn -diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_boostedge.pl nagios-snmp-plugins-1.1.1/check_snmp_boostedge.pl ---- nagios-snmp-plugins-1.1.1.orig/check_snmp_boostedge.pl 2007-01-16 23:57:14.000000000 +0100 -+++ nagios-snmp-plugins-1.1.1/check_snmp_boostedge.pl 2008-05-23 14:09:04.000000000 +0200 +--- a/check_snmp_boostedge.pl ++++ b/check_snmp_boostedge.pl @@ -1,4 +1,5 @@ #!/usr/bin/perl -w +# nagios: -epn ############################## check_snmp_boostedge.pl ################# # Version : 1.0 # Date : Jan 16 2007 -diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_cpfw.pl nagios-snmp-plugins-1.1.1/check_snmp_cpfw.pl ---- nagios-snmp-plugins-1.1.1.orig/check_snmp_cpfw.pl 2007-04-20 00:03:30.000000000 +0200 -+++ nagios-snmp-plugins-1.1.1/check_snmp_cpfw.pl 2008-05-23 14:09:09.000000000 +0200 +--- a/check_snmp_cpfw.pl ++++ b/check_snmp_cpfw.pl @@ -1,4 +1,5 @@ #!/usr/bin/perl -w +# nagios: -epn ############################## check_snmp_cpfw ############## - # Version : 1.2.1 - # Date : April 19 2007 -diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_css_main.pl nagios-snmp-plugins-1.1.1/check_snmp_css_main.pl ---- nagios-snmp-plugins-1.1.1.orig/check_snmp_css_main.pl 2006-10-05 23:40:55.000000000 +0200 -+++ nagios-snmp-plugins-1.1.1/check_snmp_css_main.pl 2008-05-23 14:09:25.000000000 +0200 + my $Version='1.8'; + # Date : Oct 20 2007 +--- a/check_snmp_css_main.pl ++++ b/check_snmp_css_main.pl @@ -1,4 +1,5 @@ #!/usr/bin/perl -w +# nagios: -epn ############################## check_snmp_css_main.pl ################# # Version : 1.0 # Date : 27 Sept 2006 -diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_css.pl nagios-snmp-plugins-1.1.1/check_snmp_css.pl ---- nagios-snmp-plugins-1.1.1.orig/check_snmp_css.pl 2007-01-11 17:06:08.000000000 +0100 -+++ nagios-snmp-plugins-1.1.1/check_snmp_css.pl 2008-05-23 14:09:18.000000000 +0200 +--- a/check_snmp_css.pl ++++ b/check_snmp_css.pl @@ -1,4 +1,5 @@ #!/usr/bin/perl -w +# nagios: -epn ############################## check_snmp_css.pl ################# # Version : 1.0.1 # Date : 27 Sept 2006 -diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_env.pl nagios-snmp-plugins-1.1.1/check_snmp_env.pl ---- nagios-snmp-plugins-1.1.1.orig/check_snmp_env.pl 2008-05-23 14:05:14.000000000 +0200 -+++ nagios-snmp-plugins-1.1.1/check_snmp_env.pl 2008-05-23 14:09:32.000000000 +0200 +--- a/check_snmp_env.pl ++++ b/check_snmp_env.pl @@ -1,4 +1,5 @@ #!/usr/bin/perl -w +# nagios: -epn ############################## check_snmp_env ################# # Version : 1.3 # Date : May 24 2007 -diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_int.pl nagios-snmp-plugins-1.1.1/check_snmp_int.pl ---- nagios-snmp-plugins-1.1.1.orig/check_snmp_int.pl 2008-05-23 14:05:14.000000000 +0200 -+++ nagios-snmp-plugins-1.1.1/check_snmp_int.pl 2008-05-23 14:09:39.000000000 +0200 +--- a/check_snmp_int.pl ++++ b/check_snmp_int.pl @@ -1,4 +1,5 @@ #!/usr/bin/perl -w +# nagios: -epn ############################## check_snmp_int ############## my $Version='1.24'; # Date : Oct 10 2007 -diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_linkproof_nhr.pl nagios-snmp-plugins-1.1.1/check_snmp_linkproof_nhr.pl ---- nagios-snmp-plugins-1.1.1.orig/check_snmp_linkproof_nhr.pl 2006-08-26 14:37:12.000000000 +0200 -+++ nagios-snmp-plugins-1.1.1/check_snmp_linkproof_nhr.pl 2008-05-23 14:09:46.000000000 +0200 +--- a/check_snmp_linkproof_nhr.pl ++++ b/check_snmp_linkproof_nhr.pl @@ -1,4 +1,5 @@ #!/usr/bin/perl -w +# nagios: -epn ############################## check_snmp_linkproof_nhr ################# # Version : 1.0 # Date : Aug 24 2006 -diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_load.pl nagios-snmp-plugins-1.1.1/check_snmp_load.pl ---- nagios-snmp-plugins-1.1.1.orig/check_snmp_load.pl 2008-05-23 14:05:14.000000000 +0200 -+++ nagios-snmp-plugins-1.1.1/check_snmp_load.pl 2008-05-23 14:09:52.000000000 +0200 +--- a/check_snmp_load.pl ++++ b/check_snmp_load.pl @@ -1,4 +1,5 @@ #!/usr/bin/perl -w +# nagios: -epn ############################## check_snmp_load ################# my $Version='1.12'; # Date : Oct 12 2007 -diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_mem.pl nagios-snmp-plugins-1.1.1/check_snmp_mem.pl ---- nagios-snmp-plugins-1.1.1.orig/check_snmp_mem.pl 2006-07-09 22:52:37.000000000 +0200 -+++ nagios-snmp-plugins-1.1.1/check_snmp_mem.pl 2008-05-23 14:09:58.000000000 +0200 +--- a/check_snmp_mem.pl ++++ b/check_snmp_mem.pl @@ -1,4 +1,5 @@ #!/usr/bin/perl -w +# nagios: -epn ############################## check_snmp_mem ############## - # Version : 1.1 - # Date : Jul 09 2006 -diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_nsbox.pl nagios-snmp-plugins-1.1.1/check_snmp_nsbox.pl ---- nagios-snmp-plugins-1.1.1.orig/check_snmp_nsbox.pl 2007-01-16 23:55:21.000000000 +0100 -+++ nagios-snmp-plugins-1.1.1/check_snmp_nsbox.pl 2008-05-23 14:10:04.000000000 +0200 + my $Version='1.5'; + # Date : 17 October 2007 +--- a/check_snmp_nsbox.pl ++++ b/check_snmp_nsbox.pl @@ -1,4 +1,5 @@ #!/usr/bin/perl -w +# nagios: -epn ############################## check_snmp_nsbox ################# # Version : 1.0 # Date : Jan 16 2007 -diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_process.pl nagios-snmp-plugins-1.1.1/check_snmp_process.pl ---- nagios-snmp-plugins-1.1.1.orig/check_snmp_process.pl 2008-05-23 14:05:14.000000000 +0200 -+++ nagios-snmp-plugins-1.1.1/check_snmp_process.pl 2008-05-23 14:10:10.000000000 +0200 +--- a/check_snmp_process.pl ++++ b/check_snmp_process.pl @@ -1,4 +1,5 @@ #!/usr/bin/perl -w +# nagios: -epn ############################## check_snmp_process ############## my $Version='1.10'; # Date : Oct 12 2007 -diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_storage.pl nagios-snmp-plugins-1.1.1/check_snmp_storage.pl ---- nagios-snmp-plugins-1.1.1.orig/check_snmp_storage.pl 2008-05-23 14:05:14.000000000 +0200 -+++ nagios-snmp-plugins-1.1.1/check_snmp_storage.pl 2008-05-23 14:10:15.000000000 +0200 +--- a/check_snmp_storage.pl ++++ b/check_snmp_storage.pl @@ -1,4 +1,5 @@ #!/usr/bin/perl -w +# nagios: -epn ############################## check_snmp_storage ############## # Version : 1.3.3 # Date : Jun 1 2007 -diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_vrrp.pl nagios-snmp-plugins-1.1.1/check_snmp_vrrp.pl ---- nagios-snmp-plugins-1.1.1.orig/check_snmp_vrrp.pl 2006-08-23 23:39:48.000000000 +0200 -+++ nagios-snmp-plugins-1.1.1/check_snmp_vrrp.pl 2008-05-23 14:10:21.000000000 +0200 +--- a/check_snmp_vrrp.pl ++++ b/check_snmp_vrrp.pl @@ -1,4 +1,5 @@ #!/usr/bin/perl -w +# nagios: -epn ############################## check_snmp_vrrp ############## - # Version : 1.3 - # Date : Aug 23 2006 -diff -Nur nagios-snmp-plugins-1.1.1.orig/check_snmp_win.pl nagios-snmp-plugins-1.1.1/check_snmp_win.pl ---- nagios-snmp-plugins-1.1.1.orig/check_snmp_win.pl 2008-05-23 14:05:14.000000000 +0200 -+++ nagios-snmp-plugins-1.1.1/check_snmp_win.pl 2008-05-23 14:10:26.000000000 +0200 + my $Version='1.4'; + # Date : Oct 17 2007 +--- a/check_snmp_win.pl ++++ b/check_snmp_win.pl @@ -1,4 +1,5 @@ #!/usr/bin/perl -w +# nagios: -epn From 6fa6c288ab1f2c6c927aee46d5f9004a295eab0f Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 2 Mar 2014 22:52:16 +0100 Subject: [PATCH 066/205] Update patch description 10_fix_net_snmp_version --- debian/patches/10_fix_net_snmp_version | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/patches/10_fix_net_snmp_version b/debian/patches/10_fix_net_snmp_version index 757d055..dda9f3a 100644 --- a/debian/patches/10_fix_net_snmp_version +++ b/debian/patches/10_fix_net_snmp_version @@ -1,6 +1,8 @@ ## 10_fix_net_snmp_version by Jan Wagner ## ## DP: Fixing Net::SNMP version +## DP: sed -i 's/Net::SNMP->VERSION < 4/Net::SNMP->VERSION lt 4/g' +## DP: fix Argument "v6.0.1" isn't numeric in numeric lt (<) ## DP: (see https://wiki.icinga.org/display/howtos/check_snmp#checksnmp-Argumentv601isntnumericinnumericlt) --- a/check_snmp_boostedge.pl From 0193501af84bbb0e5b9841db1dcf74f049e49dd7 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 2 Mar 2014 22:58:49 +0100 Subject: [PATCH 067/205] Rename patch 11_fix_privacy_doc into 51_fix_privacy_doc --- debian/patches/{11_fix_privacy_doc => 51_fix_privacy_doc} | 0 debian/patches/series | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename debian/patches/{11_fix_privacy_doc => 51_fix_privacy_doc} (100%) diff --git a/debian/patches/11_fix_privacy_doc b/debian/patches/51_fix_privacy_doc similarity index 100% rename from debian/patches/11_fix_privacy_doc rename to debian/patches/51_fix_privacy_doc diff --git a/debian/patches/series b/debian/patches/series index 2bf85a7..f8d6040 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,5 +1,5 @@ 01_update_pre_1.1.2 10_fix_net_snmp_version -11_fix_privacy_doc 15_check_snmp_storage_64bit 50_disable_epn +51_fix_privacy_doc From c7fb3c5af8cd32e29ec89ceaf8f5e8308c0b5406 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 2 Mar 2014 23:08:45 +0100 Subject: [PATCH 068/205] Update patch descriptions --- debian/patches/01_update_pre_1.1.2 | 4 ++++ debian/patches/15_check_snmp_storage_64bit | 3 +-- debian/patches/51_fix_privacy_doc | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/debian/patches/01_update_pre_1.1.2 b/debian/patches/01_update_pre_1.1.2 index 97bf1d9..39dddb3 100644 --- a/debian/patches/01_update_pre_1.1.2 +++ b/debian/patches/01_update_pre_1.1.2 @@ -1,3 +1,7 @@ +## 01_update_pre_1.1.2 by Jan Wagner +## +## DP: Update to the latest know CVS verions + diff -Nur nagios_plugins/Changelog plugins/Changelog --- nagios_plugins/Changelog 2007-04-23 15:15:40.000000000 +0200 +++ plugins/Changelog 2007-10-20 13:26:06.000000000 +0200 diff --git a/debian/patches/15_check_snmp_storage_64bit b/debian/patches/15_check_snmp_storage_64bit index 4fbb0d7..60a5a14 100644 --- a/debian/patches/15_check_snmp_storage_64bit +++ b/debian/patches/15_check_snmp_storage_64bit @@ -1,7 +1,6 @@ ## 15_check_snmp_storage_64bit by Martin Fürstenau ## -## DP: Fixing Net::SNMP version -## DP: (see https://wiki.icinga.org/display/howtos/check_snmp#checksnmp-Argumentv601isntnumericinnumericlt) +## DP: Make check_snmp_storage 64 Bit prrof ## From 144c57a0adda190000bef500f3274425cb90d6ba Mon Sep 17 00:00:00 2001 ## From: Michael Friedrich diff --git a/debian/patches/51_fix_privacy_doc b/debian/patches/51_fix_privacy_doc index 2750b6a..cf1de7a 100644 --- a/debian/patches/51_fix_privacy_doc +++ b/debian/patches/51_fix_privacy_doc @@ -1,4 +1,4 @@ -## 11_fix_privacy_doc by Jan Wagner +## 51_fix_privacy_doc by Jan Wagner ## ## DP: Fixing potential privacy breach by fetching data from sourceforge.net From 462339912aa87dd1d0aefa4601b7783121760d14 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 2 Mar 2014 23:11:52 +0100 Subject: [PATCH 069/205] Add 16_perfdata to enable perfdate --- debian/patches/16_perfdata | 266 +++++++++++++++++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 267 insertions(+) create mode 100644 debian/patches/16_perfdata diff --git a/debian/patches/16_perfdata b/debian/patches/16_perfdata new file mode 100644 index 0000000..d24ba34 --- /dev/null +++ b/debian/patches/16_perfdata @@ -0,0 +1,266 @@ +## 16_perfdata by Michael Friedrich +## +## DP: Add perfdata + +## From 264a0b15dd69a7ab4133b351b9316e1b443da154 Mon Sep 17 00:00:00 2001 +## From: Michael Friedrich +## Date: Sat, 11 May 2013 11:34:47 +0200 +## Subject: [PATCH] add --perfdata next to --perfparse, clarify on what this is + +--- + check_snmp_boostedge.pl | 6 +++--- + check_snmp_cpfw.pl | 8 ++++---- + check_snmp_int.pl | 6 +++--- + check_snmp_linkproof_nhr.pl | 6 +++--- + check_snmp_load.pl | 6 +++--- + check_snmp_nsbox.pl | 6 +++--- + check_snmp_storage.pl | 6 +++--- + doc/snmp_cpfw.html | 4 ++-- + doc/snmp_css.html | 4 ++-- + doc/snmp_env.html | 4 ++-- + doc/snmp_int.html | 4 ++-- + doc/snmp_load.html | 4 ++-- + doc/snmp_storage.html | 4 ++-- + 13 files changed, 34 insertions(+), 34 deletions(-) + +--- a/check_snmp_boostedge.pl ++++ b/check_snmp_boostedge.pl +@@ -121,8 +121,8 @@ + : Priv protocole (des|aes : default des) + -P, --port=PORT + SNMP port (Default 161) +--f, --perfparse +- Perfparse compatible output ++-f, --perfparse, --perfdata ++ Performance data output + -t, --timeout=INTEGER + timeout for SNMP in seconds (Default: 5) + -V, --version +@@ -148,7 +148,7 @@ + 't:i' => \$o_timeout, 'timeout:i' => \$o_timeout, + 'V' => \$o_version, 'version' => \$o_version, + '2' => \$o_version2, 'v2c' => \$o_version2, +- 'f' => \$o_perf, 'perfparse' => \$o_perf, ++ 'f' => \$o_perf, 'perfparse' => \$o_perf, 'perfdata' => \$o_perf, + 's:s' => \$o_service, 'service:s' => \$o_service, + 'n:i' => \$o_nservice, 'number:i' => \$o_nservice + ); +--- a/check_snmp_cpfw.pl ++++ b/check_snmp_cpfw.pl +@@ -148,8 +148,8 @@ + check if installed policy is POLICY_NAME (must have -w) + -c, --connexions=WARN,CRIT + check warn and critical number of connexions (must have -w) +--f, --perfparse +- perfparse output (only works with -c) ++-f, --perfparse, --perfdata ++ performance data output (only works with -c) + -P, --port=PORT + SNMP port (Default 161) + -t, --timeout=INTEGER +@@ -183,7 +183,7 @@ + 'm' => \$o_mgmt, 'mgmt' => \$o_mgmt, + 'p:s' => \$o_policy, 'policy:s' => \$o_policy, + 'c:s' => \$o_conn, 'connexions:s' => \$o_conn, +- 'f' => \$o_perf, 'perfparse' => \$o_perf ++ 'f' => \$o_perf, 'perfparse' => \$o_perf, 'perfdata' => \$o_perf + ); + if (defined ($o_help) ) { help(); exit $ERRORS{"UNKNOWN"}}; + if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"}}; +@@ -222,7 +222,7 @@ + { print "Put a policy name !\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} + } + if (defined($o_perf) && ! defined ($o_conn)) +- { print "Nothing selected for perfparse !\n";print_usage(); exit $ERRORS{"UNKNOWN"}} ++ { print "Nothing selected for performance data output !\n";print_usage(); exit $ERRORS{"UNKNOWN"}} + if (!defined($o_fw) && !defined($o_ha) && !defined($o_mgmt) && !defined($o_svn)) + { print "Must select a product to check !\n";print_usage(); exit $ERRORS{"UNKNOWN"}} + if (defined ($o_ha) && ($o_ha ne "") && ($o_ha ne "standby")) +--- a/check_snmp_int.pl ++++ b/check_snmp_int.pl +@@ -199,8 +199,8 @@ + max-size of the SNMP message, usefull in case of Too Long responses. + Be carefull with network filters. Range 484 - 65535, default are + usually 1472,1452,1460 or 1440. +--f, --perfparse +- Perfparse compatible output (no output when interface is down). ++-f, --perfparse, --perfdata ++ Performance data output (no output when interface is down). + -e, --error + Add error & discard to Perfparse output + -S, --intspeed +@@ -267,7 +267,7 @@ + 'a' => \$o_admin, 'admin' => \$o_admin, + 'r' => \$o_noreg, 'noregexp' => \$o_noreg, + 'V' => \$o_version, 'version' => \$o_version, +- 'f' => \$o_perf, 'perfparse' => \$o_perf, ++ 'f' => \$o_perf, 'perfparse' => \$o_perf, 'perfdata' => \$o_perf, + 'e' => \$o_perfe, 'error' => \$o_perfe, + 'k' => \$o_checkperf, 'perfcheck' => \$o_checkperf, + 'q' => \$o_ext_checkperf, 'extperfcheck' => \$o_ext_checkperf, +--- a/check_snmp_linkproof_nhr.pl ++++ b/check_snmp_linkproof_nhr.pl +@@ -100,8 +100,8 @@ + : Priv protocole (des|aes : default des) + -P, --port=PORT + SNMP port (Default 161) +--f, --perfparse +- Perfparse compatible output ++-f, --perfparse, --perfdata ++ Performance data output + -t, --timeout=INTEGER + timeout for SNMP in seconds (Default: 5) + -V, --version +@@ -127,7 +127,7 @@ + 't:i' => \$o_timeout, 'timeout:i' => \$o_timeout, + 'V' => \$o_version, 'version' => \$o_version, + '2' => \$o_version2, 'v2c' => \$o_version2, +- 'f' => \$o_perf, 'perfparse' => \$o_perf, ++ 'f' => \$o_perf, 'perfparse' => \$o_perf, 'perfdata' => \$o_perf + ); + # Basic checks + if (defined($o_timeout) && (isnnum($o_timeout) || ($o_timeout < 2) || ($o_timeout > 60))) +--- a/check_snmp_load.pl ++++ b/check_snmp_load.pl +@@ -178,8 +178,8 @@ + hp : HP procurve switch CPU usage + lp : Linkproof CPU usage + hpux : HP-UX load (1,5 & 15 minutes values) +--f, --perfparse +- Perfparse compatible output ++-f, --perfparse, --perfdata ++ Performance data output + -t, --timeout=INTEGER + timeout for SNMP in seconds (Default: 5) + -V, --version +@@ -207,7 +207,7 @@ + '2' => \$o_version2, 'v2c' => \$o_version2, + 'c:s' => \$o_crit, 'critical:s' => \$o_crit, + 'w:s' => \$o_warn, 'warn:s' => \$o_warn, +- 'f' => \$o_perf, 'perfparse' => \$o_perf, ++ 'f' => \$o_perf, 'perfparse' => \$o_perf, 'perfdata' => \$o_perf, + 'T:s' => \$o_check_type, 'type:s' => \$o_check_type + ); + # check the -T option +--- a/check_snmp_nsbox.pl ++++ b/check_snmp_nsbox.pl +@@ -126,8 +126,8 @@ + number of diode and vhost that must be up. + -P, --port=PORT + SNMP port (Default 161) +--f, --perfparse +- Perfparse compatible output ++-f, --perfparse, --perfdata ++ Performance data output + -t, --timeout=INTEGER + timeout for SNMP in seconds (Default: 5) + -V, --version +@@ -153,7 +153,7 @@ + 't:i' => \$o_timeout, 'timeout:i' => \$o_timeout, + 'V' => \$o_version, 'version' => \$o_version, + '2' => \$o_version2, 'v2c' => \$o_version2, +- 'f' => \$o_perf, 'perfparse' => \$o_perf, ++ 'f' => \$o_perf, 'perfparse' => \$o_perf, 'perfdata' => \$o_perf, + 'd:s' => \$o_diode, 'diode:s' => \$o_diode, + 's:s' => \$o_vhost, 'vhost:s' => \$o_vhost, + 'n:s' => \$o_nvhost, 'number:s' => \$o_nvhost +--- a/check_snmp_storage.pl ++++ b/check_snmp_storage.pl +@@ -189,8 +189,8 @@ + For ext2/3 filesystems, it is 5% by default + -G, --gigabyte + output, warning & critical levels in gigabytes +--f, --perfparse +- Perfparse compatible output ++-f, --perfparse, --perfdata ++ Performance data output + -S, --short=[,,] + : Make the output shorter : + 0 : only print the global result except the disk in warning or critical +@@ -255,7 +255,7 @@ + 'q:s' => \$o_storagetype, 'storagetype:s'=> \$o_storagetype, + 'S:s' => \$o_short, 'short:s' => \$o_short, + 'o:i' => \$o_octetlength, 'octetlength:i' => \$o_octetlength, +- 'f' => \$o_perf, 'perfparse' => \$o_perf, ++ 'f' => \$o_perf, 'perfparse' => \$o_perf, 'perfdata' => \$o_perf, + 'R:i' => \$o_reserve, 'reserved:i' => \$o_reserve, + 'G' => \$o_giga, 'gigabyte' => \$o_giga + ); +--- a/doc/snmp_cpfw.html ++++ b/doc/snmp_cpfw.html +@@ -414,8 +414,8 @@ + check if installed policy is POLICY_NAME (must have -w)
+ -c, --connexions=WARN,CRIT
+ check warn and critical number of connexions (must have -w)
+- -f, --perfparse
+- perfparse output (only works with -c)
++ -f, --perfparse, --perfdata
++ performance data output (only works with -c)
+ -P, --port=PORT
+ SNMP port (Default 161)
+ -t, --timeout=INTEGER
+--- a/doc/snmp_css.html ++++ b/doc/snmp_css.html +@@ -289,8 +289,8 @@ + <privproto> : Priv protocole (des|aes : default des) + -P, --port=PORT + SNMP port (Default 161) +--f, --perfparse +- Perfparse compatible output ++-f, --perfparse, --perfdata ++ Performance data output + -t, --timeout=INTEGER + timeout for SNMP in seconds (Default: 5) + -V, --version +--- a/doc/snmp_env.html ++++ b/doc/snmp_env.html +@@ -319,8 +319,8 @@ + Minimum fan rpm value
+ -c, --celcius=<celcius>
+ Maximum temp in degree celcius
+- -f, --perfparse
+- Perfparse compatible output
++ -f, --perfparse, --perfdata
++ Performance data output
+ -t, --timeout=INTEGER
+ timeout for SNMP in seconds (Default: 5)
+ -V, --version
+--- a/doc/snmp_int.html ++++ b/doc/snmp_int.html +@@ -594,8 +594,8 @@ + Be carefull with network filters. Range 484 - 65535, default + are
+ usually 1472,1452,1460 or 1440.
+- -f, --perfparse
+- Perfparse compatible output (no output when interface is down).
++ -f, --perfparse, --perfdata
++ Performance data output (no output when interface is down).
+ -e, --error
+ Add error & discard to Perfparse output
+ -S, --intspeed
+--- a/doc/snmp_load.html ++++ b/doc/snmp_load.html +@@ -357,8 +357,8 @@ + nokia : Nokia CPU usage
+ hp : HP procurve switch CPU usage
+ lp : Linkproof CPU usage
+- -f, --perfparse
+- Perfparse compatible output
++ -f, --perfparse, --perfdata
++ Performance data output
+ -t, --timeout=INTEGER
+ timeout for SNMP in seconds (Default: 5)
+ -V, --version
+--- a/doc/snmp_storage.html ++++ b/doc/snmp_storage.html +@@ -1211,8 +1211,8 @@ + -c, --critical=INTEGER
+ percent / MB of disk used to generate CRITICAL state
+ you can add the % sign
+- -f, --perfparse
+- Perfparse compatible output
++ -f, --perfparse, --perfdata
++ Performance data output
+ -S, --short=<type>[,<where>,<cut>]
+ <type>: Make the output shorter :
+ 0 : only print the global result except the disk in warning diff --git a/debian/patches/series b/debian/patches/series index f8d6040..e00134b 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,5 +1,6 @@ 01_update_pre_1.1.2 10_fix_net_snmp_version 15_check_snmp_storage_64bit +16_perfdata 50_disable_epn 51_fix_privacy_doc From 93834c1fa1adf60161163a366a22e95202a6425f Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 2 Mar 2014 23:42:03 +0100 Subject: [PATCH 070/205] Add 17_protocol_fam to support protocol and IP familiy --- debian/patches/17_protocol_fam | 385 +++++++++++++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 386 insertions(+) create mode 100644 debian/patches/17_protocol_fam diff --git a/debian/patches/17_protocol_fam b/debian/patches/17_protocol_fam new file mode 100644 index 0000000..e38e4b6 --- /dev/null +++ b/debian/patches/17_protocol_fam @@ -0,0 +1,385 @@ +## 17_protocol_fam by Alice Kærast +## +## DP: Add protocol and IPv[46] + +## From 5369da5d2b3e4351e04f016619736f7d03cbcdfd Mon Sep 17 00:00:00 2001 +## From: Michael Friedrich +## Date: Fri, 5 Jul 2013 21:32:45 +0200 +## Subject: [PATCH] add -P|--protocol= setting tcp/udp and IPv4/IPv6 for +## load/mem/process/storage +## MIME-Version: 1.0 +## Content-Type: text/plain; charset=UTF-8 +## Content-Transfer-Encoding: 8bit +## +## reworked the patches from +## https://sourceforge.net/p/nagios-snmp/feature-requests/27/ +## to make them fit the current patch level, and keep the same output the +## most. +## +## full kudos to Alice Kærast. +--- + check_snmp_load.pl | 26 ++++++++++++++++++++------ + check_snmp_mem.pl | 24 ++++++++++++++++++------ + check_snmp_process.pl | 28 ++++++++++++++++++++-------- + check_snmp_storage.pl | 22 +++++++++++++++++----- + 4 files changed, 75 insertions(+), 25 deletions(-) + +diff --git a/check_snmp_load.pl b/plugins/check_snmp_load.pl +index 71487ec..a1ccc7c 100755 +--- a/check_snmp_load.pl ++++ b/check_snmp_load.pl +@@ -95,6 +95,7 @@ + my $o_host = undef; # hostname + my $o_community = undef; # community + my $o_port = 161; # port ++my $o_domain= 'udp/ipv4'; # protocol + my $o_help= undef; # wan't some help ? + my $o_verb= undef; # verbose mode + my $o_version= undef; # print version +@@ -121,7 +122,7 @@ + sub p_version { print "check_snmp_load version : $Version\n"; } + + sub print_usage { +- print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -w -c -T=[stand|netsl|netsc|as400|cisco|cata|nsc|fg|bc|nokia|hp|lp|hpux] [-f] [-t ] [-V]\n"; ++ print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] [-P ] -w -c -T=[stand|netsl|netsc|as400|cisco|cata|nsc|fg|bc|nokia|hp|lp|hpux] [-f] [-t ] [-V]\n"; + } + + sub isnnum { # Return true if arg is not a number +@@ -153,8 +154,16 @@ sub help { + -L, --protocols=, + : Authentication protocol (md5|sha : default md5) + : Priv protocole (des|aes : default des) +--P, --port=PORT ++-p, --port=PORT + SNMP port (Default 161) ++-P, --protocol=PROTOCOL ++ Network protocol to be used ++ ['udp/ipv4'] : UDP over IPv4 ++ 'udp/ipv6' : UDP over IPv6 ++ 'tcp/ipv4' : TCP over IPv4 ++ 'tcp/ipv6' : TCP over IPv6 ++ ++ Network protocol (Default udp/ipv4) + -w, --warn=INTEGER | INT,INT,INT + 1 value check : warning level for cpu in percent (on one minute) + 3 value check : comma separated level for load or cpu for 1min, 5min, 15min +@@ -197,6 +206,7 @@ sub check_options { + 'h' => \$o_help, 'help' => \$o_help, + 'H:s' => \$o_host, 'hostname:s' => \$o_host, + 'p:i' => \$o_port, 'port:i' => \$o_port, ++ 'P:s' => \$o_domain, 'protocol:s' => \$o_domain, + 'C:s' => \$o_community, 'community:s' => \$o_community, + 'l:s' => \$o_login, 'login:s' => \$o_login, + 'x:s' => \$o_passwd, 'passwd:s' => \$o_passwd, +@@ -297,7 +307,8 @@ sub check_options { + -username => $o_login, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, +- -timeout => $o_timeout ++ -timeout => $o_timeout, ++ -domain => $o_domain + ); + } else { + verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); +@@ -309,7 +320,8 @@ sub check_options { + -authprotocol => $o_authproto, + -privpassword => $o_privpass, + -privprotocol => $o_privproto, +- -timeout => $o_timeout ++ -timeout => $o_timeout, ++ -domain => $o_domain + ); + } + } else { +@@ -321,7 +333,8 @@ sub check_options { + -version => 2, + -community => $o_community, + -port => $o_port, +- -timeout => $o_timeout ++ -timeout => $o_timeout, ++ -domain => $o_domain + ); + } else { + # SNMPV1 login +@@ -330,7 +343,8 @@ sub check_options { + -hostname => $o_host, + -community => $o_community, + -port => $o_port, +- -timeout => $o_timeout ++ -timeout => $o_timeout, ++ -domain => $o_domain + ); + } + } +diff --git a/check_snmp_mem.pl b/plugins/check_snmp_mem.pl +index 631a39b..6f5425e 100644 +--- a/check_snmp_mem.pl ++++ b/check_snmp_mem.pl +@@ -63,6 +63,7 @@ + my $o_host = undef; # hostname + my $o_community = undef; # community + my $o_port = 161; # port ++my $o_domain= 'udp/ipv4'; # Default to UDP over IPv4 + my $o_help= undef; # wan't some help ? + my $o_verb= undef; # verbose mode + my $o_version= undef; # print version +@@ -93,7 +94,7 @@ + sub p_version { print "check_snmp_mem version : $Version\n"; } + + sub print_usage { +- print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -w -c [-I|-N|-E] [-f] [-m -b] [-t ] [-V]\n"; ++ print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] [-P ] -w -c [-I|-N|-E] [-f] [-m -b] [-t ] [-V]\n"; + } + + sub isnnum { # Return true if arg is not a number +@@ -129,8 +130,14 @@ sub help { + -L, --protocols=, + : Authentication protocol (md5|sha : default md5) + : Priv protocole (des|aes : default des) +--P, --port=PORT ++-p, --port=PORT + SNMP port (Default 161) ++-P, --protocol=PROTOCOL ++ Network protocol to be used ++ ['udp/ipv4'] : UDP over IPv4 ++ 'udp/ipv6' : UDP over IPv6 ++ 'tcp/ipv4' : TCP over IPv4 ++ 'tcp/ipv6' : TCP over IPv6 + -w, --warn=INTEGER | INT,INT + warning level for memory in percent (0 for no checks) + Default (-N switch) : comma separated level for Real Memory and Swap +@@ -174,6 +181,7 @@ sub check_options { + 'h' => \$o_help, 'help' => \$o_help, + 'H:s' => \$o_host, 'hostname:s' => \$o_host, + 'p:i' => \$o_port, 'port:i' => \$o_port, ++ 'P:s' => \$o_domain, 'protocol:s' => \$o_domain, + 'C:s' => \$o_community, 'community:s' => \$o_community, + 'l:s' => \$o_login, 'login:s' => \$o_login, + 'x:s' => \$o_passwd, 'passwd:s' => \$o_passwd, +@@ -270,7 +278,8 @@ sub check_options { + -authpassword => $o_passwd, + -authprotocol => $o_authproto, + -port => $o_port, +- -timeout => $o_timeout ++ -timeout => $o_timeout, ++ -domain => $o_domain + ); + } else { + verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); +@@ -283,7 +292,8 @@ sub check_options { + -privpassword => $o_privpass, + -privprotocol => $o_privproto, + -port => $o_port, +- -timeout => $o_timeout ++ -timeout => $o_timeout, ++ -domain => $o_domain + ); + } + } else { +@@ -295,7 +305,8 @@ sub check_options { + -version => 2, + -community => $o_community, + -port => $o_port, +- -timeout => $o_timeout ++ -timeout => $o_timeout, ++ -domain => $o_domain + ); + } else { + # SNMPV1 login +@@ -304,7 +315,8 @@ sub check_options { + -hostname => $o_host, + -community => $o_community, + -port => $o_port, +- -timeout => $o_timeout ++ -timeout => $o_timeout, ++ -domain => $o_domain + ); + } + } +diff --git a/check_snmp_process.pl b/plugins/check_snmp_process.pl +index 9494c7c..7a83432 100755 +--- a/check_snmp_process.pl ++++ b/check_snmp_process.pl +@@ -42,6 +42,7 @@ + my $o_host = undef; # hostname + my $o_community =undef; # community + my $o_port = 161; # port ++my $o_domain= 'udp/ipv4'; # Default to UDP over IPv4 + my $o_version2 = undef; #use snmp v2c + my $o_descr = undef; # description filter + my $o_warn = 0; # warning limit +@@ -80,7 +81,7 @@ + sub p_version { print "check_snmp_process version : $Version\n"; } + + sub print_usage { +- print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd) [-p ] -n [-w [,] -c [,max_proc] ] [-m, -a -u, -d ] [-t ] [-o ] [-f -A -F ] [-r] [-V] [-g]\n"; ++ print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd) [-p ] [-P ] -n [-w [,] -c [,max_proc] ] [-m, -a -u, -d ] [-t ] [-o ] [-f -A -F ] [-r] [-V] [-g]\n"; + } + + sub isnotnum { # Return true if arg is not a number +@@ -166,6 +167,12 @@ sub help { + : Priv protocole (des|aes : default des) + -p, --port=PORT + SNMP port (Default 161) ++-P, --protocol=PROTOCOL ++ Network protocol to be used ++ ['udp/ipv4'] : UDP over IPv4 ++ 'udp/ipv6' : UDP over IPv6 ++ 'tcp/ipv4' : TCP over IPv4 ++ 'tcp/ipv6' : TCP over IPv6 + -n, --name=NAME + Name of the process (regexp) + No trailing slash ! +@@ -233,6 +240,7 @@ sub check_options { + 'h' => \$o_help, 'help' => \$o_help, + 'H:s' => \$o_host, 'hostname:s' => \$o_host, + 'p:i' => \$o_port, 'port:i' => \$o_port, ++ 'P:s' => \$o_domain, 'protocol:s' => \$o_domain, + 'C:s' => \$o_community, 'community:s' => \$o_community, + 'l:s' => \$o_login, 'login:s' => \$o_login, + 'x:s' => \$o_passwd, 'passwd:s' => \$o_passwd, +@@ -240,20 +248,20 @@ sub check_options { + 'L:s' => \$v3protocols, 'protocols:s' => \$v3protocols, + 'c:s' => \$o_crit, 'critical:s' => \$o_crit, + 'w:s' => \$o_warn, 'warn:s' => \$o_warn, +- 't:i' => \$o_timeout, 'timeout:i' => \$o_timeout, ++ 't:i' => \$o_timeout, 'timeout:i' => \$o_timeout, + 'n:s' => \$o_descr, 'name:s' => \$o_descr, + 'r' => \$o_noreg, 'noregexp' => \$o_noreg, + 'f' => \$o_path, 'fullpath' => \$o_path, + 'm:s' => \$o_mem, 'memory:s' => \$o_mem, + 'a' => \$o_mem_avg, 'average' => \$o_mem_avg, + 'u:s' => \$o_cpu, 'cpu' => \$o_cpu, +- '2' => \$o_version2, 'v2c' => \$o_version2, +- 'o:i' => \$o_octetlength, 'octetlength:i' => \$o_octetlength, +- 'g' => \$o_get_all, 'getall' => \$o_get_all, +- 'A' => \$o_param, 'param' => \$o_param, +- 'F' => \$o_perf, 'perfout' => \$o_perf, ++ '2' => \$o_version2, 'v2c' => \$o_version2, ++ 'o:i' => \$o_octetlength, 'octetlength:i' => \$o_octetlength, ++ 'g' => \$o_get_all, 'getall' => \$o_get_all, ++ 'A' => \$o_param, 'param' => \$o_param, ++ 'F' => \$o_perf, 'perfout' => \$o_perf, + 'd:i' => \$o_delta, 'delta:i' => \$o_delta, +- 'V' => \$o_version, 'version' => \$o_version ++ 'V' => \$o_version, 'version' => \$o_version + ); + if (defined ($o_help)) { help(); exit $ERRORS{"UNKNOWN"}}; + if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"}}; +@@ -343,6 +351,7 @@ sub check_options { + -hostname => $o_host, + -version => '3', + -port => $o_port, ++ -domain => $o_domain, + -username => $o_login, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, +@@ -355,6 +364,7 @@ sub check_options { + -version => '3', + -username => $o_login, + -port => $o_port, ++ -domain => $o_domain, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, + -privpassword => $o_privpass, +@@ -370,6 +380,7 @@ sub check_options { + -version => 2, + -community => $o_community, + -port => $o_port, ++ -domain => $o_domain, + -timeout => $o_timeout + ); + } else { +@@ -378,6 +389,7 @@ sub check_options { + -hostname => $o_host, + -community => $o_community, + -port => $o_port, ++ -domain => $o_domain, + -timeout => $o_timeout + ); + } +diff --git a/check_snmp_storage.pl b/plugins/check_snmp_storage.pl +index 31a4015..9725dce 100644 +--- a/check_snmp_storage.pl ++++ b/check_snmp_storage.pl +@@ -62,6 +62,7 @@ + my $o_host = undef; # hostname + my $o_community = undef; # community + my $o_port = 161; # port ++my $o_domain= 'udp/ipv4'; # Default to UDP over IPv4 + my $o_version2 = undef; #use snmp v2c + my $o_descr = undef; # description filter + my $o_storagetype = undef; # parse storage type also +@@ -98,7 +99,7 @@ + sub p_version { print "$Name version : $Version\n"; } + + sub print_usage { +- print "Usage: $Name [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -m [-q storagetype] -w -c [-t ] [-T pl|pu|bl|bu ] [-r -s -i -G] [-e] [-S 0|1[,1,]] [-o ] [-R <% reserved>]\n"; ++ print "Usage: $Name [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] [-P ] -m [-q storagetype] -w -c [-t ] [-T pl|pu|bl|bu ] [-r -s -i -G] [-e] [-S 0|1[,1,]] [-o ] [-R <% reserved>]\n"; + } + + sub round ($$) { +@@ -154,6 +155,12 @@ sub help { + Password for snmpv3 authentication + -p, --port=PORT + SNMP port (Default 161) ++-P, --protocol=PROTOCOL ++ Network protocol to be used ++ ['udp/ipv4'] : UDP over IPv4 ++ 'udp/ipv6' : UDP over IPv6 ++ 'tcp/ipv4' : TCP over IPv4 ++ 'tcp/ipv6' : TCP over IPv6 + -m, --name=NAME + Name in description OID (can be mounpoints '/home' or 'Swap Space'...) + This is treated as a regexp : -m /var will match /var , /var/log, /opt/var ... +@@ -236,6 +243,7 @@ sub check_options { + 'h' => \$o_help, 'help' => \$o_help, + 'H:s' => \$o_host, 'hostname:s' => \$o_host, + 'p:i' => \$o_port, 'port:i' => \$o_port, ++ 'P:s' => \$o_domain, 'protocol:s' => \$o_domain, + 'C:s' => \$o_community, 'community:s' => \$o_community, + '2' => \$o_version2, 'v2c' => \$o_version2, + 'l:s' => \$o_login, 'login:s' => \$o_login, +@@ -352,7 +360,8 @@ sub check_options { + -authprotocol => $o_authproto, + -port => $o_port, + -retries => 10, +- -timeout => $o_timeout ++ -timeout => $o_timeout, ++ -domain => $o_domain + ); + } else { + verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); +@@ -366,7 +375,8 @@ sub check_options { + -privprotocol => $o_privproto, + -port => $o_port, + -retries => 10, +- -timeout => $o_timeout ++ -timeout => $o_timeout, ++ -domain => $o_domain + ); + } + } else { +@@ -379,7 +389,8 @@ sub check_options { + -community => $o_community, + -port => $o_port, + -retries => 10, +- -timeout => $o_timeout ++ -timeout => $o_timeout, ++ -domain => $o_domain + ); + } else { + # SNMPV1 login +@@ -389,7 +400,8 @@ sub check_options { + -community => $o_community, + -port => $o_port, + -retries => 10, +- -timeout => $o_timeout ++ -timeout => $o_timeout, ++ -domain => $o_domain + ); + } + } +-- +1.8.5.5 + diff --git a/debian/patches/series b/debian/patches/series index e00134b..6ce56d5 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -2,5 +2,6 @@ 10_fix_net_snmp_version 15_check_snmp_storage_64bit 16_perfdata +17_protocol_fam 50_disable_epn 51_fix_privacy_doc From 8ca89ae9065d9bf3916ecff03121f77d3c98a8fb Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 2 Mar 2014 23:51:09 +0100 Subject: [PATCH 071/205] Add NEWS file for changed behavior of specifying port --- debian/NEWS | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 debian/NEWS diff --git a/debian/NEWS b/debian/NEWS new file mode 100644 index 0000000..d10c299 --- /dev/null +++ b/debian/NEWS @@ -0,0 +1,21 @@ +nagios-snmp-plugins (1.1.1-8) unstable; urgency=low + + The following plugins are using now '-p' to specify the port and '-P' the + protocol: + + - check_snmp_load + - check_snmp_mem + - check_snmp_process + - check_snmp_storage + + The port is specified with '-p' now and the protocol with '-P': + + Network protocol to be used + ['udp/ipv4'] : UDP over IPv4 + 'udp/ipv6' : UDP over IPv6 + 'tcp/ipv4' : TCP over IPv4 + 'tcp/ipv6' : TCP over IPv6 + + Network protocol (Default udp/ipv4) + + -- Jan Wagner Sun, 02 Mar 2014 23:45:13 +0100 From f05ed7f8a151d66a7748fde4204d069cb1dba02a Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 2 Mar 2014 23:59:57 +0100 Subject: [PATCH 072/205] Add 18_check_snmp_process_tmp_file --- debian/patches/18_check_snmp_process_tmp_file | 32 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 33 insertions(+) create mode 100644 debian/patches/18_check_snmp_process_tmp_file diff --git a/debian/patches/18_check_snmp_process_tmp_file b/debian/patches/18_check_snmp_process_tmp_file new file mode 100644 index 0000000..81d2091 --- /dev/null +++ b/debian/patches/18_check_snmp_process_tmp_file @@ -0,0 +1,32 @@ +## 18_check_snmp_process_tmp_file by S.Bay +## +## DP: Fix tmp file check_snmp_process + +## From 88c3bfd626a531e7da1c3e3c694f6fd1d4a70692 Mon Sep 17 00:00:00 2001 +## From: "S.Bay" +## Date: Tue, 17 Dec 2013 09:32:15 +0100 +## Subject: [PATCH] Fix error writing tmp file using plugin with remote unix +## system + +--- + check_snmp_process.pl | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/check_snmp_process.pl b/plugins/check_snmp_process.pl +index 7a83432..11f2d96 100755 +--- a/check_snmp_process.pl ++++ b/check_snmp_process.pl +@@ -640,6 +640,10 @@ sub check_options { + #### Read file + $temp_file_name=$o_descr; + $temp_file_name =~ s/ /_/g; ++ $temp_file_name =~ s/\//_/g; ++ $temp_file_name =~ s/-//g; ++ $temp_file_name =~ s/=//g; ++ $temp_file_name = substr($temp_file_name,0,40); + $temp_file_name = $o_base_dir . $o_host ."." . $temp_file_name; + # First, read entire file + my @ret_array=read_file($temp_file_name,$n_items_check); +-- +1.8.5.5 + diff --git a/debian/patches/series b/debian/patches/series index 6ce56d5..b0a80a1 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -3,5 +3,6 @@ 15_check_snmp_storage_64bit 16_perfdata 17_protocol_fam +18_check_snmp_process_tmp_file 50_disable_epn 51_fix_privacy_doc From e3e176df81a8653f378b2bc6978db50a11f71183 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 5 Mar 2014 22:26:36 +0100 Subject: [PATCH 073/205] travis-ci: Install recent lintian version [skip ci] --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index f0db5e8..9c6a506 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,10 @@ script: - debuild -uc -us after_script: + # run lintian after build + - sudo add-apt-repository -y ppa:waja/precise-backports + - sudo apt-get update -qq + - sudo apt-get install -qq --no-install-recommends lintian # run lintian after build - sudo apt-get install -qq --no-install-recommends lintian - lintian --info --display-info --display-experimental --pedantic --show-overrides ../*.deb && lintian --info --display-info --display-experimental --pedantic --show-overrides ../*.dsc From 973f7d983f8cf3b082661d408445ba1cdcdd30e8 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 5 Mar 2014 22:43:56 +0100 Subject: [PATCH 074/205] Prepare changelog for release --- debian/changelog | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/debian/changelog b/debian/changelog index 1532d71..cea5162 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,35 @@ +nagios-snmp-plugins (1.1.1-9) unstable; urgency=low + + * [976e307] Update Vcs-headers + * [950a63f] Use full binary path instead of $ macro in command definitions + * [3acf202] check_snmp_storage: Add 64bit support + * [73c21a0] Convert the package to source format 3.0 (quilt) + * [6adaea0] Fix 15_check_snmp_storage_64bit + * [074ed96] Add travis-ci config + * [36857aa] travis-ci: Reorder and comment .travis.yml + * [9ac5f8c] update git ignore regex + * [f82ac54] travis-ci: Add lintian checks after build + * [1ea9877] Add build-indep and build-arch target into debian/rules + * [36735a8] Update to recent copyright format + * [8a119de] Updating standards version to 3.9.5, no changes needed + * [aaa7106] Set set -e in the body in body of the maintainers scripts + * [d03e055] Extend the extended package description + * [2fcaf9a] Fix potential privacy breach of HTML documentation + * [1ae942a] Add upstream changelog into package + * [ab802e4] Merge latest CVS patches into one + * [34070bf] Add missing latest CVS patches + * [76a78cb] Refresh patchtes + * [6fa6c28] Update patch description 10_fix_net_snmp_version + * [0193501] Rename patch 11_fix_privacy_doc into 51_fix_privacy_doc + * [c7fb3c5] Update patch descriptions + * [4623399] Add 16_perfdata to enable perfdate + * [93834c1] Add 17_protocol_fam to support protocol and IP familiy + * [8ca89ae] Add NEWS file for changed behavior of specifying port + * [f05ed7f] Add 18_check_snmp_process_tmp_file + * [e3e176d] travis-ci: Install recent lintian version + + -- Jan Wagner Wed, 05 Mar 2014 22:34:26 +0100 + nagios-snmp-plugins (1.1.1-8) unstable; urgency=low * Add 10_fix_net_snmp_version.dpatch From 5dbb90525d0b0dc4a06f7ad745436ecb9492f786 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 13 Aug 2014 14:33:05 +0200 Subject: [PATCH 075/205] Add support for monitoring-plugins --- debian/control | 2 +- debian/postinst | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/debian/control b/debian/control index f3645ef..36c948d 100644 --- a/debian/control +++ b/debian/control @@ -11,7 +11,7 @@ Standards-Version: 3.9.5 Package: nagios-snmp-plugins Architecture: all -Depends: ${perl:Depends}, ${misc:Depends}, libnet-snmp-perl, nagios-plugins-basic (>= 1.4.5-2), perl-base (>= 5.8.4-8), ucf +Depends: ${perl:Depends}, ${misc:Depends}, libnet-snmp-perl, monitoring-plugins-common | nagios-plugins-basic (>= 1.4.5-2), perl-base (>= 5.8.4-8), ucf Description: SNMP Plugins for nagios A set of Nagios plugins to check hosts/devices using snmp protocol . diff --git a/debian/postinst b/debian/postinst index 55a755d..c27de01 100644 --- a/debian/postinst +++ b/debian/postinst @@ -5,7 +5,11 @@ set -e templdir=/usr/share/nagios-snmp-plugins/pluginconfig if [ "$1" = "configure" ]; then - if [ -f /usr/share/nagios-plugins/dpkg/functions ]; then + if [ -f /usr/share/monitoring-plugins/dpkg/functions ]; then + # only working with monitoring-plugins-basic + . /usr/share/monitoring-plugins/dpkg/functions + register_cfgs $2 + elif [ -f /usr/share/nagios-plugins/dpkg/functions ]; then # only working with nagios-plugins-basic (>= 1.4.5-2) . /usr/share/nagios-plugins/dpkg/functions register_cfgs $2 From f529116384a10f2c7ec269d3be10b429775f7c45 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 22 Aug 2014 17:33:30 +0200 Subject: [PATCH 076/205] Add 'libcrypt-des-perl, libcrypt-rijndael-perl' as recommends, needed for snmp v3 --- debian/control | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/control b/debian/control index 36c948d..3c036a3 100644 --- a/debian/control +++ b/debian/control @@ -12,6 +12,7 @@ Standards-Version: 3.9.5 Package: nagios-snmp-plugins Architecture: all Depends: ${perl:Depends}, ${misc:Depends}, libnet-snmp-perl, monitoring-plugins-common | nagios-plugins-basic (>= 1.4.5-2), perl-base (>= 5.8.4-8), ucf +Recommends: libcrypt-des-perl, libcrypt-rijndael-perl Description: SNMP Plugins for nagios A set of Nagios plugins to check hosts/devices using snmp protocol . From ce65e19b32494f34ce132cb90acaea3e664b5f56 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 12 Oct 2014 22:19:58 +0200 Subject: [PATCH 077/205] Don't use symlinked license in debian/copyright --- debian/copyright | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/copyright b/debian/copyright index c47e1d7..71c8915 100644 --- a/debian/copyright +++ b/debian/copyright @@ -40,5 +40,5 @@ License: GPL-2+ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA . - On Debian systems, the complete text of the GNU General Public License - can be found in /usr/share/common-licenses/GPL file. + On Debian systems, the complete text of the GNU General Public License version + 2 can be found in /usr/share/common-licenses/GPL-2 file. From 20f7a79198196acd31011fdb8198b51b5235e6ba Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 12 Oct 2014 22:22:09 +0200 Subject: [PATCH 078/205] Bump Standards-Version to 3.9.6, no changes needed --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 3c036a3..344a071 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Build-Depends: debhelper (>= 5) Homepage: http://www.manubulon.com/nagios/index_snmp.html Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-nagios/pkg-nagios-snmp-plugins.git Vcs-Git: git://anonscm.debian.org/pkg-nagios/pkg-nagios-snmp-plugins -Standards-Version: 3.9.5 +Standards-Version: 3.9.6 Package: nagios-snmp-plugins Architecture: all From 5b65897930ce5ff2f153bd536d317bea6bead0b1 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 12 Oct 2014 22:24:50 +0200 Subject: [PATCH 079/205] Updating debian/changelog --- debian/changelog | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/debian/changelog b/debian/changelog index cea5162..a507a5e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +nagios-snmp-plugins (1.1.1-10) unstable; urgency=medium + + * [5dbb905] Add support for monitoring-plugins + * [f529116] Add 'libcrypt-des-perl, libcrypt-rijndael-perl' as recommends, + needed for snmp v3 + * [ce65e19] Don't use symlinked license in debian/copyright + * [20f7a79] Bump Standards-Version to 3.9.6, no changes needed + + -- Jan Wagner Sun, 12 Oct 2014 22:23:51 +0200 + nagios-snmp-plugins (1.1.1-9) unstable; urgency=low * [976e307] Update Vcs-headers From fa90d0da60b021134dd7312de1cba7ae9179c324 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 13 Oct 2014 14:57:08 +0200 Subject: [PATCH 080/205] New changelog --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index a507a5e..8240985 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +nagios-snmp-plugins (1.1.1-11) UNRELEASED; urgency=medium + + * + + -- Jan Wagner Mon, 13 Oct 2014 14:56:54 +0200 + nagios-snmp-plugins (1.1.1-10) unstable; urgency=medium * [5dbb905] Add support for monitoring-plugins From c68e0e16fdcbedcd33ccf02ce95f3070b43be6c5 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 2 Nov 2014 20:28:34 +0100 Subject: [PATCH 081/205] Create /etc/nagios-plugins/config/ (Closes: #767681) --- debian/changelog | 2 +- debian/dirs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 debian/dirs diff --git a/debian/changelog b/debian/changelog index 8240985..482d78c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,6 @@ nagios-snmp-plugins (1.1.1-11) UNRELEASED; urgency=medium - * + * [dd7632d] Create /etc/nagios-plugins/config/ (Closes: #767681) -- Jan Wagner Mon, 13 Oct 2014 14:56:54 +0200 diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 0000000..9abe0cb --- /dev/null +++ b/debian/dirs @@ -0,0 +1 @@ +etc/nagios-plugins/config From a46fa6f99e9fbb9f9c14c58b6fb2d594547a9bf8 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 2 Nov 2014 20:45:34 +0100 Subject: [PATCH 082/205] Prepare release --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 482d78c..f3f81c3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -nagios-snmp-plugins (1.1.1-11) UNRELEASED; urgency=medium +nagios-snmp-plugins (1.1.1-11) unstable; urgency=medium * [dd7632d] Create /etc/nagios-plugins/config/ (Closes: #767681) - -- Jan Wagner Mon, 13 Oct 2014 14:56:54 +0200 + -- Jan Wagner Sun, 02 Nov 2014 20:45:10 +0100 nagios-snmp-plugins (1.1.1-10) unstable; urgency=medium From 3b007969dfdda7d9163bf23c71697d31e30a67bc Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 2 Nov 2014 21:14:02 +0100 Subject: [PATCH 083/205] New changelog --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index f3f81c3..d0b97a3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +nagios-snmp-plugins (1.1.1-12) UNRELEASED; urgency=medium + + * + + -- Jan Wagner Sun, 02 Nov 2014 21:12:28 +0100 + nagios-snmp-plugins (1.1.1-11) unstable; urgency=medium * [dd7632d] Create /etc/nagios-plugins/config/ (Closes: #767681) From 24809b6741b37b2eb04c0bf6b6ef1dd7d1ee4703 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Tue, 10 Mar 2015 14:12:46 +0100 Subject: [PATCH 084/205] travis-ci: don't install build-deps manual --- .travis.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9c6a506..5016f59 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,8 +12,13 @@ before_install: - sudo apt-get autoremove -qq install: - # install build dependencies - - sudo apt-get install -qq --no-install-recommends debhelper dpatch + # install packages needed for mk-build-deps + - sudo apt-get install -qq --no-install-recommends devscripts equivs + # pull build deps from debian/control + - sudo mk-build-deps -ir + # remove packages needed for mk-build-deps + - sudo apt-get purge -qq equivs + - sudo apt-get autoremove -qq script: # build the debian package From 07c8662ef98d1df2494fb001e0583b7c0c2786b6 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Tue, 10 Mar 2015 15:01:38 +0100 Subject: [PATCH 085/205] travis-ci: build package with dpkg-buildpackage --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5016f59..90c7fe5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ install: script: # build the debian package - - debuild -uc -us + - dpkg-buildpackage -uc -us after_script: # run lintian after build From 82261f2bec4d4872b8ac4b80b4db04864eeaa745 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 15 Mar 2015 17:01:28 +0100 Subject: [PATCH 086/205] travis-ci: Initial support for uploading releases to github --- .travis.yml | 11 ++ debian/bin/github-release.sh | 189 +++++++++++++++++++++++++++++++++++ 2 files changed, 200 insertions(+) create mode 100755 debian/bin/github-release.sh diff --git a/.travis.yml b/.travis.yml index 90c7fe5..ce556be 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,5 +32,16 @@ after_script: # run lintian after build - sudo apt-get install -qq --no-install-recommends lintian - lintian --info --display-info --display-experimental --pedantic --show-overrides ../*.deb && lintian --info --display-info --display-experimental --pedantic --show-overrides ../*.dsc + +env: + global: + # travis encrypt -r waja/nagios-snmp-plugins GITHUBTOKEN=XXXXXX (https://help.github.com/articles/creating-an-access-token-for-command-line-use / http://docs.travis-ci.com/user/encryption-keys/) + secure: "YOPmOpvVg1J5LcP/dT+Dr5q62agttDyc2IgiTdzwLK2iZQwfQ1nQ2+TPf5f6eaA+cqst1n8GCR/SSICio7dQdfMieY+552gySAoZQw+zzLEg/Kkp2eC71DZ6cyPl7HZ7cVzXqvT9kSSN+HaMkeWaFtvjiyGA2PvtrsFJsZlF+EA=" + +after_success: + - mkdir -p debian/build/release/ + - for FILE in $(dcmd ../*.changes); do cp ../$(basename $FILE) debian/build/release/; done + - debian/bin/github-release.sh "$TRAVIS_REPO_SLUG" "debian/`head -1 debian/changelog | awk -F'[()]' '{print $2}' | awk -F'+' '{print $1}'`" debian/build/release/* + #notifications: # email: false diff --git a/debian/bin/github-release.sh b/debian/bin/github-release.sh new file mode 100755 index 0000000..2542112 --- /dev/null +++ b/debian/bin/github-release.sh @@ -0,0 +1,189 @@ +#!/bin/bash + +# Copyright (c) 2014 Terry Burton +# +# https://github.com/terryburton/travis-github-release +# +# Permission is hereby granted, free of charge, to any +# person obtaining a copy of this software and associated +# documentation files (the "Software"), to deal in the +# Software without restriction, including without +# limitation the rights to use, copy, modify, merge, +# publish, distribute, sublicense, and/or sell copies of +# the Software, and to permit persons to whom the Software +# is furnished to do so, subject to the following +# conditions: +# +# The above copyright notice and this permission notice +# shall be included in all copies or substantial portions +# of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +# THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +# PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +# This script provides a simple continuous deployment +# solution that allows Travis CI to publish a new GitHub +# release and upload assets to it whenever an annotated or +# signed tag is pushed (git tag -a/-s; git push --tags). +# +# It is created as a temporary solution whilst we wait for +# Travis DPL to support GitHub: +# +# https://github.com/travis-ci/dpl +# +# Place this script somewhere in your project repository (perhaps by forking +# the github-travis-release repo and adding your fork as a git submodule) then +# put something like this to your .travis.yml: +# +# after_success: .travis/github-release.sh "$TRAVIS_REPO_SLUG" "`head -1 src/VERSION`" build/release/* +# +# The first argument is your repository in the format +# "username/repository", which Travis provides in the +# TRAVIS_REPO_SLUG environment variable. +# +# The second argument is the release version which as a +# sanity check should match the tag that you are releasing. +# You could pass "`git describe`" to satisfy this check. +# +# The remaining arguments are a list of asset files that you +# want to publish along with the release. +# +# The script requires that you create a GitHub OAuth access +# token to facilitate the upload: +# +# https://help.github.com/articles/creating-an-access-token-for-command-line-use +# +# You must pass this securely in the GITHUBTOKEN environment +# variable: +# +# http://docs.travis-ci.com/user/encryption-keys/ +# +# For testing purposes you can create a local convenience +# file in the script directory called GITHUBTOKEN that sets +# the GITHUBTOKEN environment variable. If you do so you MUST +# ensure that this doesn't get pushed to your repository, +# perhaps by adding it to a .gitignore file. +# +# Should you get stuck then look at a working example. This +# code is being used by Barcode Writer in Pure PostScript +# for automated deployment: +# +# https://github.com/terryburton/postscriptbarcode + +set -e + +REPO=$1 && shift +RELEASE=$1 && shift +RELEASEFILES=$@ + +if ! TAG=`git describe --exact-match --all 2>/dev/null`; then + echo "This commit is not a tag so not creating a release" + exit 0 +fi + +if [ "$TRAVIS" = "true" ] && [ -z "$TRAVIS_TAG" ]; then + echo "This build is not for the tag so not creating a release" + exit 0 +fi + +if [ "$TRAVIS" = "true" ] && [ "$TRAVIS_TAG" != "$RELEASE" ]; then + echo "Error: TRAVIS_TAG ($TRAVIS_TAG) does not match the indicated release ($RELEASE)" + exit 1 +fi + +TAG=`echo "$TAG" | sed 's/^tags\///'` +if [ "$TAG" != "$RELEASE" ]; then + echo "Error: The tag ($TAG) does not match the indicated release ($RELEASE)" + exit 1 +fi + +if [[ -z "$RELEASEFILES" ]]; then + echo "Error: No release files provided" + exit 1 +fi + +SCRIPTDIR=`dirname $0` +[ -e "$SCRIPTDIR/GITHUBTOKEN" ] && . "$SCRIPTDIR/GITHUBTOKEN" +if [[ -z "$GITHUBTOKEN" ]]; then + echo "Error: GITHUBTOKEN is not set" + exit 1 +fi + +echo "Creating GitHub release for $RELEASE" + +echo -n "Create draft release... " +JSON=$(cat < Date: Mon, 16 Mar 2015 23:48:24 +0100 Subject: [PATCH 087/205] Merging upstream changes of github-release.sh --- debian/bin/github-release.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/debian/bin/github-release.sh b/debian/bin/github-release.sh index 2542112..79da0c9 100755 --- a/debian/bin/github-release.sh +++ b/debian/bin/github-release.sh @@ -30,8 +30,8 @@ # This script provides a simple continuous deployment # solution that allows Travis CI to publish a new GitHub -# release and upload assets to it whenever an annotated or -# signed tag is pushed (git tag -a/-s; git push --tags). +# release and upload assets to it whenever a tag is pushed: +# git tag; git push --tags # # It is created as a temporary solution whilst we wait for # Travis DPL to support GitHub: @@ -83,7 +83,7 @@ REPO=$1 && shift RELEASE=$1 && shift RELEASEFILES=$@ -if ! TAG=`git describe --exact-match --all 2>/dev/null`; then +if ! TAG=`git describe --exact-match --tags 2>/dev/null`; then echo "This commit is not a tag so not creating a release" exit 0 fi @@ -98,7 +98,6 @@ if [ "$TRAVIS" = "true" ] && [ "$TRAVIS_TAG" != "$RELEASE" ]; then exit 1 fi -TAG=`echo "$TAG" | sed 's/^tags\///'` if [ "$TAG" != "$RELEASE" ]; then echo "Error: The tag ($TAG) does not match the indicated release ($RELEASE)" exit 1 From 76f4f9b381174d7c1b4f24b656408b277106136f Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 18 Mar 2015 21:31:31 +0100 Subject: [PATCH 088/205] Updating copyright and author of debian/bin/github-release.sh --- debian/copyright | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/debian/copyright b/debian/copyright index 71c8915..0eb246b 100644 --- a/debian/copyright +++ b/debian/copyright @@ -11,6 +11,30 @@ Files: debian/* Copyright: Copyright (C) 2006, 2008 Jan Wagner License: GPL-2+ +Files: debian/bin/github-release.sh +Copyright: Copyright (c) 2014 Terry Burton +License: Expat + +License: Expat + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + . + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + License: GPL-2 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 From 9157b9d026c9c4b303bdfb8c69461fda9669dad9 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 8 Apr 2015 16:07:36 +0200 Subject: [PATCH 089/205] Add n5k support to check_snmp_load via 19_check_snmp_load_n5k patch --- debian/patches/19_check_snmp_load_n5k | 97 +++++++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 98 insertions(+) create mode 100644 debian/patches/19_check_snmp_load_n5k diff --git a/debian/patches/19_check_snmp_load_n5k b/debian/patches/19_check_snmp_load_n5k new file mode 100644 index 0000000..6b4c5c6 --- /dev/null +++ b/debian/patches/19_check_snmp_load_n5k @@ -0,0 +1,97 @@ +## 19_check_snmp_load_n5k by Luis I. Perez Villota +## +## DP: Add support for n5k to check_snmp_load.pl + +## From de5ca289b5a696d17bdf0343f53b06ab7f7bbb9b Mon Sep 17 00:00:00 2001 +## From: "Luis I. Perez Villota" +## Date: Wed, 8 Apr 2015 14:18:37 +0200 +## Subject: [PATCH] Add Cisco Nexus Devices capability for load + + Adding CPU Check for Cisco Nexus Devices +--- + plugins/check_snmp_load.pl | 50 ++++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 48 insertions(+), 2 deletions(-) + +diff --git a/plugins/check_snmp_load.pl b/plugins/check_snmp_load.pl +index 6487bde..fd13f71 100755 +--- a/plugins/check_snmp_load.pl ++++ b/plugins/check_snmp_load.pl +@@ -55,6 +55,9 @@ + + my $as400_cpu = "1.3.6.1.4.1.2.6.4.5.1.0"; # AS400 CPU load (10000=100%); + ++# N5K CPU ++my $n5k_cpu = "1.3.6.1.4.1.9.9.305.1.1.1.0"; # N5K CPU load (%) ++ + # Net-SNMP CPU + + my $ns_cpu_idle = "1.3.6.1.4.1.2021.11.11.0"; # Net-snmp cpu idle +@@ -85,9 +88,9 @@ + my $hpux_load_15_min="1.3.6.1.4.1.11.2.3.1.1.5.0"; + + # valid values +-my @valid_types = ("stand","netsc","netsl","as400","cisco","cata","nsc","fg","bc","nokia","hp","lp","hpux"); ++my @valid_types = ("stand","netsc","netsl","as400","cisco","cata","nsc","fg","bc","nokia","hp","lp","hpux","n5k"); + # CPU OID array +-my %cpu_oid = ("netsc",$ns_cpu_idle,"as400",$as400_cpu,"bc",$bluecoat_cpu,"nokia",$nokia_cpu,"hp",$procurve_cpu,"lp",$linkproof_cpu,"fg",$fortigate_cpu); ++my %cpu_oid = ("netsc",$ns_cpu_idle,"as400",$as400_cpu,"bc",$bluecoat_cpu,"nokia",$nokia_cpu,"hp",$procurve_cpu,"lp",$linkproof_cpu,"fg",$fortigate_cpu, "n5k",$n5k_cpu); + + # Globals + +@@ -179,6 +182,7 @@ sub help { + netsc : cpu usage given by net-snmp (100-idle) + as400 : as400 CPU usage + cisco : Cisco CPU usage ++ n5k : Cisco Nexus CPU Usage + cata : Cisco catalyst CPU usage + nsc : NetScreen CPU usage + fg : Fortigate CPU usage +@@ -475,6 +479,48 @@ sub check_options { + exit $exit_val; + } + ++############## Cisco N5K CPU Check ################### ++if ($o_check_type eq "n5k") { ++my @oidlists = ($n5k_cpu); ++my $resultat = (Net::SNMP->VERSION lt 4) ? ++ $session->get_request(@oidlists) ++ : $session->get_request(-varbindlist => \@oidlists); ++if (!defined($resultat)) { ++ printf("ERROR: Description table : %s.\n", $session->error); ++ $session->close; ++ exit $ERRORS{"UNKNOWN"}; ++} ++ ++$session->close; ++if (!defined ($$resultat{$n5k_cpu})) { ++ print "No CPU information : UNKNOWN\n"; ++ exit $ERRORS{"UNKNOWN"}; ++} ++ ++my $n5k_load = $$resultat{$n5k_cpu}; ++if ($n5k_load > $o_crit ) { ++ print "$n5k_load% > $o_crit% : CRITICAL"; ++ $exit_val=$ERRORS{"CRITICAL"}; ++} ++elsif ($n5k_load > $o_warn) { ++ print "$n5k_load% > $o_warn% : WARNING"; ++ $exit_val=$ERRORS{"WARNING"}; ++} ++else{ ++ print "CPU: $n5k_load%"; ++ $exit_val=$ERRORS{"OK"}; ++} ++if (defined($o_perf)) { ++ print " | n5k_load=$n5k_load%"; ++} ++print "\n"; ++exit $exit_val; ++ ++ ++ ++ ++ ++} + ############## Cisco Catalyst CPU check ################ + + if ($o_check_type eq "cata") { diff --git a/debian/patches/series b/debian/patches/series index b0a80a1..ec6ec8b 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -4,5 +4,6 @@ 16_perfdata 17_protocol_fam 18_check_snmp_process_tmp_file +19_check_snmp_load_n5k 50_disable_epn 51_fix_privacy_doc From f4871c4f9f29620d101ee82c5e15deb3d32eb145 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 8 Apr 2015 16:15:24 +0200 Subject: [PATCH 090/205] Refreshing patches/01_update_pre_1.1.2 --- debian/patches/01_update_pre_1.1.2 | 60 +++++++++++---------------- debian/patches/19_check_snmp_load_n5k | 8 ++-- 2 files changed, 28 insertions(+), 40 deletions(-) diff --git a/debian/patches/01_update_pre_1.1.2 b/debian/patches/01_update_pre_1.1.2 index 39dddb3..9a28014 100644 --- a/debian/patches/01_update_pre_1.1.2 +++ b/debian/patches/01_update_pre_1.1.2 @@ -2,9 +2,8 @@ ## ## DP: Update to the latest know CVS verions -diff -Nur nagios_plugins/Changelog plugins/Changelog ---- nagios_plugins/Changelog 2007-04-23 15:15:40.000000000 +0200 -+++ plugins/Changelog 2007-10-20 13:26:06.000000000 +0200 +--- a/Changelog ++++ b/Changelog @@ -1,4 +1,38 @@ ################################ +Release 1.1.2 / Jun 2007 : @@ -44,9 +43,8 @@ diff -Nur nagios_plugins/Changelog plugins/Changelog Release 1.1.1 / April 2007 : Added documentation in doc/ directory : (html format). -diff -Nur nagios_plugins/INSTALL plugins/INSTALL ---- nagios_plugins/INSTALL 1970-01-01 01:00:00.000000000 +0100 -+++ plugins/INSTALL 2007-10-20 13:26:06.000000000 +0200 +--- /dev/null ++++ b/INSTALL @@ -0,0 +1,15 @@ +Installation: +------------- @@ -63,9 +61,8 @@ diff -Nur nagios_plugins/INSTALL plugins/INSTALL +The script will check for dependencies and ask for Nagios and temp directories. +It will modify the scripts depending on these answers and install the scripts. + -diff -Nur nagios_plugins/README plugins/README ---- nagios_plugins/README 2007-04-20 17:04:08.000000000 +0200 -+++ plugins/README 2007-10-20 13:26:06.000000000 +0200 +--- a/README ++++ b/README @@ -1,4 +1,4 @@ -Nagios SNMP plugins 1.1.1 README +Nagios SNMP plugins 1.1.2 README @@ -81,9 +78,8 @@ diff -Nur nagios_plugins/README plugins/README 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 -diff -Nur nagios_plugins/check_snmp_cpfw.pl plugins/check_snmp_cpfw.pl ---- nagios_plugins/check_snmp_cpfw.pl 2007-04-20 00:03:30.000000000 +0200 -+++ plugins/check_snmp_cpfw.pl 2007-10-20 13:26:06.000000000 +0200 +--- a/check_snmp_cpfw.pl ++++ b/check_snmp_cpfw.pl @@ -1,10 +1,11 @@ #!/usr/bin/perl -w ############################## check_snmp_cpfw ############## @@ -245,9 +241,8 @@ diff -Nur nagios_plugins/check_snmp_cpfw.pl plugins/check_snmp_cpfw.pl } print "$f_print\n"; -diff -Nur nagios_plugins/check_snmp_env.pl plugins/check_snmp_env.pl ---- nagios_plugins/check_snmp_env.pl 2007-04-20 11:45:22.000000000 +0200 -+++ plugins/check_snmp_env.pl 2007-10-20 13:26:06.000000000 +0200 +--- a/check_snmp_env.pl ++++ b/check_snmp_env.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl -w ############################## check_snmp_env ################# @@ -372,9 +367,8 @@ diff -Nur nagios_plugins/check_snmp_env.pl plugins/check_snmp_env.pl + +print "Unknown check type : UNKNOWN\n"; +exit $ERRORS{"UNKNOWN"}; -diff -Nur nagios_plugins/check_snmp_int.pl plugins/check_snmp_int.pl ---- nagios_plugins/check_snmp_int.pl 2007-04-23 11:40:39.000000000 +0200 -+++ plugins/check_snmp_int.pl 2007-10-20 13:26:06.000000000 +0200 +--- a/check_snmp_int.pl ++++ b/check_snmp_int.pl @@ -1,13 +1,12 @@ #!/usr/bin/perl -w ############################## check_snmp_int ############## @@ -739,9 +733,8 @@ diff -Nur nagios_plugins/check_snmp_int.pl plugins/check_snmp_int.pl } } } -diff -Nur nagios_plugins/check_snmp_load.pl plugins/check_snmp_load.pl ---- nagios_plugins/check_snmp_load.pl 2007-04-16 19:41:20.000000000 +0200 -+++ plugins/check_snmp_load.pl 2007-10-20 13:26:06.000000000 +0200 +--- a/check_snmp_load.pl ++++ b/check_snmp_load.pl @@ -1,11 +1,10 @@ #!/usr/bin/perl -w ############################## check_snmp_load ################# @@ -778,9 +771,8 @@ diff -Nur nagios_plugins/check_snmp_load.pl plugins/check_snmp_load.pl my $o_host = undef; # hostname my $o_community = undef; # community -diff -Nur nagios_plugins/check_snmp_mem.pl plugins/check_snmp_mem.pl ---- nagios_plugins/check_snmp_mem.pl 2006-07-09 22:52:37.000000000 +0200 -+++ plugins/check_snmp_mem.pl 2007-10-20 13:26:06.000000000 +0200 +--- a/check_snmp_mem.pl ++++ b/check_snmp_mem.pl @@ -1,11 +1,11 @@ #!/usr/bin/perl -w ############################## check_snmp_mem ############## @@ -929,9 +921,8 @@ diff -Nur nagios_plugins/check_snmp_mem.pl plugins/check_snmp_mem.pl verb ("Swap : $$resultat{$nets_swap_free} / $$resultat{$nets_swap_total} : $swapused"); my $n_status="OK"; -diff -Nur nagios_plugins/check_snmp_process.pl plugins/check_snmp_process.pl ---- nagios_plugins/check_snmp_process.pl 2007-03-12 21:36:02.000000000 +0100 -+++ plugins/check_snmp_process.pl 2007-10-20 13:26:06.000000000 +0200 +--- a/check_snmp_process.pl ++++ b/check_snmp_process.pl @@ -1,45 +1,43 @@ #!/usr/bin/perl -w ############################## check_snmp_process ############## @@ -1132,9 +1123,8 @@ diff -Nur nagios_plugins/check_snmp_process.pl plugins/check_snmp_process.pl if ($final_status==2) { exit $ERRORS{"CRITICAL"};} if ($final_status==1) { exit $ERRORS{"WARNING"};} -diff -Nur nagios_plugins/check_snmp_storage.pl plugins/check_snmp_storage.pl ---- nagios_plugins/check_snmp_storage.pl 2007-03-12 22:01:36.000000000 +0100 -+++ plugins/check_snmp_storage.pl 2007-10-20 13:26:06.000000000 +0200 +--- a/check_snmp_storage.pl ++++ b/check_snmp_storage.pl @@ -1,12 +1,12 @@ #!/usr/bin/perl -w ############################## check_snmp_storage ############## @@ -1350,9 +1340,8 @@ diff -Nur nagios_plugins/check_snmp_storage.pl plugins/check_snmp_storage.pl if (!defined ($output)) { $output="All selected storages "; } -diff -Nur nagios_plugins/check_snmp_vrrp.pl plugins/check_snmp_vrrp.pl ---- nagios_plugins/check_snmp_vrrp.pl 2006-08-23 23:39:48.000000000 +0200 -+++ plugins/check_snmp_vrrp.pl 2007-10-20 13:26:06.000000000 +0200 +--- a/check_snmp_vrrp.pl ++++ b/check_snmp_vrrp.pl @@ -1,11 +1,11 @@ #!/usr/bin/perl -w ############################## check_snmp_vrrp ############## @@ -1518,9 +1507,8 @@ diff -Nur nagios_plugins/check_snmp_vrrp.pl plugins/check_snmp_vrrp.pl } # Get the priority $key=$vrrp_prio{$o_type}.".".$vrid[$i]; -diff -Nur nagios_plugins/check_snmp_win.pl plugins/check_snmp_win.pl ---- nagios_plugins/check_snmp_win.pl 2006-11-29 20:59:55.000000000 +0100 -+++ plugins/check_snmp_win.pl 2007-10-20 13:26:06.000000000 +0200 +--- a/check_snmp_win.pl ++++ b/check_snmp_win.pl @@ -1,10 +1,11 @@ #!/usr/bin/perl -w ############################## check_snmp_win ############## diff --git a/debian/patches/19_check_snmp_load_n5k b/debian/patches/19_check_snmp_load_n5k index 6b4c5c6..85b9fba 100644 --- a/debian/patches/19_check_snmp_load_n5k +++ b/debian/patches/19_check_snmp_load_n5k @@ -9,13 +9,13 @@ Adding CPU Check for Cisco Nexus Devices --- - plugins/check_snmp_load.pl | 50 ++++++++++++++++++++++++++++++++++++++++++++-- + check_snmp_load.pl | 50 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) -diff --git a/plugins/check_snmp_load.pl b/plugins/check_snmp_load.pl +diff --git a/check_snmp_load.pl b/check_snmp_load.pl index 6487bde..fd13f71 100755 ---- a/plugins/check_snmp_load.pl -+++ b/plugins/check_snmp_load.pl +--- a/check_snmp_load.pl ++++ b/check_snmp_load.pl @@ -55,6 +55,9 @@ my $as400_cpu = "1.3.6.1.4.1.2.6.4.5.1.0"; # AS400 CPU load (10000=100%); From 4a57e8bec700ae76b78d4d557154b3d0588f3114 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 8 Apr 2015 16:21:53 +0200 Subject: [PATCH 091/205] Refreshing patches/51_fix_privacy_doc --- debian/patches/51_fix_privacy_doc | 32 +++---------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/debian/patches/51_fix_privacy_doc b/debian/patches/51_fix_privacy_doc index cf1de7a..4b4e5ec 100644 --- a/debian/patches/51_fix_privacy_doc +++ b/debian/patches/51_fix_privacy_doc @@ -8,8 +8,6 @@ Date: Sun Mar 2 21:22:42 2014 +0100 Fix potential privacy breach of HTML documentation -diff --git a/doc/faq.html b/doc/faq.html -index 69c3a97..b421495 100755 --- a/doc/faq.html +++ b/doc/faq.html @@ -225,7 +225,7 @@ @@ -21,8 +19,6 @@ index 69c3a97..b421495 100755

-diff --git a/doc/index.html b/doc/index.html -index e58666b..21adf06 100755 --- a/doc/index.html +++ b/doc/index.html @@ -324,7 +324,7 @@ @@ -34,8 +30,6 @@ index e58666b..21adf06 100755

Nagios and the Nagios logo are registered trademarks of Ethan Galstad.

-diff --git a/doc/index_commands.html b/doc/index_commands.html -index 66bac6c..3c8f03a 100755 --- a/doc/index_commands.html +++ b/doc/index_commands.html @@ -109,7 +109,7 @@ @@ -56,8 +50,6 @@ index 66bac6c..3c8f03a 100755

-diff --git a/doc/snmp_cpfw.html b/doc/snmp_cpfw.html -index ac84d46..89bf324 100755 --- a/doc/snmp_cpfw.html +++ b/doc/snmp_cpfw.html @@ -439,7 +439,7 @@ @@ -69,11 +61,9 @@ index ac84d46..89bf324 100755

-diff --git a/doc/snmp_css.html b/doc/snmp_css.html -index 84fe3f4..c581d85 100755 --- a/doc/snmp_css.html +++ b/doc/snmp_css.html -@@ -353,7 +353,7 @@ Usage: ./check_snmp_css_main.pl [-v] -H <host> -C <snmp_community> [ +@@ -353,7 +353,7 @@

This project is hosted on :
@@ -82,8 +72,6 @@ index 84fe3f4..c581d85 100755

-diff --git a/doc/snmp_env.html b/doc/snmp_env.html -index f847bd9..576d6a5 100755 --- a/doc/snmp_env.html +++ b/doc/snmp_env.html @@ -342,7 +342,7 @@ @@ -95,8 +83,6 @@ index f847bd9..576d6a5 100755

-diff --git a/doc/snmp_int.html b/doc/snmp_int.html -index aac15fc..6284623 100755 --- a/doc/snmp_int.html +++ b/doc/snmp_int.html @@ -660,7 +660,7 @@ @@ -108,11 +94,9 @@ index aac15fc..6284623 100755

-diff --git a/doc/snmp_load.html b/doc/snmp_load.html -index 0c48eb8..78697db 100755 --- a/doc/snmp_load.html +++ b/doc/snmp_load.html -@@ -379,7 +379,7 @@ SNMP Load & CPU Monitor for Nagios version 1.3
+@@ -379,7 +379,7 @@

This project is hosted on :
@@ -121,11 +105,9 @@ index 0c48eb8..78697db 100755

-diff --git a/doc/snmp_mem.html b/doc/snmp_mem.html -index 1a51886..c93c185 100755 --- a/doc/snmp_mem.html +++ b/doc/snmp_mem.html -@@ -457,7 +457,7 @@ Usage: ./check_snmp_mem.pl [-v] -H <host> -C <snmp_community> [-2] | +@@ -457,7 +457,7 @@

This project is hosted on :
@@ -134,8 +116,6 @@ index 1a51886..c93c185 100755

-diff --git a/doc/snmp_process.html b/doc/snmp_process.html -index 50c3735..4af115a 100755 --- a/doc/snmp_process.html +++ b/doc/snmp_process.html @@ -332,7 +332,7 @@ @@ -147,8 +127,6 @@ index 50c3735..4af115a 100755

Nagios and the Nagios logo are registered trademarks of Ethan Galstad.

-diff --git a/doc/snmp_storage.html b/doc/snmp_storage.html -index 98bc5e1..14488bf 100755 --- a/doc/snmp_storage.html +++ b/doc/snmp_storage.html @@ -1285,7 +1285,7 @@ @@ -160,8 +138,6 @@ index 98bc5e1..14488bf 100755 -diff --git a/doc/snmp_vrrp.html b/doc/snmp_vrrp.html -index 66e37be..ca8300d 100755 --- a/doc/snmp_vrrp.html +++ b/doc/snmp_vrrp.html @@ -324,7 +324,7 @@ @@ -173,8 +149,6 @@ index 66e37be..ca8300d 100755

-diff --git a/doc/snmp_windows.html b/doc/snmp_windows.html -index 4a8f513..2ae468c 100755 --- a/doc/snmp_windows.html +++ b/doc/snmp_windows.html @@ -243,7 +243,7 @@ From e4c5a528cf65632869a53b6f9216b73e8daa9c8f Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sat, 25 Apr 2015 23:57:18 +0200 Subject: [PATCH 092/205] Adding 20_check_snmp_load_multiple_cpus --- .../patches/20_check_snmp_load_multiple_cpus | 58 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 59 insertions(+) create mode 100644 debian/patches/20_check_snmp_load_multiple_cpus diff --git a/debian/patches/20_check_snmp_load_multiple_cpus b/debian/patches/20_check_snmp_load_multiple_cpus new file mode 100644 index 0000000..5358aa8 --- /dev/null +++ b/debian/patches/20_check_snmp_load_multiple_cpus @@ -0,0 +1,58 @@ +## 19_check_snmp_load_n5k by Luis I. Perez Villota +## +## DP: Add support for n5k to check_snmp_load.pl + +## From 1fcf4f4220edb886fb85931792542d962cf02ecb Mon Sep 17 00:00:00 2001 +## From: Michael Friedrich +## Date: Sat, 25 Apr 2015 15:20:32 +0200 +## Subject: [PATCH] check_snmp_load.pl - Linux load multiple CPUs + +## Linux load doesn't handle multiple CPUs properly. Here is a patch that makes +## the plugin to get the number of CPUs for a particular system and multiply +## warning and critical limits by this number. + +fixes #6 +--- + plugins/check_snmp_load.pl | 19 ++++++++++++++++++- + 1 file changed, 18 insertions(+), 1 deletion(-) + +diff --git a/plugins/check_snmp_load.pl b/plugins/check_snmp_load.pl +index fd13f71..1f29ac5 100755 +--- a/plugins/check_snmp_load.pl ++++ b/plugins/check_snmp_load.pl +@@ -363,6 +363,20 @@ sub check_options { + if ($o_check_type eq "netsl") { + + verb("Checking linux load"); ++ ++# Get number of CPUs ++my $resultat = (Net::SNMP->VERSION < 4) ? ++ $session->get_table($proc_id) ++ : $session->get_table(Baseoid => $proc_id); ++ ++if (!defined($resultat)) { ++ printf("ERROR: Description table : %s.\n", $session->error); ++ $session->close; ++ exit $ERRORS{"UNKNOWN"}; ++} ++ ++my $ncpu = keys %$resultat; ++ + # Get load table + my $resultat = (Net::SNMP->VERSION lt 4) ? + $session->get_table($linload_table) +@@ -397,10 +411,13 @@ sub check_options { + + for (my $i=0;$i<3;$i++) { $load[$i] = $$resultat{$linload_load . "." . $iload[$i]}}; + +-print "Load : $load[0] $load[1] $load[2] :"; ++print "Load (CPUs: $ncpu) : $load[0] $load[1] $load[2] :"; + + $exit_val=$ERRORS{"OK"}; + for (my $i=0;$i<3;$i++) { ++ # Multiply warning and critical levels by the number of CPUs ++ $o_warnL[$i] *= $ncpu; ++ $o_critL[$i] *= $ncpu; + if ( $load[$i] > $o_critL[$i] ) { + print " $load[$i] > $o_critL[$i] : CRITICAL"; + $exit_val=$ERRORS{"CRITICAL"}; diff --git a/debian/patches/series b/debian/patches/series index ec6ec8b..aec3277 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -5,5 +5,6 @@ 17_protocol_fam 18_check_snmp_process_tmp_file 19_check_snmp_load_n5k +20_check_snmp_load_multiple_cpus 50_disable_epn 51_fix_privacy_doc From 434d3d0a40a745854599b98db2dd9f3de7ee686a Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 26 Apr 2015 00:07:29 +0200 Subject: [PATCH 093/205] Fixing pathes in 20_check_snmp_load_multiple_cpus --- debian/patches/20_check_snmp_load_multiple_cpus | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/debian/patches/20_check_snmp_load_multiple_cpus b/debian/patches/20_check_snmp_load_multiple_cpus index 5358aa8..9032868 100644 --- a/debian/patches/20_check_snmp_load_multiple_cpus +++ b/debian/patches/20_check_snmp_load_multiple_cpus @@ -13,13 +13,13 @@ fixes #6 --- - plugins/check_snmp_load.pl | 19 ++++++++++++++++++- +check_snmp_load.pl | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) -diff --git a/plugins/check_snmp_load.pl b/plugins/check_snmp_load.pl +diff --git a/check_snmp_load.pl b/check_snmp_load.pl index fd13f71..1f29ac5 100755 ---- a/plugins/check_snmp_load.pl -+++ b/plugins/check_snmp_load.pl +--- a/check_snmp_load.pl ++++ b/check_snmp_load.pl @@ -363,6 +363,20 @@ sub check_options { if ($o_check_type eq "netsl") { From a31b4284d5e3f9d4f374894ed5518cc2cb4245cb Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 11 May 2015 21:24:35 +0200 Subject: [PATCH 094/205] Fixing 20_check_snmp_load_multiple_cpus Via https://github.com/dnsmichi/manubulon-snmp/commit/000e462c339d9153f930ec4a01acc1ecb024005f.patch --- debian/patches/20_check_snmp_load_multiple_cpus | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/debian/patches/20_check_snmp_load_multiple_cpus b/debian/patches/20_check_snmp_load_multiple_cpus index 9032868..e1a9ce4 100644 --- a/debian/patches/20_check_snmp_load_multiple_cpus +++ b/debian/patches/20_check_snmp_load_multiple_cpus @@ -16,11 +16,9 @@ fixes #6 check_snmp_load.pl | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) -diff --git a/check_snmp_load.pl b/check_snmp_load.pl -index fd13f71..1f29ac5 100755 --- a/check_snmp_load.pl +++ b/check_snmp_load.pl -@@ -363,6 +363,20 @@ sub check_options { +@@ -363,11 +363,25 @@ if ($o_check_type eq "netsl") { verb("Checking linux load"); @@ -39,9 +37,17 @@ index fd13f71..1f29ac5 100755 +my $ncpu = keys %$resultat; + # Get load table - my $resultat = (Net::SNMP->VERSION lt 4) ? +-my $resultat = (Net::SNMP->VERSION lt 4) ? ++$resultat = (Net::SNMP->VERSION lt 4) ? $session->get_table($linload_table) -@@ -397,10 +411,13 @@ sub check_options { +- : $session->get_table(Baseoid => $linload_table); +- ++ : $session->get_table(Baseoid => $linload_table); ++ + if (!defined($resultat)) { + printf("ERROR: Description table : %s.\n", $session->error); + $session->close; +@@ -397,10 +411,13 @@ for (my $i=0;$i<3;$i++) { $load[$i] = $$resultat{$linload_load . "." . $iload[$i]}}; From 672a475f93ea33923894a1a2bd7c1677df5045e0 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Thu, 20 Aug 2015 14:08:52 +0200 Subject: [PATCH 095/205] debian/control: reformating with warp-and-sort --- debian/control | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 344a071..a4f2c4e 100644 --- a/debian/control +++ b/debian/control @@ -11,7 +11,12 @@ Standards-Version: 3.9.6 Package: nagios-snmp-plugins Architecture: all -Depends: ${perl:Depends}, ${misc:Depends}, libnet-snmp-perl, monitoring-plugins-common | nagios-plugins-basic (>= 1.4.5-2), perl-base (>= 5.8.4-8), ucf +Depends: libnet-snmp-perl, + monitoring-plugins-common | nagios-plugins-basic (>= 1.4.5-2), + perl-base (>= 5.8.4-8), + ucf, + ${misc:Depends}, + ${perl:Depends} Recommends: libcrypt-des-perl, libcrypt-rijndael-perl Description: SNMP Plugins for nagios A set of Nagios plugins to check hosts/devices using snmp protocol From bcecc23a6f55811f340a5f4eea60b79f5bb0c81a Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 21 Aug 2015 11:15:33 +0200 Subject: [PATCH 096/205] travis-ci: grab actual used upstream version --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ce556be..ac8354c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ before_install: # installneeded packages for uscan - sudo apt-get install -qq --no-install-recommends devscripts libwww-perl # download original tarball - - uscan --force-download + - UVERSION=$(dpkg-parsechangelog | grep ^Version | cut -d' ' -f2 | cut -d'-' -f1); uscan --verbose --download-version ${UVERSION} --force-download # remove packages needed for uscan - sudo apt-get purge -qq libwww-perl - sudo apt-get autoremove -qq From a8f8669e8253aa3107ab7016a992a9c2fa0260a6 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 2 Oct 2015 09:48:10 +0200 Subject: [PATCH 097/205] Adding patchtes/21_check_snmp_load_abstract_snmp_version_check Via https://github.com/dnsmichi/manubulon-snmp/commit/846165c880793a97a2e727f4d13e23df40e8f1a4.patch --- ...heck_snmp_load_abstract_snmp_version_check | 121 ++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 122 insertions(+) create mode 100644 debian/patches/21_check_snmp_load_abstract_snmp_version_check diff --git a/debian/patches/21_check_snmp_load_abstract_snmp_version_check b/debian/patches/21_check_snmp_load_abstract_snmp_version_check new file mode 100644 index 0000000..21b43e1 --- /dev/null +++ b/debian/patches/21_check_snmp_load_abstract_snmp_version_check @@ -0,0 +1,121 @@ +From 846165c880793a97a2e727f4d13e23df40e8f1a4 Mon Sep 17 00:00:00 2001 +From: morgajel +Date: Wed, 13 May 2015 12:33:21 -0400 +Subject: [PATCH] Abstracted snmp version check to circumvent error and bug + +There are two issues: +1) Net::SNMP changed it's VERSION to be a quoted string rather than a bare mess. This caused +Argument "v6.0.1" isn't numeric in numeric lt (<) at /opt/manubulon/plugins/check_snmp_load.pl line 368. + +2) the rest of the file used lt rather than <, which means they were using ascii sorting rather than digit comparison + +Both of these issues have now been resolved; This fix has only been applied to this one script, but it may +need to be implemented in the other scripts. +--- + check_snmp_load.pl | 30 +++++++++++++++++++++--------- + 1 file changed, 21 insertions(+), 9 deletions(-) + +diff --git a/check_snmp_load.pl b/check_snmp_load.pl +index c8661aa..751c6ec 100755 +--- a/check_snmp_load.pl ++++ b/check_snmp_load.pl +@@ -280,6 +280,18 @@ sub check_options { + } + } + ++# This is required to get around all of the silly historical methods of ++# versioning with Net::SNMP. ++sub is_legacy_snmp_version { ++ my $version=Net::SNMP->VERSION; #using a variable for easier testing ++ if ($version=~/^\D*(\d)/ and $1 < 4){ ++ print "$1 wee"; ++ return 1; ++ }else{ ++ return 0; ++ } ++} ++ + ########## MAIN ####### + + check_options(); +@@ -365,7 +377,7 @@ sub check_options { + verb("Checking linux load"); + + # Get number of CPUs +-my $resultat = (Net::SNMP->VERSION < 4) ? ++my $resultat = (is_legacy_snmp_version()) ? + $session->get_table($proc_id) + : $session->get_table(Baseoid => $proc_id); + +@@ -378,7 +390,7 @@ sub check_options { + my $ncpu = keys %$resultat; + + # Get load table +-$resultat = (Net::SNMP->VERSION lt 4) ? ++$resultat = (is_legacy_snmp_version()) ? + $session->get_table($linload_table) + : $session->get_table(Baseoid => $linload_table); + +@@ -445,7 +457,7 @@ sub check_options { + + if ($o_check_type eq "cisco") { + my @oidlists = ($cisco_cpu_5m, $cisco_cpu_1m, $cisco_cpu_5s); +-my $resultat = (Net::SNMP->VERSION lt 4) ? ++my $resultat = (is_legacy_snmp_version()) ? + $session->get_request(@oidlists) + : $session->get_request(-varbindlist => \@oidlists); + +@@ -499,7 +511,7 @@ sub check_options { + ############## Cisco N5K CPU Check ################### + if ($o_check_type eq "n5k") { + my @oidlists = ($n5k_cpu); +-my $resultat = (Net::SNMP->VERSION lt 4) ? ++my $resultat = (is_legacy_snmp_version()) ? + $session->get_request(@oidlists) + : $session->get_request(-varbindlist => \@oidlists); + if (!defined($resultat)) { +@@ -542,7 +554,7 @@ sub check_options { + + if ($o_check_type eq "cata") { + my @oidlists = ($ciscocata_cpu_5m, $ciscocata_cpu_1m, $ciscocata_cpu_5s); +-my $resultat = (Net::SNMP->VERSION lt 4) ? ++my $resultat = (is_legacy_snmp_version()) ? + $session->get_request(@oidlists) + : $session->get_request(-varbindlist => \@oidlists); + +@@ -597,7 +609,7 @@ sub check_options { + + if ($o_check_type eq "nsc") { + my @oidlists = ($nsc_cpu_5m, $nsc_cpu_1m, $nsc_cpu_5s); +-my $resultat = (Net::SNMP->VERSION lt 4) ? ++my $resultat = (is_legacy_snmp_version()) ? + $session->get_request(@oidlists) + : $session->get_request(-varbindlist => \@oidlists); + +@@ -654,7 +666,7 @@ sub check_options { + # Get load table + my @oidlist = $cpu_oid{$o_check_type}; + verb("Checking OID : @oidlist"); +-my $resultat = (Net::SNMP->VERSION lt 4) ? ++my $resultat = (is_legacy_snmp_version()) ? + $session->get_request(@oidlist) + : $session->get_request(-varbindlist => \@oidlist); + if (!defined($resultat)) { +@@ -702,7 +714,7 @@ sub check_options { + verb("Checking hpux load"); + + my @oidlists = ($hpux_load_1_min, $hpux_load_5_min, $hpux_load_15_min); +-my $resultat = (Net::SNMP->VERSION lt 4) ? ++my $resultat = (is_legacy_snmp_version()) ? + $session->get_request(@oidlists) + : $session->get_request(-varbindlist => \@oidlists); + +@@ -755,7 +767,7 @@ sub check_options { + + ########## Standard cpu usage check ############ + # Get desctiption table +-my $resultat = (Net::SNMP->VERSION lt 4) ? ++my $resultat = (is_legacy_snmp_version()) ? + $session->get_table($base_proc) + : $session->get_table(Baseoid => $base_proc); + diff --git a/debian/patches/series b/debian/patches/series index aec3277..4a942c7 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -6,5 +6,6 @@ 18_check_snmp_process_tmp_file 19_check_snmp_load_n5k 20_check_snmp_load_multiple_cpus +21_check_snmp_load_abstract_snmp_version_check 50_disable_epn 51_fix_privacy_doc From f4e3f51037e58954bfadfdd3a15e9bb82ce3f99e Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 5 Oct 2015 14:54:05 +0200 Subject: [PATCH 098/205] Adding patches/22_remove_utils_pm Via https://github.com/dnsmichi/manubulon-snmp/commit/83795bee374466b865a99af479d7cfa0e1ed1e08.patch (Closes #2) --- debian/patches/22_remove_utils_pm | 509 ++++++++++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 510 insertions(+) create mode 100644 debian/patches/22_remove_utils_pm diff --git a/debian/patches/22_remove_utils_pm b/debian/patches/22_remove_utils_pm new file mode 100644 index 0000000..ce4617d --- /dev/null +++ b/debian/patches/22_remove_utils_pm @@ -0,0 +1,509 @@ +From 83795bee374466b865a99af479d7cfa0e1ed1e08 Mon Sep 17 00:00:00 2001 +From: Michael Friedrich +Date: Mon, 25 May 2015 14:35:53 +0200 +Subject: [PATCH] Get rid of utils.pm entirely + +It's only used for $TIMEOUT and %ERRORS which have +been implemented partly inside the plugins already. + +This commit removes the file, the plugin dir lib +inclusion as well as the install.sh checks entirely. + +Documentation has been updated as well. + +fix #10 +--- + check_snmp_boostedge.pl | 8 ++- + check_snmp_cpfw.pl | 3 +- + check_snmp_css.pl | 9 ++-- + check_snmp_css_main.pl | 9 ++-- + check_snmp_env.pl | 9 ++-- + check_snmp_int.pl | 3 +- + check_snmp_linkproof_nhr.pl | 9 ++-- + check_snmp_load.pl | 3 +- + check_snmp_mem.pl | 3 +- + check_snmp_nsbox.pl | 9 ++-- + check_snmp_process.pl | 3 +- + check_snmp_storage.pl | 9 ++-- + check_snmp_vrrp.pl | 3 +- + check_snmp_win.pl | 5 +- + install.sh | 105 +++++++++++++++--------------------- + utils.pm | 67 ----------------------- + 17 files changed, 75 insertions(+), 192 deletions(-) + delete mode 100644 plugins/utils.pm + +--- a/check_snmp_boostedge.pl ++++ b/check_snmp_boostedge.pl +@@ -16,12 +16,10 @@ + use Net::SNMP; + use Getopt::Long; + +-# Nagios specific ++# Icinga specific + +-use lib "/usr/local/nagios/libexec"; +-use utils qw(%ERRORS $TIMEOUT); +-#my $TIMEOUT = 15; +-#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); ++my $TIMEOUT = 15; ++my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); + + # SNMP Datas + +--- a/check_snmp_cpfw.pl ++++ b/check_snmp_cpfw.pl +@@ -17,8 +17,7 @@ + use Net::SNMP; + use Getopt::Long; + +-# Nagios specific +- ++# Icinga specific + my $TIMEOUT = 15; + my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); + +--- a/check_snmp_css.pl ++++ b/check_snmp_css.pl +@@ -16,12 +16,9 @@ + use Net::SNMP; + use Getopt::Long; + +-# Nagios specific +- +-use lib "/usr/local/nagios/libexec"; +-use utils qw(%ERRORS $TIMEOUT); +-#my $TIMEOUT = 15; +-#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); ++# Icinga specific ++my $TIMEOUT = 15; ++my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); + + # SNMP Datas + +--- a/check_snmp_css_main.pl ++++ b/check_snmp_css_main.pl +@@ -16,12 +16,9 @@ + use Net::SNMP; + use Getopt::Long; + +-# Nagios specific +- +-use lib "/usr/local/nagios/libexec"; +-use utils qw(%ERRORS $TIMEOUT); +-#my $TIMEOUT = 15; +-#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); ++# Icinga specific ++my $TIMEOUT = 15; ++my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); + + # SNMP Datas + +--- a/check_snmp_env.pl ++++ b/check_snmp_env.pl +@@ -16,12 +16,9 @@ + use Net::SNMP; + use Getopt::Long; + +-# Nagios specific +- +-use lib "/usr/local/nagios/libexec"; +-use utils qw(%ERRORS $TIMEOUT); +-#my $TIMEOUT = 15; +-#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); ++# Icinga specific ++my $TIMEOUT = 15; ++my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); + + + my @Nagios_state = ("UNKNOWN","OK","WARNING","CRITICAL"); # Nagios states coding +--- a/check_snmp_int.pl ++++ b/check_snmp_int.pl +@@ -20,8 +20,7 @@ + my $o_base_dir="/tmp/tmp_Nagios_int."; + my $file_history=200; # number of data to keep in files. + +-# Nagios specific +- ++# Icinga specific + my $TIMEOUT = 15; + my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); + +--- a/check_snmp_linkproof_nhr.pl ++++ b/check_snmp_linkproof_nhr.pl +@@ -16,12 +16,9 @@ + use Net::SNMP; + use Getopt::Long; + +-# Nagios specific +- +-use lib "/usr/local/nagios/libexec"; +-use utils qw(%ERRORS $TIMEOUT); +-#my $TIMEOUT = 15; +-#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); ++# Icinga specific ++my $TIMEOUT = 15; ++my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); + + # SNMP Datas + +--- a/check_snmp_load.pl ++++ b/check_snmp_load.pl +@@ -15,8 +15,7 @@ + use Net::SNMP; + use Getopt::Long; + +-# Nagios specific +- ++# Icinga specific + my $TIMEOUT = 15; + my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); + +--- a/check_snmp_mem.pl ++++ b/check_snmp_mem.pl +@@ -16,8 +16,7 @@ + use Net::SNMP; + use Getopt::Long; + +-# Nagios specific +- ++# Icinga specific + my $TIMEOUT = 15; + my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); + +--- a/check_snmp_nsbox.pl ++++ b/check_snmp_nsbox.pl +@@ -16,12 +16,9 @@ + use Net::SNMP; + use Getopt::Long; + +-# Nagios specific +- +-use lib "/usr/local/nagios/libexec"; +-use utils qw(%ERRORS $TIMEOUT); +-#my $TIMEOUT = 15; +-#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); ++# Icinga specific ++my $TIMEOUT = 15; ++my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); + + # SNMP Datas + my $ns_service_status= "1.3.6.1.4.1.14020.2.2.1.3.0"; # service status 1= ok ?? +--- a/check_snmp_process.pl ++++ b/check_snmp_process.pl +@@ -21,8 +21,7 @@ + my $file_history=200; # number of data to keep in files. + my $delta_of_time_to_make_average=300; # 5minutes by default + +-# Nagios specific +- ++# Icinga specific + my $TIMEOUT = 15; + my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); + +--- a/check_snmp_storage.pl ++++ b/check_snmp_storage.pl +@@ -15,12 +15,9 @@ + use Net::SNMP; + use Getopt::Long; + +-# Nagios specific +- +-use lib "/usr/local/nagios/libexec"; +-use utils qw(%ERRORS $TIMEOUT); +-#my $TIMEOUT = 15; +-#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); ++# Icinga specific ++my $TIMEOUT = 15; ++my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); + + # SNMP Datas + my $storage_table= '1.3.6.1.2.1.25.2.3.1'; +--- a/check_snmp_vrrp.pl ++++ b/check_snmp_vrrp.pl +@@ -15,8 +15,7 @@ + use Net::SNMP; + use Getopt::Long; + +-# Nagios specific +- ++# Icinga specific + my $TIMEOUT = 15; + my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); + +--- a/check_snmp_win.pl ++++ b/check_snmp_win.pl +@@ -15,10 +15,7 @@ + use Net::SNMP; + use Getopt::Long; + +-# Nagios specific +- +-#use lib "/usr/local/nagios/libexec"; +-#use utils qw(%ERRORS $TIMEOUT); ++# Icinga specific + my $TIMEOUT = 15; + my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); + +--- a/install.sh ++++ b/install.sh +@@ -12,13 +12,13 @@ + # USAGE : ./install [ | AUTO [] ] + # USAGE : by default all scripts will be installed + # +-# REQUIREMENTS : /bin/bash and sed ++# REQUIREMENTS : /bin/bash and sed + # +-# This script will : ++# This script will: + # - Check perl binary (and asks for path) +-# - Ask for nagios plugin path and checks for file "utils.pm" in it (default /usr/local/nagios/libexec) ++# - Ask for monitoring plugin path (default /usr/local/icinga/libexec) + # - Ask for temporary file location (default /tmp) +-# - Check Net::SNMP version ++# - Check Net::SNMP version + # - Install plugins in the plugins directory and modify paths if necessary. + + ############################ script list +@@ -27,11 +27,11 @@ + + if [ $# -gt 0 ] ; then INSTSCRIPT=$1 ; else INSTSCRIPT="all" ; fi + +-if [ $INSTSCRIPT != "AUTO" ] ; then ++if [ $INSTSCRIPT != "AUTO" ] ; then + ############################ Manual installation +- echo +- echo "###### Nagios snmp scripts installer ######" +- echo ++ echo ++ echo "###### Manubulon snmp scripts installer ######" ++ echo + echo "Will install $INSTSCRIPT script(s)" + echo + +@@ -41,7 +41,7 @@ + PERLHOME=`which perl 2>&1` + if [ $? -ne 0 ]; then PERLHOME="" ; fi + +- PLUGHOME=/usr/local/nagios/libexec ++ PLUGHOME=/usr/local/icinga/libexec + TMPDATA=/tmp + ############################ Checking Perl + +@@ -49,24 +49,24 @@ + read USERPERL + if [ "ZZ$USERPERL" != "ZZ" ]; then PERLHOME=$USERPERL ; fi + +- if [ "z$PERLHOME" == "z" ]; then ++ if [ "z$PERLHOME" == "z" ]; then + echo "Can't find perl binary... exiting" + echo "######### ERROR ########" + exit 1 + fi + + NETSNMP=`$PERLHOME -e 'if (eval "require Net::SNMP") { print "Yes" ;}'` +- if [ $? -ne 0 ] ; then ++ if [ $? -ne 0 ] ; then + echo "Error while checking Net::SNMP module" + echo "######### ERROR ########" +- exit 1; ++ exit 1; + fi + + if [ "zz$NETSNMP" != "zzYes" ]; then + echo "Module Net::SNMP not found!" + echo "Install it with CPAN or manually : http://www.manubulon.com/nagios/faq.html#FAQ2" + echo "######### ERROR ########" +- exit 1; ++ exit 1; + fi + + SNMPVER=`$PERLHOME -e 'require Net::SNMP;print Net::SNMP->VERSION'` +@@ -77,35 +77,28 @@ + echo "Module Getopt::Long not found!" + echo "Install it with CPAN or manually" + echo "######### ERROR ########" +- exit 1; ++ exit 1; + fi + echo "Module Getopt::Long found [OK]" + +- ############################ Check nagios plugin directory and utils.pm ++ ############################ Check monitoring plugin directory + + echo +- echo "What is your nagios plugin location ? " +- echo -n "Note : file utils.pm must be present in it [$PLUGHOME] " ++ echo "What is your monitoring plugin location ? " + read USERPLUG + + if [ "z$USERPLUG" != "z" ]; then PLUGHOME=$USERPLUG ; fi +- if [ ! -d $PLUGHOME ] ; then ++ if [ ! -d $PLUGHOME ] ; then + echo "Directory $PLUGHOME does not exist !" + echo "######### ERROR ########" + exit 1 + fi +- if [ ! -f $PLUGHOME/utils.pm ] ; then +- echo "File $PLUGHOME/utils.pm does not exist !" +- echo "Install it from nagios plugins" +- echo "######### ERROR ########" +- exit 1 +- fi + + ############################ Asking for temp directory + + echo + echo "Where do you want the plugins to put temporary data (only used by some plugins) ? " +- echo -n "Nagios user must be able to write files in it [$TMPDATA] " ++ echo -n "Icinga user must be able to write files in it [$TMPDATA] " + read USERTMP + + if [ "z$USERTMP" != "z" ]; then TMPDATA=$USERTMP ; fi +@@ -119,17 +112,11 @@ + ############################ Looks OK, copying with changes if necessary + + TRANS="" +- # Change '#!/usr/bin/perl -w' ++ # Change '#!/usr/bin/perl -w' + if [ $PERLHOME != "/usr/bin/perl" ] ; then + TRANS="-r -e s#/usr/bin/perl#$PERLHOME#" + fi + +- # Change 'use lib "/usr/local/nagios/libexec";' +- if [ $PLUGHOME != "/usr/local/nagios/libexec" ] ; then +- if [ "z$TRANS" == "z" ]; then TRANS="-r -e s#/usr/local/nagios/libexec#$PLUGHOME#" +- else TRANS="$TRANS -e s#/usr/local/nagios/libexec#$PLUGHOME#";fi +- fi +- + # Change 'my $o_base_dir="/tmp/tmp_Nagios_' + if [ $TMPDATA != "/tmp" ] ; then + if [ "z$TRANS" == "z" ]; then TRANS="-r -e s#/tmp/tmp_Nagios#$TMPDATA/tmp_Nagios#" +@@ -143,11 +130,11 @@ + echo "in directory : $PLUGHOME" + echo "perl : $PERLHOME" + echo "temp directory : $TMPDATA" +- echo ++ echo + echo -n "OK ? [Y/n]" + read INSTOK + +- if [ "$INSTOK" == "n" ]; then ++ if [ "$INSTOK" == "n" ]; then + echo "Aborting....." + echo "######### ERROR ########" + exit 1 +@@ -155,24 +142,24 @@ + + ERROR=0 + +- if [ $INSTSCRIPT == "all" ] ; then ++ if [ $INSTSCRIPT == "all" ] ; then + for i in $PLUGINS ; do +- echo +- if [ ! -f $i ] ; then ++ echo ++ if [ ! -f $i ] ; then + echo "Can't find source file $i : ##### ERROR #####" + else + echo -n "Installing $i : " +- if [ "z$TRANS" == "z" ] ; then ++ if [ "z$TRANS" == "z" ] ; then + cp $i $PLUGHOME/$i 2>&1 + else + sed $TRANS $i > $PLUGHOME/$i 2>&1 + fi +- if [ $? -ne 0 ] ; then +- echo "##### ERROR #####"; +- rm -f $PLUGHOME/$i ++ if [ $? -ne 0 ] ; then ++ echo "##### ERROR #####"; ++ rm -f $PLUGHOME/$i + ERROR=1 +- else +- echo "OK" ++ else ++ echo "OK" + chmod 755 $PLUGHOME/$i 2>&1 + fi + fi +@@ -183,7 +170,7 @@ + echo "Can't find source file $INSTSCRIPT : ##### ERROR #####" + else + echo -n "Installing $INSTSCRIPT : " +- if [ "z$TRANS" == "z" ] ; then ++ if [ "z$TRANS" == "z" ] ; then + cp $INSTSCRIPT > $PLUGHOME/$INSTSCRIPT + else + sed $TRANS $INSTSCRIPT > $PLUGHOME/$INSTSCRIPT 2>&1 +@@ -193,10 +180,10 @@ + rm -f $PLUGHOME/$INSTSCRIPT + ERROR=1 + exit 1; +- else +- echo "OK" ++ else ++ echo "OK" + chmod 755 $PLUGHOME/$INSTSCRIPT 2>&1 +- fi ++ fi + fi + fi + +@@ -208,9 +195,9 @@ + + echo "Installation completed OK" + echo "You can delete all the source files and directory" +- echo "Remember to look for informtation at http://www.manubulon.com/nagios/" ++ echo "Remember to look for informtation at http://www.manubulon.com/nagios/" + exit 0; +- ++ + else + ####################### Silent install with parameters ############ + # PARAM AUTO [] +@@ -221,19 +208,13 @@ + PLUGHOME=$2 + TMPDATA=$3 + INSTALLDIR=$5 +- ++ + TRANS="" +- # Change '#!/usr/bin/perl -w' ++ # Change '#!/usr/bin/perl -w' + if [ $PERLHOME != "/usr/bin/perl" ] ; then + TRANS="-r -e s#/usr/bin/perl#$PERLHOME#" + fi + +- # Change 'use lib "/usr/local/nagios/libexec";' +- if [ $PLUGHOME != "/usr/local/nagios/libexec" ] ; then +- if [ "z$TRANS" == "z" ]; then TRANS="-r -e s#/usr/local/nagios/libexec#$PLUGHOME#" +- else TRANS="$TRANS -e s#/usr/local/nagios/libexec#$PLUGHOME#";fi +- fi +- + # Change 'my $o_base_dir="/tmp/tmp_Nagios_' + if [ $TMPDATA != "/tmp" ] ; then + if [ "z$TRANS" == "z" ]; then TRANS="-r -e s#/tmp/tmp_Nagios#$TMPDATA/tmp_Nagios#" +@@ -246,18 +227,18 @@ + PLUGHOME=$INSTALLDIR + fi + for i in $PLUGINS ; do +- if [ ! -f $i ] ; then ++ if [ ! -f $i ] ; then + ERROR=1 + else +- if [ "z$TRANS" == "z" ] ; then ++ if [ "z$TRANS" == "z" ] ; then + cp $i $PLUGHOME/$i 2>&1 + else + sed $TRANS $i > $PLUGHOME/$i 2>&1 + fi +- if [ $? -ne 0 ] ; then +- rm -f $PLUGHOME/$i ++ if [ $? -ne 0 ] ; then ++ rm -f $PLUGHOME/$i + ERROR=1 +- else ++ else + chmod 755 $PLUGHOME/$i 2>&1 + fi + fi diff --git a/debian/patches/series b/debian/patches/series index 4a942c7..039a33e 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -7,5 +7,6 @@ 19_check_snmp_load_n5k 20_check_snmp_load_multiple_cpus 21_check_snmp_load_abstract_snmp_version_check +22_remove_utils_pm 50_disable_epn 51_fix_privacy_doc From 8dd4f10e7129fa992e82b9bac842c40790014b28 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 5 Oct 2015 15:39:20 +0200 Subject: [PATCH 099/205] Adding patches/23_check_snmp_load_drop_debugging Via https://github.com/dnsmichi/manubulon-snmp/commit/ee92d55bb36208a088a08864cc241e362134e711.patch (Closes #3) --- .../patches/23_check_snmp_load_drop_debugging | 22 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 23 insertions(+) create mode 100644 debian/patches/23_check_snmp_load_drop_debugging diff --git a/debian/patches/23_check_snmp_load_drop_debugging b/debian/patches/23_check_snmp_load_drop_debugging new file mode 100644 index 0000000..3f39c90 --- /dev/null +++ b/debian/patches/23_check_snmp_load_drop_debugging @@ -0,0 +1,22 @@ +From ee92d55bb36208a088a08864cc241e362134e711 Mon Sep 17 00:00:00 2001 +From: casvcasv +Date: Thu, 3 Sep 2015 11:39:44 -0400 +Subject: [PATCH] remove print "$1 wee" from check_snmp_load, apparently used + to test the SNMP version fix + +--- + check_snmp_load.pl | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/check_snmp_load.pl b/check_snmp_load.pl +index d2c49e3..a2a618c 100755 +--- a/check_snmp_load.pl ++++ b/check_snmp_load.pl +@@ -284,7 +284,6 @@ sub check_options { + sub is_legacy_snmp_version { + my $version=Net::SNMP->VERSION; #using a variable for easier testing + if ($version=~/^\D*(\d)/ and $1 < 4){ +- print "$1 wee"; + return 1; + }else{ + return 0; diff --git a/debian/patches/series b/debian/patches/series index 039a33e..8dd63df 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -8,5 +8,6 @@ 20_check_snmp_load_multiple_cpus 21_check_snmp_load_abstract_snmp_version_check 22_remove_utils_pm +23_check_snmp_load_drop_debugging 50_disable_epn 51_fix_privacy_doc From 96dcc5197138eed768c8b0b655291802d72dce26 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 19 Oct 2015 16:23:10 +0200 Subject: [PATCH 100/205] travis-ci: Adding requried arguments for trusty --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index ac8354c..1636864 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,5 @@ +sudo: required +dist: trusty language: c before_install: From 6cbfcfac62974be9208992a8802ffdf89b672fe7 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 19 Oct 2015 16:51:43 +0200 Subject: [PATCH 101/205] travis-ci: automatically install dependencies --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1636864..310303e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ install: # install packages needed for mk-build-deps - sudo apt-get install -qq --no-install-recommends devscripts equivs # pull build deps from debian/control - - sudo mk-build-deps -ir + - sudo mk-build-deps -ir -t "apt-get --yes --no-install-recommends" # remove packages needed for mk-build-deps - sudo apt-get purge -qq equivs - sudo apt-get autoremove -qq From c5e9ec0af1cd3f6c5f13aaa8977f368b9bc43043 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 27 Jan 2016 14:30:34 +0100 Subject: [PATCH 102/205] check_snmp_int: Add patches/24_check_snmp_int_use_ifname (Closes: #812837) --- debian/patches/24_check_snmp_int_use_ifname | 63 +++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 64 insertions(+) create mode 100644 debian/patches/24_check_snmp_int_use_ifname diff --git a/debian/patches/24_check_snmp_int_use_ifname b/debian/patches/24_check_snmp_int_use_ifname new file mode 100644 index 0000000..35a5393 --- /dev/null +++ b/debian/patches/24_check_snmp_int_use_ifname @@ -0,0 +1,63 @@ +From e684d56ab83e86d037403478c7245087e17f63b7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?St=C3=A9phane=20Lapie?= +Date: Wed, 27 Jan 2016 21:47:01 +0900 +Subject: [PATCH] Add the -N/--use-ifname option to switch name lookup from + ifDescr to ifName + +--- + check_snmp_int.pl | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/check_snmp_int.pl b/check_snmp_int.pl +index 4847fd2..a92d6d1 100755 +--- a/check_snmp_int.pl ++++ b/check_snmp_int.pl +@@ -29,6 +29,7 @@ + my $inter_table= '.1.3.6.1.2.1.2.2.1'; + my $index_table = '1.3.6.1.2.1.2.2.1.1'; + my $descr_table = '1.3.6.1.2.1.2.2.1.2'; ++my $name_table = '1.3.6.1.2.1.31.1.1.1.1'; + my $oper_table = '1.3.6.1.2.1.2.2.1.8.'; + my $admin_table = '1.3.6.1.2.1.2.2.1.7.'; + my $speed_table = '1.3.6.1.2.1.2.2.1.5.'; +@@ -79,6 +80,7 @@ + my $o_meg= undef; # output in MBytes or Mbits (-M) + my $o_gig= undef; # output in GBytes or Gbits (-G) + my $o_prct= undef; # output in % of max speed (-u) ++my $o_use_ifname= undef; # use IF-MIB::ifName instead of IF-MIB::ifDescr + + my $o_timeout= undef; # Timeout (Default 5) + # SNMP Message size parameter (Makina Corpus contrib) +@@ -188,6 +190,8 @@ sub help { + Test it before, because there are known bugs (ex : trailling /) + -r, --noregexp + Do not use regexp to match NAME in description OID ++-N, --use-ifname ++ Use IF-MIB::ifName as source for NIC name instead of IF-MIB::ifDescr + -i, --inverse + Make critical when up + -a, --admin +@@ -255,6 +259,7 @@ sub check_options { + 'H:s' => \$o_host, 'hostname:s' => \$o_host, + 'p:i' => \$o_port, 'port:i' => \$o_port, + 'n:s' => \$o_descr, 'name:s' => \$o_descr, ++ 'N' => \$o_use_ifname, 'use-ifname' => \$o_use_ifname, + 'C:s' => \$o_community, 'community:s' => \$o_community, + '2' => \$o_version2, 'v2c' => \$o_version2, + 'l:s' => \$o_login, 'login:s' => \$o_login, +@@ -444,9 +449,13 @@ sub check_options { + verb(" new max octets:: $oct_test"); + } + +-# Get desctiption table ++# Get description table ++my $query_table = $descr_table; ++if (defined($o_use_ifname)) { ++ $query_table = $name_table; ++} + my $resultat = $session->get_table( +- Baseoid => $descr_table ++ Baseoid => $query_table + ); + + if (!defined($resultat)) { diff --git a/debian/patches/series b/debian/patches/series index 8dd63df..1d84e43 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -9,5 +9,6 @@ 21_check_snmp_load_abstract_snmp_version_check 22_remove_utils_pm 23_check_snmp_load_drop_debugging +24_check_snmp_int_use_ifname 50_disable_epn 51_fix_privacy_doc From d8d6d1b63a1fb2fdcacdc181d8c6f11fe438b0cf Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 27 Jan 2016 14:40:52 +0100 Subject: [PATCH 103/205] d/rules: Use dh_prep instead of 'dh_clean -k' --- debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index c7ef9c2..0cb097b 100755 --- a/debian/rules +++ b/debian/rules @@ -26,7 +26,7 @@ clean: install: build dh_testdir dh_testroot - dh_clean -k + dh_prep dh_installdirs # Add here commands to install the package into debian/nagios-snmp-plugins. From e4a1040f10d2411d0a4ad42c97b5b82554850be5 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 27 Jan 2016 16:27:34 +0100 Subject: [PATCH 104/205] Prepare release --- debian/changelog | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index d0b97a3..5121cb0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,29 @@ -nagios-snmp-plugins (1.1.1-12) UNRELEASED; urgency=medium +nagios-snmp-plugins (1.1.1-12) sid; urgency=medium - * + * [24809b6] travis-ci: don't install build-deps manual + * [07c8662] travis-ci: build package with dpkg-buildpackage + * [82261f2] travis-ci: Initial support for uploading releases to github + * [94da9a0] Merging upstream changes of github-release.sh + * [76f4f9b] Updating copyright and author of debian/bin/github-release.sh + * [9157b9d] Add n5k support to check_snmp_load via + 19_check_snmp_load_n5k patch + * [f4871c4] Refreshing patches/01_update_pre_1.1.2 + * [4a57e8b] Refreshing patches/51_fix_privacy_doc + * [e4c5a52] Adding 20_check_snmp_load_multiple_cpus + * [434d3d0] Fixing pathes in 20_check_snmp_load_multiple_cpus + * [a31b428] Fixing 20_check_snmp_load_multiple_cpus + * [672a475] debian/control: reformating with warp-and-sort + * [bcecc23] travis-ci: grab actual used upstream version + * [a8f8669] Adding patchtes/21_check_snmp_load_abstract_snmp_version_check + * [f4e3f51] Adding patches/22_remove_utils_pm + * [8dd4f10] Adding patches/23_check_snmp_load_drop_debugging + * [96dcc51] travis-ci: Adding required arguments for trusty + * [6cbfcfa] travis-ci: automatically install dependencies + * [c5e9ec0] check_snmp_int: Add patches/24_check_snmp_int_use_ifname + (Closes: #812837) + * [d8d6d1b] d/rules: Use dh_prep instead of 'dh_clean -k' - -- Jan Wagner Sun, 02 Nov 2014 21:12:28 +0100 + -- Jan Wagner Wed, 27 Jan 2016 16:23:36 +0100 nagios-snmp-plugins (1.1.1-11) unstable; urgency=medium From e1970ea767c234763a4a28b741971e5f76a924a9 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 27 Jan 2016 16:41:53 +0100 Subject: [PATCH 105/205] Fix suite --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 5121cb0..90b98b0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -nagios-snmp-plugins (1.1.1-12) sid; urgency=medium +nagios-snmp-plugins (1.1.1-12) unstable; urgency=medium * [24809b6] travis-ci: don't install build-deps manual * [07c8662] travis-ci: build package with dpkg-buildpackage From 2e752907e77ac04e80faf9491467008c7920e77e Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 27 Jan 2016 16:56:12 +0100 Subject: [PATCH 106/205] New changelog --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 90b98b0..a50440d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +nagios-snmp-plugins (1.1.1-13) UNRELEASED; urgency=medium + + * + + -- Jan Wagner Wed, 27 Jan 2016 16:56:06 +0100 + nagios-snmp-plugins (1.1.1-12) unstable; urgency=medium * [24809b6] travis-ci: don't install build-deps manual From 2d8f7ffaf9567f4377a813dba8060dca61ce7082 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 14 Nov 2016 00:30:39 +0100 Subject: [PATCH 107/205] d/control: Bump Standards-Version to 3.9.8, no changes needed --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index a4f2c4e..980a3b0 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Build-Depends: debhelper (>= 5) Homepage: http://www.manubulon.com/nagios/index_snmp.html Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-nagios/pkg-nagios-snmp-plugins.git Vcs-Git: git://anonscm.debian.org/pkg-nagios/pkg-nagios-snmp-plugins -Standards-Version: 3.9.6 +Standards-Version: 3.9.8 Package: nagios-snmp-plugins Architecture: all From 2bf53ed0d5e92a50adfdeff4fd85bd55fd4ca633 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 14 Nov 2016 00:31:40 +0100 Subject: [PATCH 108/205] d/changelog: Fixing typos --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index a50440d..0d2cc13 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,7 +16,7 @@ nagios-snmp-plugins (1.1.1-12) unstable; urgency=medium * [f4871c4] Refreshing patches/01_update_pre_1.1.2 * [4a57e8b] Refreshing patches/51_fix_privacy_doc * [e4c5a52] Adding 20_check_snmp_load_multiple_cpus - * [434d3d0] Fixing pathes in 20_check_snmp_load_multiple_cpus + * [434d3d0] Fixing paths in 20_check_snmp_load_multiple_cpus * [a31b428] Fixing 20_check_snmp_load_multiple_cpus * [672a475] debian/control: reformating with warp-and-sort * [bcecc23] travis-ci: grab actual used upstream version From caf8f93cab5f4f71b63264e5edd345c165c3de0b Mon Sep 17 00:00:00 2001 From: Bas Couwenberg Date: Sat, 3 Dec 2016 23:56:44 +0100 Subject: [PATCH 109/205] Update Vcs-* URLs to use HTTPS, use cgit instead of gitweb for Vcs-Browser URL. --- debian/control | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/control b/debian/control index 980a3b0..fd5c11a 100644 --- a/debian/control +++ b/debian/control @@ -5,8 +5,8 @@ Maintainer: Debian Nagios Maintainer Group Build-Depends: debhelper (>= 5) Homepage: http://www.manubulon.com/nagios/index_snmp.html -Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-nagios/pkg-nagios-snmp-plugins.git -Vcs-Git: git://anonscm.debian.org/pkg-nagios/pkg-nagios-snmp-plugins +Vcs-Browser: https://anonscm.debian.org/cgit/pkg-nagios/pkg-nagios-snmp-plugins.git +Vcs-Git: https://anonscm.debian.org/git/pkg-nagios/pkg-nagios-snmp-plugins Standards-Version: 3.9.8 Package: nagios-snmp-plugins From 1eca1c0377fc2f403ad3bf96b211ac15709f4e17 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 18 Nov 2016 18:09:31 +0100 Subject: [PATCH 110/205] travis-ci: Make use of travis.d.n --- .travis.yml | 66 +++++++++++++++++++---------------------------------- 1 file changed, 24 insertions(+), 42 deletions(-) diff --git a/.travis.yml b/.travis.yml index 310303e..39c4c32 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,49 +1,31 @@ sudo: required -dist: trusty -language: c - -before_install: - # update package list - - sudo apt-get update -qq - # installneeded packages for uscan - - sudo apt-get install -qq --no-install-recommends devscripts libwww-perl - # download original tarball - - UVERSION=$(dpkg-parsechangelog | grep ^Version | cut -d' ' -f2 | cut -d'-' -f1); uscan --verbose --download-version ${UVERSION} --force-download - # remove packages needed for uscan - - sudo apt-get purge -qq libwww-perl - - sudo apt-get autoremove -qq - -install: - # install packages needed for mk-build-deps - - sudo apt-get install -qq --no-install-recommends devscripts equivs - # pull build deps from debian/control - - sudo mk-build-deps -ir -t "apt-get --yes --no-install-recommends" - # remove packages needed for mk-build-deps - - sudo apt-get purge -qq equivs - - sudo apt-get autoremove -qq - -script: - # build the debian package - - dpkg-buildpackage -uc -us - -after_script: - # run lintian after build - - sudo add-apt-repository -y ppa:waja/precise-backports - - sudo apt-get update -qq - - sudo apt-get install -qq --no-install-recommends lintian - # run lintian after build - - sudo apt-get install -qq --no-install-recommends lintian - - lintian --info --display-info --display-experimental --pedantic --show-overrides ../*.deb && lintian --info --display-info --display-experimental --pedantic --show-overrides ../*.dsc env: - global: - # travis encrypt -r waja/nagios-snmp-plugins GITHUBTOKEN=XXXXXX (https://help.github.com/articles/creating-an-access-token-for-command-line-use / http://docs.travis-ci.com/user/encryption-keys/) - secure: "YOPmOpvVg1J5LcP/dT+Dr5q62agttDyc2IgiTdzwLK2iZQwfQ1nQ2+TPf5f6eaA+cqst1n8GCR/SSICio7dQdfMieY+552gySAoZQw+zzLEg/Kkp2eC71DZ6cyPl7HZ7cVzXqvT9kSSN+HaMkeWaFtvjiyGA2PvtrsFJsZlF+EA=" + - TRAVIS_DEBIAN_DISTRIBUTION=unstable TRAVIS_DEBIAN_MIRROR="http://httpredir.debian.org/debian/" TRAVIS_DEBIAN_SECURITY_UPDATES=false + - TRAVIS_DEBIAN_DISTRIBUTION=testing TRAVIS_DEBIAN_MIRROR="http://httpredir.debian.org/debian/" + - TRAVIS_DEBIAN_DISTRIBUTION=stable TRAVIS_DEBIAN_MIRROR="http://httpredir.debian.org/debian/" -after_success: - - mkdir -p debian/build/release/ - - for FILE in $(dcmd ../*.changes); do cp ../$(basename $FILE) debian/build/release/; done - - debian/bin/github-release.sh "$TRAVIS_REPO_SLUG" "debian/`head -1 debian/changelog | awk -F'[()]' '{print $2}' | awk -F'+' '{print $1}'`" debian/build/release/* +services: + - docker + +before_script: + # fetch all tags (not done due travis cloning with depth=50) + - git fetch --tags + +script: + # build the debian package + - wget -O- http://travis.debian.net/script.sh | sh - + +after_script: + # run lintian after build + - sudo add-apt-repository -y ppa:waja/trusty-backports + - sudo apt-get update -qq + - sudo apt-get install -qq --no-install-recommends lintian + - lintian --info --display-info --display-experimental --pedantic --show-overrides ../*.deb && lintian --info --display-info --display-experimental --pedantic --show-overrides ../*.dsc #notifications: # email: false + +branches: + except: + - /^debian\/\d/ From 9c06100871f8318bdfe938844b07d12a5232f9d0 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 4 Dec 2016 11:31:25 +0100 Subject: [PATCH 111/205] New upstream version 2.0.0 --- .perltidyrc | 28 + README.md | 56 + check_snmp_boostedge.pl | 320 --- check_snmp_cpfw.pl | 555 ----- check_snmp_css.pl | 480 ---- check_snmp_css_main.pl | 266 --- check_snmp_env.pl | 1006 -------- check_snmp_int.pl | 800 ------- check_snmp_linkproof_nhr.pl | 319 --- check_snmp_load.pl | 731 ------ check_snmp_mem.pl | 525 ----- check_snmp_nsbox.pl | 351 --- check_snmp_process.pl | 668 ------ check_snmp_storage.pl | 642 ------ check_snmp_vrrp.pl | 451 ---- check_snmp_win.pl | 381 ---- doc/html/README.md | 6 + doc/html/nagios.manubulon.com/faq.html | 315 +++ .../nagios.manubulon.com/img/sideback.jpg | Bin 0 -> 1083 bytes .../nagios.manubulon.com/img/smalllogo7.jpg | Bin 0 -> 5338 bytes doc/html/nagios.manubulon.com/index.html | 352 +++ .../nagios.manubulon.com/index_commands.html | 2028 +++++++++++++++++ doc/html/nagios.manubulon.com/index_info.html | 604 +++++ .../nagios.manubulon.com/index_snmp.html} | 789 ++++--- doc/html/nagios.manubulon.com/nagios_cert.cer | 22 + .../nagios.manubulon.com/p1-print.pl.patch | 38 + doc/html/nagios.manubulon.com/package_c.html | 192 ++ doc/html/nagios.manubulon.com/robots.txt | 1 + .../nagios.manubulon.com}/snmp_cpfw.html | 942 ++++---- .../nagios.manubulon.com}/snmp_css.html | 762 +++---- .../nagios.manubulon.com}/snmp_env.html | 740 +++--- doc/html/nagios.manubulon.com/snmp_int.html | 717 ++++++ doc/html/nagios.manubulon.com/snmp_load.html | 409 ++++ doc/html/nagios.manubulon.com/snmp_mem.html | 485 ++++ .../nagios.manubulon.com}/snmp_process.html | 731 +++--- .../nagios.manubulon.com/snmp_storage.html | 1336 +++++++++++ doc/html/nagios.manubulon.com/snmp_vrrp.html | 382 ++++ .../nagios.manubulon.com/snmp_windows.html | 261 +++ icingaexchange.yml | 8 + Changelog => plugins/Changelog | 34 + plugins/INSTALL | 15 + LICENSE => plugins/LICENSE | 0 README => plugins/README | 4 +- plugins/check_snmp_boostedge.pl | 371 +++ plugins/check_snmp_cpfw.pl | 604 +++++ plugins/check_snmp_css.pl | 551 +++++ plugins/check_snmp_css_main.pl | 306 +++ plugins/check_snmp_env.pl | 1111 +++++++++ plugins/check_snmp_int.pl | 1005 ++++++++ plugins/check_snmp_linkproof_nhr.pl | 363 +++ plugins/check_snmp_load.pl | 900 ++++++++ plugins/check_snmp_mem.pl | 626 +++++ plugins/check_snmp_nsbox.pl | 406 ++++ plugins/check_snmp_process.pl | 848 +++++++ plugins/check_snmp_storage.pl | 810 +++++++ plugins/check_snmp_vrrp.pl | 525 +++++ plugins/check_snmp_win.pl | 428 ++++ {doc => plugins/doc}/faq.html | 17 +- plugins/doc/index.html | 431 ++++ {doc => plugins/doc}/index_commands.html | 0 plugins/doc/snmp_cpfw.html | 471 ++++ plugins/doc/snmp_css.html | 381 ++++ plugins/doc/snmp_env.html | 370 +++ {doc => plugins/doc}/snmp_int.html | 87 +- {doc => plugins/doc}/snmp_load.html | 4 +- {doc => plugins/doc}/snmp_mem.html | 2 +- plugins/doc/snmp_process.html | 377 +++ {doc => plugins/doc}/snmp_storage.html | 93 +- {doc => plugins/doc}/snmp_vrrp.html | 0 {doc => plugins/doc}/snmp_windows.html | 0 install.sh => plugins/install.sh | 117 +- 71 files changed, 20366 insertions(+), 9590 deletions(-) create mode 100644 .perltidyrc create mode 100644 README.md delete mode 100755 check_snmp_boostedge.pl delete mode 100755 check_snmp_cpfw.pl delete mode 100755 check_snmp_css.pl delete mode 100755 check_snmp_css_main.pl delete mode 100755 check_snmp_env.pl delete mode 100755 check_snmp_int.pl delete mode 100755 check_snmp_linkproof_nhr.pl delete mode 100755 check_snmp_load.pl delete mode 100755 check_snmp_mem.pl delete mode 100755 check_snmp_nsbox.pl delete mode 100755 check_snmp_process.pl delete mode 100755 check_snmp_storage.pl delete mode 100755 check_snmp_vrrp.pl delete mode 100755 check_snmp_win.pl create mode 100644 doc/html/README.md create mode 100644 doc/html/nagios.manubulon.com/faq.html create mode 100644 doc/html/nagios.manubulon.com/img/sideback.jpg create mode 100644 doc/html/nagios.manubulon.com/img/smalllogo7.jpg create mode 100644 doc/html/nagios.manubulon.com/index.html create mode 100644 doc/html/nagios.manubulon.com/index_commands.html create mode 100644 doc/html/nagios.manubulon.com/index_info.html rename doc/{index.html => html/nagios.manubulon.com/index_snmp.html} (74%) mode change 100755 => 100644 create mode 100644 doc/html/nagios.manubulon.com/nagios_cert.cer create mode 100644 doc/html/nagios.manubulon.com/p1-print.pl.patch create mode 100644 doc/html/nagios.manubulon.com/package_c.html create mode 100644 doc/html/nagios.manubulon.com/robots.txt rename doc/{ => html/nagios.manubulon.com}/snmp_cpfw.html (95%) mode change 100755 => 100644 rename doc/{ => html/nagios.manubulon.com}/snmp_css.html (96%) mode change 100755 => 100644 rename doc/{ => html/nagios.manubulon.com}/snmp_env.html (96%) mode change 100755 => 100644 create mode 100644 doc/html/nagios.manubulon.com/snmp_int.html create mode 100644 doc/html/nagios.manubulon.com/snmp_load.html create mode 100644 doc/html/nagios.manubulon.com/snmp_mem.html rename doc/{ => html/nagios.manubulon.com}/snmp_process.html (84%) mode change 100755 => 100644 create mode 100644 doc/html/nagios.manubulon.com/snmp_storage.html create mode 100644 doc/html/nagios.manubulon.com/snmp_vrrp.html create mode 100644 doc/html/nagios.manubulon.com/snmp_windows.html create mode 100644 icingaexchange.yml rename Changelog => plugins/Changelog (66%) create mode 100644 plugins/INSTALL rename LICENSE => plugins/LICENSE (100%) rename README => plugins/README (94%) create mode 100755 plugins/check_snmp_boostedge.pl create mode 100755 plugins/check_snmp_cpfw.pl create mode 100755 plugins/check_snmp_css.pl create mode 100755 plugins/check_snmp_css_main.pl create mode 100755 plugins/check_snmp_env.pl create mode 100755 plugins/check_snmp_int.pl create mode 100755 plugins/check_snmp_linkproof_nhr.pl create mode 100755 plugins/check_snmp_load.pl create mode 100755 plugins/check_snmp_mem.pl create mode 100755 plugins/check_snmp_nsbox.pl create mode 100755 plugins/check_snmp_process.pl create mode 100755 plugins/check_snmp_storage.pl create mode 100755 plugins/check_snmp_vrrp.pl create mode 100755 plugins/check_snmp_win.pl rename {doc => plugins/doc}/faq.html (84%) create mode 100755 plugins/doc/index.html rename {doc => plugins/doc}/index_commands.html (100%) create mode 100755 plugins/doc/snmp_cpfw.html create mode 100755 plugins/doc/snmp_css.html create mode 100755 plugins/doc/snmp_env.html rename {doc => plugins/doc}/snmp_int.html (88%) rename {doc => plugins/doc}/snmp_load.html (96%) rename {doc => plugins/doc}/snmp_mem.html (99%) create mode 100755 plugins/doc/snmp_process.html rename {doc => plugins/doc}/snmp_storage.html (85%) rename {doc => plugins/doc}/snmp_vrrp.html (100%) rename {doc => plugins/doc}/snmp_windows.html (100%) rename install.sh => plugins/install.sh (69%) diff --git a/.perltidyrc b/.perltidyrc new file mode 100644 index 0000000..a210e84 --- /dev/null +++ b/.perltidyrc @@ -0,0 +1,28 @@ +## basic options +--maximum-line-length=120 +--indent-columns=4 + +## code indentation control +--continuation-indentation=4 + +## whilespace control +--paren-tightness=2 +--square-bracket-tightness=2 +--block-brace-tightness=0 +--nospace-for-semicolon +#--add-semicolons +--nospace-function-paren + +## line break control +--cuddled-else + +#--closing-token-indentation=0 +#--nooutdent-long-quotes +#--nooutdent-labels +#--brace-tightness=1 +#--vertical-tightness=0 +#--stack-opening-tokens +#--stack-closing-tokens +--want-break-before="% + - * / x != == >= <= =~ !~ < > | & = **= += *= &= <<= &&= -= /= |= >>= ||= //= .= %= ^= x=" +#--format-skipping-begin="#+\s*no tidy" +#--format-skipping-end="#+\s*tidy" diff --git a/README.md b/README.md new file mode 100644 index 0000000..6f04d77 --- /dev/null +++ b/README.md @@ -0,0 +1,56 @@ +# Manubulon SNMP Plugins + +## General information + +Manubulon SNMP plugins is a set of Icinga/Nagios plugins +to check hosts/devices using the SNMP protocol. Check +[http://nagios.manubulon.com](http://nagios.manubulon.com) for more details. + +This is a fork using a [cvs2git import](http://sourceforge.net/projects/nagios-snmp/develop) which includes community patches. + +The original project was last active in 2007 so this project +helps collect all patches and feature requests. + +Feel free to use & distribute it under the original license. + +## Requirements + +* perl in /usr/bin/perl +* Perl modules `Net::SNMP` and `Getopt::Long` (RHEL: `perl-Net-SNMP perl-Getopt-Long`) +* `icinga` user able to write files in /tmp/ directory + +Perl, default directory and temp files location can be changed using the install.sh script. + +`utils.pm` from `Monitoring::Plugin::Perl` is no longer required. + +## Documentation + +The original documentation and sourcecode is located at +[http://nagios.manubulon.com](http://nagios.manubulon.com). +A website copy was added underneath the `doc/` directory. + +## Support + +You may create [GitHub issues](https://github.com/dnsmichi/manubulon-snmp) +as well. I do have a lot of things on my plate so best is to send in a tested (!) patch at the same time. + +If you want to help maintain this project, just contact +me on [twitter](https://twitter.com/dnsmichi) and I'll +happily grant commit access. + +You may head over to [monitoring-portal.org community](http://www.monitoring-portal.org) +for questions and feedback. + +The original support tracker is still located on [sourceforge](https://sourceforge.net/p/nagios-snmp/feature-requests/). + +## Development + +Fork this repository on Github and send in a PR. + +There's a `.perltidyrc` file in the main repository tree. If you are uncertain about the coding style, +create your patch and then run: + + $ perltidy -b plugins/*.pl + +This requires the `perltidy` module being installed. + diff --git a/check_snmp_boostedge.pl b/check_snmp_boostedge.pl deleted file mode 100755 index 3978e1f..0000000 --- a/check_snmp_boostedge.pl +++ /dev/null @@ -1,320 +0,0 @@ -#!/usr/bin/perl -w -############################## check_snmp_boostedge.pl ################# -# Version : 1.0 -# Date : Jan 16 2007 -# Author : Patrick Proy ( patrick at proy.org) -# Help : http://www.manubulon.com/nagios/ -# Licence : GPL - http://www.fsf.org/licenses/gpl.txt -# Changelog : -# Contributors : -################################################################# -# -# Help : ./check_snmp_boostedge.pl -h -# - -use strict; -use Net::SNMP; -use Getopt::Long; - -# Nagios specific - -use lib "/usr/local/nagios/libexec"; -use utils qw(%ERRORS $TIMEOUT); -#my $TIMEOUT = 15; -#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - -# SNMP Datas - -my $be_global_status= "1.3.6.1.4.1.4185.12.1.1.3.0"; # boostedge global status (stop(0), start(1)) - -my $be_service_number= "1.3.6.1.4.1.4185.12.1.5.1.0"; # beServiceNumber - -my $be_service_table= "1.3.6.1.4.1.4185.12.1.5"; # beServices -my $be_service_name= "1.3.6.1.4.1.4185.12.1.5.2.1.2"; # beServiceName -my $be_service_status= "1.3.6.1.4.1.4185.12.1.5.2.1.4"; # status ("RUNNING") -my $be_service_mode= "1.3.6.1.4.1.4185.12.1.5.2.1.5"; # beServiceMode (disabled(0), enabled(1)) -my $be_service_datain= "1.3.6.1.4.1.4185.12.1.5.2.1.6"; # beServiceDataIn (Not populated for now : HTTP/S - V5.2.16.0) -my $be_service_dataout= "1.3.6.1.4.1.4185.12.1.5.2.1.7"; # beServiceDataOut (Not populated for now : HTTP/S - V5.2.16.0) -my $be_service_connect= "1.3.6.1.4.1.4185.12.1.5.2.1.8"; # beServiceConnect (Not populated for now : HTTP/S - V5.2.16.0) - - -# Globals - -my $Version='1.0'; - -my $o_host = undef; # hostname -my $o_community = undef; # community -my $o_port = 161; # port -my $o_help= undef; # wan't some help ? -my $o_verb= undef; # verbose mode -my $o_version= undef; # print version -my $o_timeout= undef; # Timeout (Default 5) -my $o_perf= undef; # Output performance data -my $o_version2= undef; # use snmp v2c -# Specific -my $o_service= undef; # service regexp selection -my $o_nservice= undef; # service number expected - -# SNMPv3 specific -my $o_login= undef; # Login for snmpv3 -my $o_passwd= undef; # Pass for snmpv3 -my $v3protocols=undef; # V3 protocol list. -my $o_authproto='md5'; # Auth protocol -my $o_privproto='des'; # Priv protocol -my $o_privpass= undef; # priv password - -# functions - -sub p_version { print "check_snmp_boostedge version : $Version\n"; } - -sub print_usage { - print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) -s -n [-p ] [-f] [-t ] [-V]\n"; -} - -sub isnnum { # Return true if arg is not a number - my $num = shift; - if ( $num =~ /^(\d+\.?\d*)|(^\.\d+)$/ ) { return 0 ;} - return 1; -} - -sub set_status { # return worst status with this order : OK, unknwonw, warning, critical - my $new_status=shift; - my $cur_status=shift; - if (($cur_status == 0)|| ($new_status==$cur_status)){ return $new_status; } - if ($new_status==3) { return $cur_status; } - if ($new_status > $cur_status) {return $new_status;} - return $cur_status; -} - -sub is_pattern_valid { # Test for things like "" or "+5-i" - my $pat = shift; - if (!defined($pat)) { $pat=" ";} # Just to get rid of compilation time warnings - return eval { "" =~ /$pat/; 1 } || 0; -} - -sub help { - print "\nSNMP Boostedge service monitor for Nagios version ",$Version,"\n"; - print "GPL Licensen, (c)2006-2007 Patrick Proy\n\n"; - print_usage(); - print < - Regexp of service to select --n, --number= - Number of services selected that must be in running & enabled state --2, --v2c - Use snmp v2c --l, --login=LOGIN ; -x, --passwd=PASSWD - Login and auth password for snmpv3 authentication - If no priv password exists, implies AuthNoPriv --X, --privpass=PASSWD - Priv password for snmpv3 (AuthPriv protocol) --L, --protocols=, - : Authentication protocol (md5|sha : default md5) - : Priv protocole (des|aes : default des) --P, --port=PORT - SNMP port (Default 161) --f, --perfparse - Perfparse compatible output --t, --timeout=INTEGER - timeout for SNMP in seconds (Default: 5) --V, --version - prints version number -EOT -} - -# For verbose output -sub verb { my $t=shift; print $t,"\n" if defined($o_verb) ; } - -sub check_options { - Getopt::Long::Configure ("bundling"); - GetOptions( - 'v' => \$o_verb, 'verbose' => \$o_verb, - 'h' => \$o_help, 'help' => \$o_help, - 'H:s' => \$o_host, 'hostname:s' => \$o_host, - 'p:i' => \$o_port, 'port:i' => \$o_port, - 'C:s' => \$o_community, 'community:s' => \$o_community, - 'l:s' => \$o_login, 'login:s' => \$o_login, - 'x:s' => \$o_passwd, 'passwd:s' => \$o_passwd, - 'X:s' => \$o_privpass, 'privpass:s' => \$o_privpass, - 'L:s' => \$v3protocols, 'protocols:s' => \$v3protocols, - 't:i' => \$o_timeout, 'timeout:i' => \$o_timeout, - 'V' => \$o_version, 'version' => \$o_version, - '2' => \$o_version2, 'v2c' => \$o_version2, - 'f' => \$o_perf, 'perfparse' => \$o_perf, - 's:s' => \$o_service, 'service:s' => \$o_service, - 'n:i' => \$o_nservice, 'number:i' => \$o_nservice - ); - # Basic checks - if (defined($o_timeout) && (isnnum($o_timeout) || ($o_timeout < 2) || ($o_timeout > 60))) - { print "Timeout must be >1 and <60 !\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if (!defined($o_timeout)) {$o_timeout=5;} - if (defined ($o_help) ) { help(); exit $ERRORS{"UNKNOWN"}}; - if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"}}; - if ( ! defined($o_host) ) # check host and filter - { print_usage(); exit $ERRORS{"UNKNOWN"}} - # check snmp information - if ( !defined($o_community) && (!defined($o_login) || !defined($o_passwd)) ) - { print "Put snmp login info!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if ((defined($o_login) || defined($o_passwd)) && (defined($o_community) || defined($o_version2)) ) - { print "Can't mix snmp v1,2c,3 protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if (defined ($v3protocols)) { - if (!defined($o_login)) { print "Put snmp V3 login info with protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - my @v3proto=split(/,/,$v3protocols); - if ((defined ($v3proto[0])) && ($v3proto[0] ne "")) {$o_authproto=$v3proto[0]; } # Auth protocol - if (defined ($v3proto[1])) {$o_privproto=$v3proto[1]; } # Priv protocol - if ((defined ($v3proto[1])) && (!defined($o_privpass))) { - print "Put snmp V3 priv login info with priv protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - } - if (!defined($o_service) || !(is_pattern_valid($o_service))) - { print "Service selection must be set and be a valid regexp\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if (!defined($o_nservice) || isnnum($o_nservice)) - { print "Service number must be set and be an integer\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} -} - -########## MAIN ####### - -check_options(); - -# Check gobal timeout if snmp screws up -if (defined($TIMEOUT)) { - verb("Alarm at $TIMEOUT + 5"); - alarm($TIMEOUT+5); -} else { - verb("no global timeout defined : $o_timeout + 10"); - alarm ($o_timeout+10); -} - -# Connect to host -my ($session,$error); -if ( defined($o_login) && defined($o_passwd)) { - # SNMPv3 login - verb("SNMPv3 login"); - if (!defined ($o_privpass)) { - verb("SNMPv3 AuthNoPriv login : $o_login, $o_authproto"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => '3', - -username => $o_login, - -authpassword => $o_passwd, - -authprotocol => $o_authproto, - -timeout => $o_timeout - ); - } else { - verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => '3', - -username => $o_login, - -authpassword => $o_passwd, - -authprotocol => $o_authproto, - -privpassword => $o_privpass, - -privprotocol => $o_privproto, - -timeout => $o_timeout - ); - } -} else { - if (defined ($o_version2)) { - # SNMPv2 Login - verb("SNMP v2c login"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => 2, - -community => $o_community, - -port => $o_port, - -timeout => $o_timeout - ); - } else { - # SNMPV1 login - verb("SNMP v1 login"); - ($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 $ERRORS{"UNKNOWN"}; -} - -# Get global status -my @oidlist=($be_global_status); -my $resultat = (Net::SNMP->VERSION < 4) ? - $session->get_request(@oidlist) - : $session->get_request(-varbindlist => \@oidlist); - -if (!defined($resultat)) { - printf("ERROR: Gloabal status table : %s.\n", $session->error); - $session->close; - exit $ERRORS{"UNKNOWN"}; -} - -if ($$resultat{$be_global_status} != 1) { - print "Global service is stopped (",$$resultat{$be_global_status},") : CRITICAL\n"; - exit $ERRORS{"CRITICAL"}; -} - -$resultat=undef; -# Get service table -$resultat = (Net::SNMP->VERSION < 4) ? - $session->get_table($be_service_table) - : $session->get_table(Baseoid => $be_service_table); - -if (!defined($resultat)) { - printf("ERROR: Description table : %s.\n", $session->error); - $session->close; - exit $ERRORS{"UNKNOWN"}; -} -$session->close; - -my $output=""; -my $output_perf=""; -my $global_status=0; -my ($nservice,$nservice_ok)=(0,0); -my (@found_service,@service_state)=undef; - -foreach my $key ( keys %$resultat) { - verb("OID : $key, Desc : $$resultat{$key}"); - if ( ($key =~ /$be_service_name\./) && ($$resultat{$key} =~ /$o_service/ )) { # Get index of service with name - $found_service[$nservice]=$$resultat{$key}; - $key =~ s/$be_service_name//; - $service_state[$nservice]=$$resultat{$be_service_status.$key}; - if (($service_state[$nservice] ne "RUNNING") || ($$resultat{$be_service_mode.$key}!=1)) { - $service_state[$nservice].="(".$$resultat{$be_service_mode.$key}.")"; - $global_status=2; - } else { - $nservice_ok++ - } - $nservice++; - verb ("Found service $found_service[$nservice-1]"); - } -} - -if ($o_nservice > $nservice_ok) { - for (my $i=0;$i<$nservice;$i++) { - if ($output ne "") { $output .= ", "; } - $output .= $found_service[$i] . ":" . $service_state[$i]; - } - if ($output ne "") { $output .= ", "; } - $output .= ":" . $nservice_ok . " services OK < ".$o_nservice; - print $output, " : CRITICAL\n"; - exit $ERRORS{"CRITICAL"}; -} - -$output = $nservice_ok . " services OK"; -if ($o_nservice < $nservice_ok) { - print $output," > $o_nservice : WARNING\n"; - exit $ERRORS{"WARNING"}; -} -print $output," : OK\n"; -exit $ERRORS{"OK"}; diff --git a/check_snmp_cpfw.pl b/check_snmp_cpfw.pl deleted file mode 100755 index bdf790a..0000000 --- a/check_snmp_cpfw.pl +++ /dev/null @@ -1,555 +0,0 @@ -#!/usr/bin/perl -w -############################## check_snmp_cpfw ############## -# Version : 1.2.1 -# Date : April 19 2007 -# Author : Patrick Proy (patrick at proy.org) -# Help : http://nagios.manubulon.com -# Licence : GPL - http://www.fsf.org/licenses/gpl.txt -# TODO : -# - check sync method -################################################################# -# -# Help : ./check_snmp_cpfw.pl -h -# - -use strict; -use Net::SNMP; -use Getopt::Long; - -# Nagios specific - -use lib "/usr/local/nagios/libexec"; -use utils qw(%ERRORS $TIMEOUT); -#my $TIMEOUT = 15; -#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - -########### SNMP Datas ########### - -###### FW data -my $policy_state = "1.3.6.1.4.1.2620.1.1.1.0"; # "Installed" -my $policy_name = "1.3.6.1.4.1.2620.1.1.2.0"; # Installed policy name -my $connections = "1.3.6.1.4.1.2620.1.1.25.3.0"; # number of connections -#my $connections_peak = "1.3.6.1.4.1.2620.1.1.25.4.0"; # peak number of connections -my @fw_checks = ($policy_state,$policy_name,$connections); - -###### SVN data -my $svn_status = "1.3.6.1.4.1.2620.1.6.102.0"; # "OK" svn status -my %svn_checks = ($svn_status,"OK"); -my %svn_checks_n = ($svn_status,"SVN status"); -my @svn_checks_oid = ($svn_status); - -###### HA data - -my $ha_active = "1.3.6.1.4.1.2620.1.5.5.0"; # "yes" -my $ha_state = "1.3.6.1.4.1.2620.1.5.6.0"; # "active" / "standby" -my $ha_block_state = "1.3.6.1.4.1.2620.1.5.7.0"; #"OK" : ha blocking state -my $ha_status = "1.3.6.1.4.1.2620.1.5.102.0"; # "OK" : ha status - -my %ha_checks =( $ha_active,"yes",$ha_state,"active",$ha_block_state,"OK",$ha_status,"OK"); -my %ha_checks_stand =( $ha_active,"yes",$ha_state,"standby",$ha_block_state,"OK",$ha_status,"OK"); -my %ha_checks_n =( $ha_active,"HA active",$ha_state,"HA state",$ha_block_state,"HA block state",$ha_status,"ha_status"); -my @ha_checks_oid =( $ha_active,$ha_state,$ha_block_state,$ha_status); - -my $ha_mode = "1.3.6.1.4.1.2620.1.5.11.0"; # "Sync only"/"High Availability (Active Up)" : ha Working mode - -my $ha_tables = "1.3.6.1.4.1.2620.1.5.13.1"; # ha status table -my $ha_tables_index = ".1"; -my $ha_tables_name = ".2"; -my $ha_tables_state = ".3"; # "OK" -my $ha_tables_prbdesc = ".6"; # Description if state is != "OK" - -#my @ha_table_check = ("Synchronization","Filter","cphad","fwd"); # process to check - -####### MGMT data - -my $mgmt_status = "1.3.6.1.4.1.2620.1.7.5.0"; # "active" : management status -my $mgmt_alive = "1.3.6.1.4.1.2620.1.7.6.0"; # 1 : management is alive if 1 -my $mgmt_stat_desc = "1.3.6.1.4.1.2620.1.7.102.0"; # Management status description -my $mgmt_stats_desc_l = "1.3.6.1.4.1.2620.1.7.103.0"; # Management status long description - -my %mgmt_checks = ($mgmt_status,"active",$mgmt_alive,"1"); -my %mgmt_checks_n = ($mgmt_status,"Mgmt status",$mgmt_alive,"Mgmt alive"); -my @mgmt_checks_oid = ($mgmt_status,$mgmt_alive); - -#################################### Globals ##############################"" - -my $Version='1.2.1'; - -my $o_host = undef; # hostname -my $o_community = undef; # community -my $o_version2 =undef; # Version 2 -my $o_port = 161; # port -my $o_help= undef; # wan't some help ? -my $o_verb= undef; # verbose mode -my $o_version= undef; # print version -my $o_timeout= 5; # Default 5s Timeout -my $o_warn= undef; # Warning for connections -my $o_crit= undef; # Crit for connections -my $o_svn= undef; # Check for SVN status -my $o_fw= undef; # Check for FW status -my $o_ha= undef; # Check for HA status -my $o_mgmt= undef; # Check for management status -my $o_policy= undef; # Check for policy name -my $o_conn= undef; # Check for connexions -my $o_perf= undef; # Performance data output - -# SNMPv3 specific -my $o_login= undef; # Login for snmpv3 -my $o_passwd= undef; # Pass for snmpv3 -my $v3protocols=undef; # V3 protocol list. -my $o_authproto='md5'; # Auth protocol -my $o_privproto='des'; # Priv protocol -my $o_privpass= undef; # priv password - -# functions - -sub p_version { print "check_snmp_cpfw version : $Version\n"; } - -sub print_usage { - print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-s] [-w [-p=pol_name] [-c=warn,crit]] [-m] [-a [standby] ] [-f] [-p ] [-t ] [-V]\n"; -} - -sub isnnum { # Return true if arg is not a number - my $num = shift; - if ( $num =~ /^(\d+\.?\d*)|(^\.\d+)$/ ) { return 0 ;} - return 1; -} - -sub help { - print "\nSNMP Checkpoint FW-1 Monitor for Nagios version ",$Version,"\n"; - print "GPL Licence, (c)2004-2007 - Patrick Proy\n\n"; - print_usage(); - print <, - : Authentication protocol (md5|sha : default md5) - : Priv protocole (des|aes : default des) --s, --svn - check for svn status --w, --fw - check for fw status --a, --ha[=standby] - check for ha status and node in "active" state - If using SecurePlatform and monitoring a standby unit, put "standby" too --m, --mgmt - check for management status --p, --policy=POLICY_NAME - check if installed policy is POLICY_NAME (must have -w) --c, --connexions=WARN,CRIT - check warn and critical number of connexions (must have -w) --f, --perfparse - perfparse output (only works with -c) --P, --port=PORT - SNMP port (Default 161) --t, --timeout=INTEGER - timeout for SNMP (Default: Nagios default) --V, --version - prints version number -EOT -} - -# For verbose output -sub verb { my $t=shift; print $t,"\n" if defined($o_verb) ; } - -sub check_options { - Getopt::Long::Configure ("bundling"); - GetOptions( - 'v' => \$o_verb, 'verbose' => \$o_verb, - 'h' => \$o_help, 'help' => \$o_help, - 'H:s' => \$o_host, 'hostname:s' => \$o_host, - 'P:i' => \$o_port, 'port:i' => \$o_port, - 'C:s' => \$o_community, 'community:s' => \$o_community, - '2' => \$o_version2, 'v2c' => \$o_version2, - 'l:s' => \$o_login, 'login:s' => \$o_login, - 'x:s' => \$o_passwd, 'passwd:s' => \$o_passwd, - 'X:s' => \$o_privpass, 'privpass:s' => \$o_privpass, - 'L:s' => \$v3protocols, 'protocols:s' => \$v3protocols, - 't:i' => \$o_timeout, 'timeout:i' => \$o_timeout, - 'V' => \$o_version, 'version' => \$o_version, - 's' => \$o_svn, 'svn' => \$o_svn, - 'w' => \$o_fw, 'fw' => \$o_fw, - 'a:s' => \$o_ha, 'ha:s' => \$o_ha, - 'm' => \$o_mgmt, 'mgmt' => \$o_mgmt, - 'p:s' => \$o_policy, 'policy:s' => \$o_policy, - 'c:s' => \$o_conn, 'connexions:s' => \$o_conn, - 'f' => \$o_perf, 'perfparse' => \$o_perf - ); - if (defined ($o_help) ) { help(); exit $ERRORS{"UNKNOWN"}}; - if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"}}; - if ( ! defined($o_host) ) # check host and filter - { print_usage(); exit $ERRORS{"UNKNOWN"}} - # check snmp information - if ( !defined($o_community) && (!defined($o_login) || !defined($o_passwd)) ) - { print "Put snmp login info!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if ((defined($o_login) || defined($o_passwd)) && (defined($o_community) || defined($o_version2)) ) - { print "Can't mix snmp v1,2c,3 protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if (defined ($v3protocols)) { - if (!defined($o_login)) { print "Put snmp V3 login info with protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - my @v3proto=split(/,/,$v3protocols); - if ((defined ($v3proto[0])) && ($v3proto[0] ne "")) {$o_authproto=$v3proto[0]; } # Auth protocol - if (defined ($v3proto[1])) {$o_privproto=$v3proto[1]; } # Priv protocol - if ((defined ($v3proto[1])) && (!defined($o_privpass))) { - print "Put snmp V3 priv login info with priv protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - } - # Check firewall options - if ( defined($o_conn)) { - if ( ! defined($o_fw)) - { print "Cannot check connexions without checking fw\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - my @warncrit=split(/,/ , $o_conn); - if ( $#warncrit != 1 ) - { print "Put warn,crit levels with -c option\n";print_usage(); exit $ERRORS{"UNKNOWN"}} - ($o_warn,$o_crit)=@warncrit; - if ( isnnum($o_warn) || isnnum($o_crit) ) - { print "Numeric values for warning and critical in -c options\n";print_usage(); exit $ERRORS{"UNKNOWN"}} - if ($o_warn >= $o_crit) - { print "warning <= critical ! \n";print_usage(); exit $ERRORS{"UNKNOWN"}} - } - if ( defined($o_policy)) { - if (! defined($o_fw)) - { print "Cannot check policy name without checking fw\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if ($o_policy eq "") - { print "Put a policy name !\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - } - if (defined($o_perf) && ! defined ($o_conn)) - { print "Nothing selected for perfparse !\n";print_usage(); exit $ERRORS{"UNKNOWN"}} - if (!defined($o_fw) && !defined($o_ha) && !defined($o_mgmt) && !defined($o_svn)) - { print "Must select a product to check !\n";print_usage(); exit $ERRORS{"UNKNOWN"}} - if (defined ($o_ha) && ($o_ha ne "") && ($o_ha ne "standby")) - { print "-a option comes with 'standby' or nothing !\n";print_usage(); exit $ERRORS{"UNKNOWN"}} - -} - -########## MAIN ####### - -check_options(); - -# Check gobal timeout if snmp screws up -if (defined($TIMEOUT)) { - verb("Alarm at $TIMEOUT"); - alarm($TIMEOUT); -} else { - verb("no timeout defined : $o_timeout + 10"); - alarm ($o_timeout+10); -} - -$SIG{'ALRM'} = sub { - print "No answer from host\n"; - exit $ERRORS{"UNKNOWN"}; -}; - -# Connect to host -my ($session,$error); -if ( defined($o_login) && defined($o_passwd)) { - # SNMPv3 login - verb("SNMPv3 login"); - if (!defined ($o_privpass)) { - verb("SNMPv3 AuthNoPriv login : $o_login, $o_authproto"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => '3', - -username => $o_login, - -port => $o_port, - -authpassword => $o_passwd, - -authprotocol => $o_authproto, - -timeout => $o_timeout - ); - } else { - verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => '3', - -username => $o_login, - -port => $o_port, - -authpassword => $o_passwd, - -authprotocol => $o_authproto, - -privpassword => $o_privpass, - -privprotocol => $o_privproto, - -timeout => $o_timeout - ); - } -} else { - if (defined ($o_version2)) { - # SNMPv2 Login - verb("SNMP v2c login"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => 2, - -community => $o_community, - -port => $o_port, - -timeout => $o_timeout - ); - } else { - # SNMPV1 login - verb("SNMP v1 login"); - ($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 $ERRORS{"UNKNOWN"}; -} - -########### Global checks ################# - -my $global_status=0; # global status : 0=OK, 1=Warn, 2=Crit -my ($resultat,$key)=(undef,undef); - -########## Check SVN status ############# -my $svn_print=""; -my $svn_state=0; - -if (defined ($o_svn)) { - -$resultat = $session->get_request( - Varbindlist => \@svn_checks_oid -); - - if (defined($resultat)) { - foreach $key ( keys %svn_checks) { - verb("$svn_checks_n{$key} : $svn_checks{$key} / $$resultat{$key}"); - if ( $$resultat{$key} ne $svn_checks{$key} ) { - $svn_print .= $svn_checks_n{$key} . ":" . $$resultat{$key} . " "; - $svn_state=2; - } - } - } else { - $svn_print .= "cannot find oids"; - #Critical state if not found because it means soft is not activated - $svn_state=2; - } - - if ($svn_state == 0) { - $svn_print="SVN : OK"; - } else { - $svn_print="SVN : " . $svn_print; - } - verb("$svn_print"); -} -########## Check mgmt status ############# -my $mgmt_state=0; -my $mgmt_print=""; - -if (defined ($o_mgmt)) { -# Check all states - $resultat=undef; - $resultat = $session->get_request( - Varbindlist => \@mgmt_checks_oid - ); - if (defined($resultat)) { - foreach $key ( keys %mgmt_checks) { - verb("$mgmt_checks_n{$key} : $mgmt_checks{$key} / $$resultat{$key}"); - if ( $$resultat{$key} ne $mgmt_checks{$key} ) { - $mgmt_print .= $mgmt_checks_n{$key} . ":" . $$resultat{$key} . " "; - $mgmt_state=2; - } - } - } else { - $mgmt_print .= "cannot find oids"; - #Critical state if not found because it means soft is not activated - $mgmt_state=2; - } - if ($mgmt_state == 0) { - $mgmt_print="MGMT : OK"; - } else { - $mgmt_print="MGMT : " . $mgmt_print; - } - verb("$svn_print"); -} - -########### Check fw status ############## - -my $fw_state=0; -my $fw_print=""; -my $perf_conn=undef; - -if (defined ($o_fw)) { - -# Check all states - - $resultat = $session->get_request( - Varbindlist => \@fw_checks - ); - if (defined($resultat)) { - verb("State : $$resultat{$policy_state}"); - verb("Name : $$resultat{$policy_name}"); - verb("connections : $$resultat{$connections}"); - - if ($$resultat{$policy_state} ne "Installed") { - $fw_state=2; - $fw_print .= "Policy:". $$resultat{$policy_state}." "; - verb("Policy state not installed"); - } - - if (defined($o_policy)) { - if ($$resultat{$policy_name} ne $o_policy) { - $fw_state=2; - $fw_print .= "Policy installed : $$resultat{$policy_name}"; - } - } - - if (defined($o_conn)) { - if ($$resultat{$connections} > $o_crit) { - $fw_state=2; - $fw_print .= "Connexions : ".$$resultat{$connections}." > ".$o_crit." "; - } else { - if ($$resultat{$connections} > $o_warn) { - if ($fw_state!=2) {$fw_state=1;} - $fw_print .= "Connexions : ".$$resultat{$connections}." > ".$o_warn." "; - } - } - $perf_conn=$$resultat{$connections}; - } - } else { - $fw_print .= "cannot find oids"; - #Critical state if not found because it means soft is not activated - $fw_state=2; - } - - if ($fw_state==0) { - $fw_print="FW : OK"; - } else { - $fw_print="FW : " . $fw_print; - } - -} -########### Check ha status ############## - -my $ha_state_n=0; -my $ha_print=""; - -if (defined ($o_ha)) { - # Check all states - - $resultat = $session->get_request( - Varbindlist => \@ha_checks_oid - ); - - if (defined($resultat)) { - foreach $key ( keys %ha_checks) { - verb("$ha_checks_n{$key} : $ha_checks{$key} / $$resultat{$key}"); - if ( $o_ha eq "standby" ) { - if ( $$resultat{$key} ne $ha_checks_stand{$key} ) { - $ha_print .= $ha_checks_n{$key} . ":" . $$resultat{$key} . " "; - $ha_state_n=2; - } - } else { - if ( $$resultat{$key} ne $ha_checks{$key} ) { - $ha_print .= $ha_checks_n{$key} . ":" . $$resultat{$key} . " "; - $ha_state_n=2; - } - } - } - #my $ha_mode = "1.3.6.1.4.1.2620.1.5.11.0"; # "Sync only" : ha Working mode - } else { - $ha_print .= "cannot find oids"; - #Critical state if not found because it means soft is not activated - $ha_state_n=2; - } - - # get ha status table - $resultat = $session->get_table( - Baseoid => $ha_tables - ); - my %status; - my (@index,@oid) = (undef,undef); - my $nindex=0; - my $index_search= $ha_tables . $ha_tables_index; - - if (defined($resultat)) { - foreach $key ( keys %$resultat) { - if ( $key =~ /$index_search/) { - @oid=split (/\./,$key); - pop(@oid); - $index[$nindex]=pop(@oid); - $nindex++; - } - } - } else { - $ha_print .= "cannot find oids" if ($ha_state_n ==0); - #Critical state if not found because it means soft is not activated - $ha_state_n=2; - } - verb ("found $nindex ha softs"); - if ( $nindex == 0 ) - { - $ha_print .= " no ha soft found" if ($ha_state_n ==0); - $ha_state_n=2; - } else { - my $ha_soft_name=undef; - - for (my $i=0;$i<$nindex;$i++) { - - $key=$ha_tables . $ha_tables_name . "." . $index[$i] . ".0"; - $ha_soft_name= $$resultat{$key}; - - $key=$ha_tables . $ha_tables_state . "." . $index[$i] . ".0"; - if (($status{$ha_soft_name} = $$resultat{$key}) ne "OK") { - $key=$ha_tables . $ha_tables_prbdesc . "." . $index[$i] . ".0"; - $status{$ha_soft_name} = $$resultat{$key}; - $ha_print .= $ha_soft_name . ":" . $status{$ha_soft_name} . " "; - $ha_state_n=2 - } - verb ("$ha_soft_name : $status{$ha_soft_name}"); - } - } - - if ($ha_state_n == 0) { - $ha_print = "HA : OK"; - } else { - $ha_print = "HA : " . $ha_print; - } - -} - -$session->close; - -########## print results and exit - -my $f_print=undef; - -if (defined ($o_fw)) { $f_print = $fw_print } -if (defined ($o_svn)) { $f_print = (defined ($f_print)) ? $f_print . " / ". $svn_print : $svn_print } -if (defined ($o_ha)) { $f_print = (defined ($f_print)) ? $f_print . " / ". $ha_print : $ha_print } -if (defined ($o_mgmt)) { $f_print = (defined ($f_print)) ? $f_print . " / ". $mgmt_print : $mgmt_print } - -my $exit_status=undef; -$f_print .= " / CPFW Status : "; -if (($ha_state_n+$svn_state+$fw_state+$mgmt_state) == 0 ) { - $f_print .= "OK"; - $exit_status= $ERRORS{"OK"}; -} else { - if (($fw_state==1) || ($ha_state_n==1) || ($svn_state==1) || ($mgmt_state==1)) { - $f_print .= "WARNING"; - $exit_status= $ERRORS{"WARNING"}; - } else { - $f_print .= "CRITICAL"; - $exit_status=$ERRORS{"CRITICAL"}; - } -} - -if (defined($o_perf) && defined ($perf_conn)) { - $f_print .= " | fw_connexions=" . $perf_conn; -} - -print "$f_print\n"; -exit $exit_status; - diff --git a/check_snmp_css.pl b/check_snmp_css.pl deleted file mode 100755 index c2b8552..0000000 --- a/check_snmp_css.pl +++ /dev/null @@ -1,480 +0,0 @@ -#!/usr/bin/perl -w -############################## check_snmp_css.pl ################# -# Version : 1.0.1 -# Date : 27 Sept 2006 -# Author : Patrick Proy ( patrick at proy.org) -# Help : http://www.manubulon.com/nagios/ -# Licence : GPL - http://www.fsf.org/licenses/gpl.txt -# Changelog : -# Contributors : -################################################################# -# -# Help : ./check_snmp_css.pl -h -# - -use strict; -use Net::SNMP; -use Getopt::Long; - -# Nagios specific - -use lib "/usr/local/nagios/libexec"; -use utils qw(%ERRORS $TIMEOUT); -#my $TIMEOUT = 15; -#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - -# SNMP Datas - -my $css_svc_table = "1.3.6.1.4.1.9.9.368.1.15.2.1"; # Svc table -my $css_svc_name = "1.3.6.1.4.1.9.9.368.1.15.2.1.1"; # Service Name / apSvcName -my $css_svc_index = "1.3.6.1.4.1.9.9.368.1.15.2.1.2"; # apSvcIndex -my $css_svc_enable = "1.3.6.1.4.1.9.9.368.1.15.2.1.12"; # apSvcEnable -my $css_svc_state= "1.3.6.1.4.1.9.9.368.1.15.2.1.17"; # apSvcState : suspended(1), down(2), alive(4), dying(5) -my $css_svc_maxconn = "1.3.6.1.4.1.9.9.368.1.15.2.1.19"; # Max connexions / apSvcMaxConnections -my $css_svc_conn = "1.3.6.1.4.1.9.9.368.1.15.2.1.20"; # apSvcConnections -my $css_svc_avgresp = "1.3.6.1.4.1.9.9.368.1.15.2.1.65"; # apSvcAvgResponseTime : average response time -my $css_svc_maxresp = "1.3.6.1.4.1.9.9.368.1.15.2.1.66"; # apSvcPeakAvgResponseTime : peak response time -my @css_svc_state_txt= ("","suspended","down","","alive","dying"); -my @css_svc_state_nag= (3,2,2,3,0,2); - -# Globals - -my $Version='1.0'; - -my $o_host = undef; # hostname -my $o_community = undef; # community -my $o_port = 161; # port -my $o_help= undef; # wan't some help ? -my $o_verb= undef; # verbose mode -my $o_version= undef; # print version -my $o_timeout= undef; # Timeout (Default 5) -my $o_perf= undef; # Output performance data -my $o_version2= undef; # use snmp v2c -#Specific -my $o_dir= "/tmp/"; # Directory to store temp file in it. -my $o_dir_set= undef; # defined if names and index must be read form file. -my $o_name= undef; # service name (regexp) -my $o_warn_number= undef; # minimum number of service before warning -my $o_crit_number= undef; # minimum number of service before critical -my $o_warn_conn= undef; # % of max connexions for warning level -my $o_crit_conn= undef; # % of max connexions for critical level -my $o_warn_resp= undef; # average response time for warning level -my $o_crit_resp= undef; # average response time for critical level -my @o_levels= undef; -# SNMPv3 specific -my $o_login= undef; # Login for snmpv3 -my $o_passwd= undef; # Pass for snmpv3 -my $v3protocols=undef; # V3 protocol list. -my $o_authproto='md5'; # Auth protocol -my $o_privproto='des'; # Priv protocol -my $o_privpass= undef; # priv password - -# functions - -sub p_version { print "check_snmp_css version : $Version\n"; } - -sub print_usage { - print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) -n [-d directory] [-w ,, -c ,,] [-p ] [-f] [-t ] [-V]\n"; -} - -sub isnnum { # Return true if arg is not a number - my $num = shift; - if ( $num =~ /^-?(\d+\.?\d*)|(^\.\d+)$/ ) { return 0 ;} - return 1; -} - -sub set_status { # return worst status with this order : OK, unknwonw, warning, critical - my $new_status=shift; - my $cur_status=shift; - if (($cur_status == 0)|| ($new_status==$cur_status)){ return $new_status; } - if ($new_status==3) { return $cur_status; } - if ($new_status > $cur_status) {return $new_status;} - return $cur_status; -} - -sub is_pattern_valid { # Test for things like "" or "+5-i" - my $pat = shift; - if (!defined($pat)) { $pat=" ";} # Just to get rid of compilation time warnings - return eval { "" =~ /$pat/; 1 } || 0; -} - -sub round ($$) { - sprintf "%.$_[1]f", $_[0]; -} - -sub help { - print "\nSNMP Cisco CSS monitor for Nagios version ",$Version,"\n"; - print "(c)2004-2006 Patrick Proy\n\n"; - print_usage(); - print < - regexp to select service --w, --warning=,, - Optional. Warning level for - - minimum number of active & alive service - - average response time - - number of connexions - For no warnings, put -1 (ex : -w5,-1,3). - When using negative numbers, dont put space after "-w" --d, --dir= - Directory where the temp file with index, created by check_snmp_css_main.pl, can be found - If no directory is set, /tmp will be used --c, --critical=,resp>, - Optional. Critical levels (-1 for no critical levels) - See warning levels. --C, --community=COMMUNITY NAME - community name for the host's SNMP agent (implies v1 protocol) --2, --v2c - Use snmp v2c --l, --login=LOGIN ; -x, --passwd=PASSWD - Login and auth password for snmpv3 authentication - If no priv password exists, implies AuthNoPriv --X, --privpass=PASSWD - Priv password for snmpv3 (AuthPriv protocol) --L, --protocols=, - : Authentication protocol (md5|sha : default md5) - : Priv protocole (des|aes : default des) --P, --port=PORT - SNMP port (Default 161) --f, --perfparse - Perfparse compatible output --t, --timeout=INTEGER - timeout for SNMP in seconds (Default: 5) --V, --version - prints version number -EOT -} - -# For verbose output -sub verb { my $t=shift; print $t,"\n" if defined($o_verb) ; } - -sub check_options { - Getopt::Long::Configure ("bundling"); - GetOptions( - 'v' => \$o_verb, 'verbose' => \$o_verb, - 'h' => \$o_help, 'help' => \$o_help, - 'H:s' => \$o_host, 'hostname:s' => \$o_host, - 'p:i' => \$o_port, 'port:i' => \$o_port, - 'C:s' => \$o_community, 'community:s' => \$o_community, - 'l:s' => \$o_login, 'login:s' => \$o_login, - 'x:s' => \$o_passwd, 'passwd:s' => \$o_passwd, - 'X:s' => \$o_privpass, 'privpass:s' => \$o_privpass, - 'L:s' => \$v3protocols, 'protocols:s' => \$v3protocols, - 't:i' => \$o_timeout, 'timeout:i' => \$o_timeout, - 'V' => \$o_version, 'version' => \$o_version, - '2' => \$o_version2, 'v2c' => \$o_version2, - 'f' => \$o_perf, 'perfparse' => \$o_perf, - 'n:s' => \$o_name, 'name:s' => \$o_name, - 'w:s' => \$o_warn_conn, 'warning:s' => \$o_warn_conn, - 'c:s' => \$o_crit_conn, 'critical:s' => \$o_crit_conn, - 'd:s' => \$o_dir_set, 'dir:s' => \$o_dir_set - ); - # Basic checks - if (defined($o_timeout) && (isnnum($o_timeout) || ($o_timeout < 2) || ($o_timeout > 60))) - { print "Timeout must be >1 and <60 !\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if (!defined($o_timeout)) {$o_timeout=5;} - if (defined ($o_help) ) { help(); exit $ERRORS{"UNKNOWN"}}; - if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"}}; - if ( ! defined($o_host) ) # check host and filter - { print_usage(); exit $ERRORS{"UNKNOWN"}} - # check snmp information - if ( !defined($o_community) && (!defined($o_login) || !defined($o_passwd)) ) - { print "Put snmp login info!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if ((defined($o_login) || defined($o_passwd)) && (defined($o_community) || defined($o_version2)) ) - { print "Can't mix snmp v1,2c,3 protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if (defined ($v3protocols)) { - if (!defined($o_login)) { print "Put snmp V3 login info with protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - my @v3proto=split(/,/,$v3protocols); - if ((defined ($v3proto[0])) && ($v3proto[0] ne "")) {$o_authproto=$v3proto[0]; } # Auth protocol - if (defined ($v3proto[1])) {$o_privproto=$v3proto[1]; } # Priv protocol - if ((defined ($v3proto[1])) && (!defined($o_privpass))) { - print "Put snmp V3 priv login info with priv protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - } - if (!defined($o_name) || ! (is_pattern_valid($o_name))) - {print "Need a service name!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if (defined($o_warn_conn)) { - @o_levels=split(/,/,$o_warn_conn); - if (defined($o_levels[0])) { - if (isnnum($o_levels[0])) {print "Need number for warning!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if ($o_levels[0] != -1 ) {$o_warn_number=$o_levels[0];} - } - if (defined($o_levels[1])) { - if (isnnum($o_levels[1])) {print "Need number for warning!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if ($o_levels[1] != -1 ) {$o_warn_conn=$o_levels[1];} else {$o_warn_conn=undef;} - } else {$o_warn_conn=undef;} - if (defined($o_levels[2]) ) { - if (isnnum($o_levels[2])) {print "Need number for warning!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if ($o_levels[2] != -1 ) {$o_warn_resp=$o_levels[2];} - } - } - if (defined($o_crit_conn)) { - @o_levels=split(/,/,$o_crit_conn); - if (defined($o_levels[0]) ) { - if (isnnum($o_levels[0])) {print "Need number for critical!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if ($o_levels[0] != -1 ) { - $o_crit_number=$o_levels[0]; - if (defined($o_warn_number) && ($o_crit_number>=$o_warn_number)) - {print "critical must be < warning!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - } - } - if (defined($o_levels[1]) ) { - if (isnnum($o_levels[1])) {print "Need number for critical!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if ($o_levels[1] != -1 ) { - $o_crit_conn=$o_levels[1]; - if (defined($o_warn_conn) && ($o_warn_conn>=$o_crit_conn)) - {print "critical must be > warning!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - } else {$o_crit_conn=undef;} - } else {$o_crit_conn=undef;} - if (defined($o_levels[2]) ) { - if (isnnum($o_levels[2])) {print "Need number for critical!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if ($o_levels[2] != -1 ) { - $o_crit_resp=$o_levels[1]; - if (defined($o_warn_resp) && ($o_warn_resp>=$o_crit_resp)) - {print "critical must be > warning!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - } - } - } - if (defined($o_dir_set)) { - if ($o_dir_set ne "") {$o_dir=$o_dir_set;} - verb("Tmp directory : $o_dir"); - } -} - -########## MAIN ####### - -check_options(); - -# Check gobal timeout if snmp screws up -if (defined($TIMEOUT)) { - verb("Alarm at $TIMEOUT + 5"); - alarm($TIMEOUT+5); -} else { - verb("no global timeout defined : $o_timeout + 10"); - alarm ($o_timeout+10); -} - -# Connect to host -my ($session,$error); -if ( defined($o_login) && defined($o_passwd)) { - # SNMPv3 login - verb("SNMPv3 login"); - if (!defined ($o_privpass)) { - verb("SNMPv3 AuthNoPriv login : $o_login, $o_authproto"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => '3', - -username => $o_login, - -authpassword => $o_passwd, - -authprotocol => $o_authproto, - -timeout => $o_timeout - ); - } else { - verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => '3', - -username => $o_login, - -authpassword => $o_passwd, - -authprotocol => $o_authproto, - -privpassword => $o_privpass, - -privprotocol => $o_privproto, - -timeout => $o_timeout - ); - } -} else { - if (defined ($o_version2)) { - # SNMPv2 Login - verb("SNMP v2c login"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => 2, - -community => $o_community, - -port => $o_port, - -timeout => $o_timeout - ); - } else { - # SNMPV1 login - verb("SNMP v1 login"); - ($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 $ERRORS{"UNKNOWN"}; -} -$session->max_msg_size(10000); - -########### Cisco CSS checks ############## - -my (@index,@svcname)=(undef,undef); -my ($numsvc,$numoid,$numoid2)=0; -my (@oid,@oid_list,@oid_list2)=undef; -my $resultat = undef; -# Get load table by snmp or file -if (defined($o_dir_set)) { - my $file_name=$o_dir."/Nagios_css_".$o_host; - my $file_lock=$file_name.".lock"; - - # Check for lock file during 3 seconds max and quit if sill here. - my $file_timeout=0; - while (-e $file_lock) { - sleep(1); - if ($file_timeout==3) { - print "Lock file remaining for more than 3 sec : UNKNOWN\n"; - exit $ERRORS{"UNKNOWN"}; - } - $file_timeout++; - } - # Open file for reading. - open(FILE,"< ".$file_name); - while () { - my @file_line=split(/:/,$_); - if ((defined ($file_line[1])) && ($file_line[1] =~ /$o_name/)) { # select service by name - chomp($file_line[1]); - $svcname[$numsvc]=$file_line[1]; - my $key = $file_line[0]; - verb ("Found : $svcname[$numsvc]"); - $index[$numsvc++]=$key; - # Build oid for snmpget - $oid_list[$numoid++]=$css_svc_enable.$key; - $oid_list[$numoid++]=$css_svc_state.$key; - $oid_list2[$numoid2++]=$css_svc_maxconn.$key; - $oid_list2[$numoid2++]=$css_svc_conn.$key; - $oid_list2[$numoid2++]=$css_svc_avgresp.$key; - } - } - close (FILE); -} else { - $resultat = (Net::SNMP->VERSION < 4) ? - $session->get_table($css_svc_name) - : $session->get_table(Baseoid => $css_svc_name); - - if (!defined($resultat)) { - printf("ERROR: Description table : %s.\n", $session->error); - $session->close; - exit $ERRORS{"UNKNOWN"}; - } - - - # Get name data & index - - foreach my $key ( keys %$resultat) { - verb("OID : $key, Desc : $$resultat{$key}"); - if ($$resultat{$key} =~ /$o_name/) { # select service by name - $svcname[$numsvc]=$$resultat{$key}; - $key =~ s/$css_svc_name//; - verb ("Found : $svcname[$numsvc]"); - $index[$numsvc++]=$key; - # Build oid for snmpget - $oid_list[$numoid++]=$css_svc_enable.$key; - $oid_list[$numoid++]=$css_svc_state.$key; - $oid_list2[$numoid2++]=$css_svc_maxconn.$key; - $oid_list2[$numoid2++]=$css_svc_conn.$key; - $oid_list2[$numoid2++]=$css_svc_avgresp.$key; - } - } -} -# Check if a least one service found -if ($numsvc == 0) { - print "No service matching ",$o_name," found : CRITICAL\n"; - exit $ERRORS{"CRITICAL"}; -} - -$resultat = undef; -$resultat = (Net::SNMP->VERSION < 4) ? - $session->get_request(@oid_list) - : $session->get_request(-varbindlist => \@oid_list); - -if (!defined($resultat)) { - printf("ERROR: Status get : %s.\n", $session->error); - $session->close; - exit $ERRORS{"UNKNOWN"}; -} -my $resultat2 = undef; -$resultat2 = (Net::SNMP->VERSION < 4) ? - $session->get_request(@oid_list2) - : $session->get_request(-varbindlist => \@oid_list2); - -if (!defined($resultat2)) { - printf("ERROR: Conn get : %s.\n", $session->error); - $session->close; - exit $ERRORS{"UNKNOWN"}; -} - -my $output=""; -my $output_perf=""; -my $numsvc_ok=0; -my $output_done=0; -my $global_status=0; - -for (my $i=0;$i<$numsvc;$i++) { - my $key=$index[$i]; - if ($$resultat{$css_svc_enable.$key} == 0 ) { - # service disabled - if ($output ne "") { $output.=", ";} - $output .= $svcname[$i] . " : Disabled"; - } else { - if ($css_svc_state_nag[$$resultat{$css_svc_state.$key}] != 0) { - # state not OK - if ($output ne "") { $output.=", ";} - $output .= $svcname[$i] . " : " . $css_svc_state_txt[$$resultat{$css_svc_state.$key}]; - } else { - $numsvc_ok++; - $output_done=0; - # state OK - my $prctconn = round(($$resultat2{$css_svc_conn.$key}/$$resultat2{$css_svc_maxconn.$key}) * 100,0); - my $resptime = $$resultat2{$css_svc_avgresp.$key}; - if (defined ($o_warn_conn) && ($prctconn>$o_warn_conn)) { - if ($output ne "") { $output.=", ";} - $output .= $svcname[$i]. ":" . $prctconn ."%, ".$resptime."ms"; - set_status(1,$global_status);$output_done=1; - } - if (defined ($o_crit_conn) && ($prctconn>$o_crit_conn)) { - if ($output_done==0) { - $output .= $svcname[$i]. ":" . $prctconn ."%, ".$resptime."ms"; - $output_done=1; - } - set_status(2,$global_status); - } - if (defined ($o_warn_resp) && ($prctconn>$o_warn_resp)) { - if ($output_done==0) { - $output .= $svcname[$i]. ":" . $prctconn ."%, ".$resptime."ms"; - $output_done=1; - } - set_status(1,$global_status); - } - if (defined ($o_crit_resp) && ($prctconn>$o_crit_resp)) { - if ($output_done==0) { - $output .= $svcname[$i]. ":" . $prctconn ."%, ".$resptime."ms"; - $output_done=1; - } - set_status(2,$global_status); - } - } - } -} - - -$output .= " ".$numsvc_ok."/".$numsvc." services OK"; - -if (($global_status == 2) || ((defined ($o_crit_number)) && ($numsvc_ok<=$o_crit_number)) || ($numsvc_ok==0) ) { - print $output," : CRITICAL\n"; - exit $ERRORS{"CRITICAL"} -} -if (($global_status == 1) || ((defined ($o_warn_number)) && ($numsvc_ok<=$o_warn_number))) { - print $output," : WARNING\n"; - exit $ERRORS{"WARNING"} -} -print $output," : OK\n"; -exit $ERRORS{"OK"}; diff --git a/check_snmp_css_main.pl b/check_snmp_css_main.pl deleted file mode 100755 index 3a64bf0..0000000 --- a/check_snmp_css_main.pl +++ /dev/null @@ -1,266 +0,0 @@ -#!/usr/bin/perl -w -############################## check_snmp_css_main.pl ################# -# Version : 1.0 -# Date : 27 Sept 2006 -# Author : Patrick Proy ( patrick at proy.org) -# Help : http://www.manubulon.com/nagios/ -# Licence : GPL - http://www.fsf.org/licenses/gpl.txt -# Changelog : -# Contributors : -################################################################# -# -# Help : ./check_snmp_css.pl -h -# - -use strict; -use Net::SNMP; -use Getopt::Long; - -# Nagios specific - -use lib "/usr/local/nagios/libexec"; -use utils qw(%ERRORS $TIMEOUT); -#my $TIMEOUT = 15; -#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - -# SNMP Datas - -my $css_svc_table = "1.3.6.1.4.1.9.9.368.1.15.2.1"; # Svc table -my $css_svc_name = "1.3.6.1.4.1.9.9.368.1.15.2.1.1"; # Service Name / apSvcName -my $css_svc_index = "1.3.6.1.4.1.9.9.368.1.15.2.1.2"; # apSvcIndex -my $css_svc_enable = "1.3.6.1.4.1.9.9.368.1.15.2.1.12"; # apSvcEnable -my $css_svc_state= "1.3.6.1.4.1.9.9.368.1.15.2.1.17"; # apSvcState : suspended(1), down(2), alive(4), dying(5) -my $css_svc_maxconn = "1.3.6.1.4.1.9.9.368.1.15.2.1.19"; # Max connexions / apSvcMaxConnections -my $css_svc_conn = "1.3.6.1.4.1.9.9.368.1.15.2.1.20"; # apSvcConnections -my $css_svc_avgresp = "1.3.6.1.4.1.9.9.368.1.15.2.1.65"; # apSvcAvgResponseTime : average response time -my $css_svc_maxresp = "1.3.6.1.4.1.9.9.368.1.15.2.1.66"; # apSvcPeakAvgResponseTime : peak response time -my @css_svc_state_txt= ("","suspended","down","","alive","dying"); -my @css_svc_state_nag= (3,2,2,3,0,2); - -# Globals - -my $Version='1.0'; - -my $o_host = undef; # hostname -my $o_community = undef; # community -my $o_port = 161; # port -my $o_help= undef; # wan't some help ? -my $o_verb= undef; # verbose mode -my $o_version= undef; # print version -my $o_timeout= undef; # Timeout (Default 5) -my $o_version2= undef; # use snmp v2c -#Specific -my $o_dir= "/tmp/"; # Directory to store temp file in it. -# SNMPv3 specific -my $o_login= undef; # Login for snmpv3 -my $o_passwd= undef; # Pass for snmpv3 -my $v3protocols=undef; # V3 protocol list. -my $o_authproto='md5'; # Auth protocol -my $o_privproto='des'; # Priv protocol -my $o_privpass= undef; # priv password - -# functions - -sub p_version { print "check_snmp_css_main version : $Version\n"; } - -sub print_usage { - print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-d directory] [-p ] [-t ] [-V]\n"; -} - -sub help { - print "\nSNMP Cisco CSS monitor MAIN script for Nagios version ",$Version,"\n"; - print "GPL Licence, (c)2004-2006 Patrick Proy\n\n"; - print_usage(); - print < - Directory where temp file with index is written --C, --community=COMMUNITY NAME - community name for the host's SNMP agent (implies v1 protocol) --2, --v2c - Use snmp v2c --l, --login=LOGIN ; -x, --passwd=PASSWD - Login and auth password for snmpv3 authentication - If no priv password exists, implies AuthNoPriv --X, --privpass=PASSWD - Priv password for snmpv3 (AuthPriv protocol) --L, --protocols=, - : Authentication protocol (md5|sha : default md5) - : Priv protocole (des|aes : default des) --P, --port=PORT - SNMP port (Default 161) --t, --timeout=INTEGER - timeout for SNMP in seconds (Default: 5) --V, --version - prints version number -EOT -} - -# For verbose output -sub verb { my $t=shift; print $t,"\n" if defined($o_verb) ; } - -sub check_options { - Getopt::Long::Configure ("bundling"); - GetOptions( - 'v' => \$o_verb, 'verbose' => \$o_verb, - 'h' => \$o_help, 'help' => \$o_help, - 'H:s' => \$o_host, 'hostname:s' => \$o_host, - 'p:i' => \$o_port, 'port:i' => \$o_port, - 'C:s' => \$o_community, 'community:s' => \$o_community, - 'l:s' => \$o_login, 'login:s' => \$o_login, - 'x:s' => \$o_passwd, 'passwd:s' => \$o_passwd, - 'X:s' => \$o_privpass, 'privpass:s' => \$o_privpass, - 'L:s' => \$v3protocols, 'protocols:s' => \$v3protocols, - 't:i' => \$o_timeout, 'timeout:i' => \$o_timeout, - 'V' => \$o_version, 'version' => \$o_version, - '2' => \$o_version2, 'v2c' => \$o_version2, - 'd:s' => \$o_dir, 'dir:s' => \$o_dir - ); - # Basic checks - if (defined($o_timeout) && (isnnum($o_timeout) || ($o_timeout < 2) || ($o_timeout > 60))) - { print "Timeout must be >1 and <60 !\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if (!defined($o_timeout)) {$o_timeout=5;} - if (defined ($o_help) ) { help(); exit $ERRORS{"UNKNOWN"}}; - if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"}}; - if ( ! defined($o_host) ) # check host and filter - { print_usage(); exit $ERRORS{"UNKNOWN"}} - # check snmp information - if ( !defined($o_community) && (!defined($o_login) || !defined($o_passwd)) ) - { print "Put snmp login info!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if ((defined($o_login) || defined($o_passwd)) && (defined($o_community) || defined($o_version2)) ) - { print "Can't mix snmp v1,2c,3 protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if (defined ($v3protocols)) { - if (!defined($o_login)) { print "Put snmp V3 login info with protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - my @v3proto=split(/,/,$v3protocols); - if ((defined ($v3proto[0])) && ($v3proto[0] ne "")) {$o_authproto=$v3proto[0]; } # Auth protocol - if (defined ($v3proto[1])) {$o_privproto=$v3proto[1]; } # Priv protocol - if ((defined ($v3proto[1])) && (!defined($o_privpass))) { - print "Put snmp V3 priv login info with priv protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - } - if (defined($o_dir)) { - verb("Tmp directory : $o_dir"); - } -} - -########## MAIN ####### - -check_options(); - -# Check gobal timeout if snmp screws up -if (defined($TIMEOUT)) { - verb("Alarm at $TIMEOUT + 5"); - alarm($TIMEOUT+5); -} else { - verb("no global timeout defined : $o_timeout + 10"); - alarm ($o_timeout+10); -} - -# Connect to host -my ($session,$error); -if ( defined($o_login) && defined($o_passwd)) { - # SNMPv3 login - verb("SNMPv3 login"); - if (!defined ($o_privpass)) { - verb("SNMPv3 AuthNoPriv login : $o_login, $o_authproto"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => '3', - -username => $o_login, - -authpassword => $o_passwd, - -authprotocol => $o_authproto, - -timeout => $o_timeout - ); - } else { - verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => '3', - -username => $o_login, - -authpassword => $o_passwd, - -authprotocol => $o_authproto, - -privpassword => $o_privpass, - -privprotocol => $o_privproto, - -timeout => $o_timeout - ); - } -} else { - if (defined ($o_version2)) { - # SNMPv2 Login - verb("SNMP v2c login"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => 2, - -community => $o_community, - -port => $o_port, - -timeout => $o_timeout - ); - } else { - # SNMPV1 login - verb("SNMP v1 login"); - ($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 $ERRORS{"UNKNOWN"}; -} -$session->max_msg_size(10000); - -########### Cisco CSS checks ############## - -# Get load table -my $resultat = (Net::SNMP->VERSION < 4) ? - $session->get_table($css_svc_name) - : $session->get_table(Baseoid => $css_svc_name); - -if (!defined($resultat)) { - printf("ERROR: Name table : %s.\n", $session->error); - $session->close; - exit $ERRORS{"UNKNOWN"}; -} - - -# Get name data & index -my (@index,@svcname)=(undef,undef); -my $numsvc=0; -foreach my $key ( keys %$resultat) { - verb("OID : $key, Desc : $$resultat{$key}"); - $svcname[$numsvc]=$$resultat{$key}; - $key =~ s/$css_svc_name//; - verb ("Found : $svcname[$numsvc]"); - $index[$numsvc++]=$key; -} - -# Write file - -my $file_name=$o_dir."/Nagios_css_".$o_host; -my $file_lock=$file_name.".lock"; - -# First, make a lock file -system ("touch $file_lock"); -# allow scripts to finish reading file -sleep (0.5); -# create the file -if (!open(FILE,"> ".$file_name)) { - print "Cannot write $file_name\n"; - unlink($file_lock); - exit $ERRORS{"UNKNOWN"}; -} -for (my $i=0;$i<$numsvc;$i++) { - my $output=$index[$i].":".$svcname[$i]."\n"; - print FILE $output; -} -close (FILE); -unlink($file_lock); -print "Found $numsvc services : OK\n"; -exit $ERRORS{"OK"}; diff --git a/check_snmp_env.pl b/check_snmp_env.pl deleted file mode 100755 index fe444da..0000000 --- a/check_snmp_env.pl +++ /dev/null @@ -1,1006 +0,0 @@ -#!/usr/bin/perl -w -############################## check_snmp_env ################# -# Version : 1.2 -# Date : April 19 2007 -# Author : Patrick Proy ( patrick at proy.org) -# Help : http://www.manubulon.com/nagios/ -# Licence : GPL - http://www.fsf.org/licenses/gpl.txt -# Changelog : -# Contributors : Fredrik Vocks -################################################################# -# -# Help : ./check_snmp_env.pl -h -# - -use strict; -use Net::SNMP; -use Getopt::Long; - -# Nagios specific - -use lib "/usr/local/nagios/libexec"; -use utils qw(%ERRORS $TIMEOUT); -#my $TIMEOUT = 15; -#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - - -my @Nagios_state = ("UNKNOWN","OK","WARNING","CRITICAL"); # Nagios states coding - -# SNMP Datas - -# CISCO-ENVMON-MIB -my $ciscoEnvMonMIB = "1.3.6.1.4.1.9.9.13"; # Cisco env base table -my %CiscoEnvMonState = (1,"normal",2,"warning",3,"critical",4,"shutdown",5,"notPresent", - 6,"notFunctioning"); # Cisco states -my %CiscoEnvMonNagios = (1,1 ,2,2 ,3,3 ,4,3 ,5,0, 6,3); # Nagios states returned for CIsco states (coded see @Nagios_state). -my $ciscoVoltageTable = $ciscoEnvMonMIB.".1.2.1"; # Cisco voltage table -my $ciscoVoltageTableIndex = $ciscoVoltageTable.".1"; #Index table -my $ciscoVoltageTableDesc = $ciscoVoltageTable.".2"; #Description -my $ciscoVoltageTableValue = $ciscoVoltageTable.".3"; #Value -my $ciscoVoltageTableState = $ciscoVoltageTable.".7"; #Status -# CiscoEnvMonVoltageStatusEntry ::= - # 1 ciscoEnvMonVoltageStatusIndex Integer32 (0..2147483647), - # 2 ciscoEnvMonVoltageStatusDescr DisplayString, - # 3 ciscoEnvMonVoltageStatusValue CiscoSignedGauge, - # 4 ciscoEnvMonVoltageThresholdLow Integer32, - # 5 ciscoEnvMonVoltageThresholdHigh Integer32, - # 6 ciscoEnvMonVoltageLastShutdown Integer32, - # 7 ciscoEnvMonVoltageState CiscoEnvMonState -my $ciscoTempTable = $ciscoEnvMonMIB.".1.3.1"; # Cisco temprature table -my $ciscoTempTableIndex = $ciscoTempTable.".1"; #Index table -my $ciscoTempTableDesc = $ciscoTempTable.".2"; #Description -my $ciscoTempTableValue = $ciscoTempTable.".3"; #Value -my $ciscoTempTableState = $ciscoTempTable.".6"; #Status -# CiscoEnvMonTemperatureStatusEntry ::= - # ciscoEnvMonTemperatureStatusIndex Integer32 (0..2147483647), - # ciscoEnvMonTemperatureStatusDescr DisplayString, - # ciscoEnvMonTemperatureStatusValue Gauge32, - # ciscoEnvMonTemperatureThreshold Integer32, - # ciscoEnvMonTemperatureLastShutdown Integer32, - # ciscoEnvMonTemperatureState CiscoEnvMonState -my $ciscoFanTable = $ciscoEnvMonMIB.".1.4.1"; # Cisco fan table -my $ciscoFanTableIndex = $ciscoFanTable.".1"; #Index table -my $ciscoFanTableDesc = $ciscoFanTable.".2"; #Description -my $ciscoFanTableState = $ciscoFanTable.".3"; #Status -# CiscoEnvMonFanStatusEntry ::= - # ciscoEnvMonFanStatusIndex Integer32 (0..2147483647), - # ciscoEnvMonFanStatusDescr DisplayString, - # ciscoEnvMonFanState CiscoEnvMonState -my $ciscoPSTable = $ciscoEnvMonMIB.".1.5.1"; # Cisco power supply table -my $ciscoPSTableIndex = $ciscoPSTable.".1"; #Index table -my $ciscoPSTableDesc = $ciscoPSTable.".2"; #Description -my $ciscoPSTableState = $ciscoPSTable.".3"; #Status -# CiscoEnvMonSupplyStatusEntry ::= - # ciscoEnvMonSupplyStatusIndex Integer32 (0..2147483647), - # ciscoEnvMonSupplyStatusDescr DisplayString, - # ciscoEnvMonSupplyState CiscoEnvMonState, - # ciscoEnvMonSupplySource INTEGER - -# Nokia env mib -my $nokia_temp_tbl= "1.3.6.1.4.1.94.1.21.1.1.5"; -my $nokia_temp= "1.3.6.1.4.1.94.1.21.1.1.5.0"; -my $nokia_fan_table= "1.3.6.1.4.1.94.1.21.1.2"; -my $nokia_fan_status= "1.3.6.1.4.1.94.1.21.1.2.1.1.2"; -my $nokia_ps_table= "1.3.6.1.4.1.94.1.21.1.3"; -my $nokia_ps_temp= "1.3.6.1.4.1.94.1.21.1.3.1.1.2"; -my $nokia_ps_status= "1.3.6.1.4.1.94.1.21.1.3.1.1.3"; - -# Bluecoat env mib -my @bc_SensorCode=("","ok","unknown","not-installed","voltage-low-warning","voltage-low-critical", - "no-power","voltage-high-warning","voltage-high-critical","voltage-high-severe", - "temperature-high-warning","temperature-high-critical","temperature-high-severe", - "fan-slow-warning","fan-slow-critical","fan-stopped"); # BC element status returned by MIB -my @bc_status_nagios=(3,0,3,3,1,2,2,1,2,2,1,2,2,1,2,2); # nagios status equivallent to BC status -my @bc_SensorStatus=("","ok","unavailable","nonoperational"); # ok(1),unavailable(2),nonoperational(3) -my @bc_mesure=("","","","Enum","volts","celsius","rpm"); - -my @bc_DiskStatus=("","present","initializing","inserted","offline","removed","not-present","empty","bad","unknown"); -my @bc_dsk_status_nagios=(3,0,0,1,1,1,2,2,2,3); - -my $bc_sensor_table = "1.3.6.1.4.1.3417.2.1.1.1.1.1"; # sensor table -my $bc_sensor_units = "1.3.6.1.4.1.3417.2.1.1.1.1.1.3"; # cf bc_mesure -my $bc_sensor_Scale = "1.3.6.1.4.1.3417.2.1.1.1.1.1.4"; # * 10^value -my $bc_sensor_Value = "1.3.6.1.4.1.3417.2.1.1.1.1.1.5"; # value -my $bc_sensor_Code = "1.3.6.1.4.1.3417.2.1.1.1.1.1.6"; # bc_SensorCode -my $bc_sensor_Status = "1.3.6.1.4.1.3417.2.1.1.1.1.1.7"; # bc_SensorStatus -my $bc_sensor_Name = "1.3.6.1.4.1.3417.2.1.1.1.1.1.9"; # name - -my $bc_dsk_table = "1.3.6.1.4.1.3417.2.2.1.1.1.1"; #disk table -my $bc_dsk_status = "1.3.6.1.4.1.3417.2.2.1.1.1.1.3"; # cf bc_DiskStatus -my $bc_dsk_vendor = "1.3.6.1.4.1.3417.2.2.1.1.1.1.5"; # cf bc_DiskStatus -my $bc_dsk_serial = "1.3.6.1.4.1.3417.2.2.1.1.1.1.8"; # cf bc_DiskStatus - -# Ironport env mib - -my $iron_ps_table = "1.3.6.1.4.1.15497.1.1.1.8"; # ps table -my $iron_ps_status = "1.3.6.1.4.1.15497.1.1.1.8.1.2"; # ps status -#powerSupplyNotInstalled(1), powerSupplyHealthy(2), powerSupplyNoAC(3), powerSupplyFaulty(4) -my @iron_ps_status_name=("","powerSupplyNotInstalled","powerSupplyHealthy","powerSupplyNoAC","powerSupplyFaulty"); -my @iron_ps_status_nagios=(3,3,0,2,2); -my $iron_ps_ha = "1.3.6.1.4.1.15497.1.1.1.8.1.3"; # ps redundancy status -#powerSupplyRedundancyOK(1), powerSupplyRedundancyLost(2) -my @iron_ps_ha_name=("","powerSupplyRedundancyOK","powerSupplyRedundancyLost"); -my @iron_ps_ha_nagios=(3,0,1); -my $iron_ps_name = "1.3.6.1.4.1.15497.1.1.1.8.1.4"; # ps name - -my $iron_tmp_table = "1.3.6.1.4.1.15497.1.1.1.9"; # temp table -my $iron_tmp_celcius = "1.3.6.1.4.1.15497.1.1.1.9.1.2"; # temp in celcius -my $iron_tmp_name = "1.3.6.1.4.1.15497.1.1.1.9.1.3"; # name - -my $iron_fan_table = "1.3.6.1.4.1.15497.1.1.1.10"; # fan table -my $iron_fan_rpm = "1.3.6.1.4.1.15497.1.1.1.10.1.2"; # fan speed in RPM -my $iron_fan_name = "1.3.6.1.4.1.15497.1.1.1.10.1.3"; # fan name - -# Foundry BigIron Router Switch (FOUNDRY-SN-AGENT-MIB) - -my $foundry_temp = "1.3.6.1.4.1.1991.1.1.1.1.18.0"; # Chassis temperature in Deg C *2 -my $foundry_temp_warn = "1.3.6.1.4.1.1991.1.1.1.1.19.0"; # Chassis warn temperature in Deg C *2 -my $foundry_temp_crit = "1.3.6.1.4.1.1991.1.1.1.1.20.0"; # Chassis warn temperature in Deg C *2 -my $foundry_ps_table = "1.3.6.1.4.1.1991.1.1.1.2.1"; # PS table -my $foundry_ps_desc = "1.3.6.1.4.1.1991.1.1.1.2.1.1.2"; # PS desc -my $foundry_ps_status = "1.3.6.1.4.1.1991.1.1.1.2.1.1.3"; # PS status -my $foundry_fan_table = "1.3.6.1.4.1.1991.1.1.1.3.1"; # FAN table -my $foundry_fan_desc = "1.3.6.1.4.1.1991.1.1.1.3.1.1.2"; # FAN desc -my $foundry_fan_status = "1.3.6.1.4.1.1991.1.1.1.3.1.1.3"; # FAN status - -my @foundry_status = (3,0,2); # oper status : 1:other, 2: Normal, 3: Failure - -# Globals - -my $Version='1.2'; - -my $o_host = undef; # hostname -my $o_community = undef; # community -my $o_port = 161; # port -my $o_help= undef; # wan't some help ? -my $o_verb= undef; # verbose mode -my $o_version= undef; # print version -my $o_timeout= undef; # Timeout (Default 5) -my $o_perf= undef; # Output performance data -my $o_version2= undef; # use snmp v2c -# check type -my $o_check_type= "cisco"; # default Cisco -my @valid_types =("cisco","nokia","bc","iron","foundry"); -my $o_temp= undef; # max temp -my $o_fan= undef; # min fan speed - -# SNMPv3 specific -my $o_login= undef; # Login for snmpv3 -my $o_passwd= undef; # Pass for snmpv3 -my $v3protocols=undef; # V3 protocol list. -my $o_authproto='md5'; # Auth protocol -my $o_privproto='des'; # Priv protocol -my $o_privpass= undef; # priv password - -# functions - -sub p_version { print "check_snmp_env version : $Version\n"; } - -sub print_usage { - print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -T (cisco|nokia|bc|iron|foundry) [-F ] [-c ] [-f] [-t ] [-V]\n"; -} - -sub isnnum { # Return true if arg is not a number - my $num = shift; - if ( $num =~ /^(\d+\.?\d*)|(^\.\d+)$/ ) { return 0 ;} - return 1; -} - -sub set_status { # return worst status with this order : OK, unknwonw, warning, critical - my $new_status=shift; - my $cur_status=shift; - if (($cur_status == 0)|| ($new_status==$cur_status)){ return $new_status; } - if ($new_status==3) { return $cur_status; } - if ($new_status > $cur_status) {return $new_status;} - return $cur_status; -} - -sub help { - print "\nSNMP environmental Monitor for Nagios version ",$Version,"\n"; - print "GPL Licence, (c)2006-2007 Patrick Proy\n\n"; - print_usage(); - print <, - : Authentication protocol (md5|sha : default md5) - : Priv protocole (des|aes : default des) --P, --port=PORT - SNMP port (Default 161) --T, --type=cisco|nokia|bc|iron|foundry - Environemental check : - cisco : voltage,temp,fan,power supply status - will try to check everything present - nokia : fan and power supply - bc : fans, power supply, voltage, disks - iron : fans, power supply, temp - foundry : power supply, temp --F, --fan= - Minimum fan rpm value --c, --celcius= - Maximum temp in degree celcius --f, --perfparse - Perfparse compatible output --t, --timeout=INTEGER - timeout for SNMP in seconds (Default: 5) --V, --version - prints version number -EOT -} - -# For verbose output -sub verb { my $t=shift; print $t,"\n" if defined($o_verb) ; } - -sub check_options { - Getopt::Long::Configure ("bundling"); - GetOptions( - 'v' => \$o_verb, 'verbose' => \$o_verb, - 'h' => \$o_help, 'help' => \$o_help, - 'H:s' => \$o_host, 'hostname:s' => \$o_host, - 'p:i' => \$o_port, 'port:i' => \$o_port, - 'C:s' => \$o_community, 'community:s' => \$o_community, - 'l:s' => \$o_login, 'login:s' => \$o_login, - 'x:s' => \$o_passwd, 'passwd:s' => \$o_passwd, - 'X:s' => \$o_privpass, 'privpass:s' => \$o_privpass, - 'L:s' => \$v3protocols, 'protocols:s' => \$v3protocols, - 't:i' => \$o_timeout, 'timeout:i' => \$o_timeout, - 'V' => \$o_version, 'version' => \$o_version, - - '2' => \$o_version2, 'v2c' => \$o_version2, - 'f' => \$o_perf, 'perfparse' => \$o_perf, - 'T:s' => \$o_check_type, 'type:s' => \$o_check_type, - 'F:i' => \$o_fan, 'fan:i' => \$o_fan, - 'c:i' => \$o_temp, 'celcius:i' => \$o_temp - ); - # check the -T option - my $T_option_valid=0; - foreach (@valid_types) { if ($_ eq $o_check_type) {$T_option_valid=1} }; - if ( $T_option_valid == 0 ) - {print "Invalid check type (-T)!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - # Basic checks - if (defined($o_timeout) && (isnnum($o_timeout) || ($o_timeout < 2) || ($o_timeout > 60))) - { print "Timeout must be >1 and <60 !\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if (!defined($o_timeout)) {$o_timeout=5;} - if (defined ($o_help) ) { help(); exit $ERRORS{"UNKNOWN"}}; - if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"}}; - if ( ! defined($o_host) ) # check host and filter - { print_usage(); exit $ERRORS{"UNKNOWN"}} - # check snmp information - if ( !defined($o_community) && (!defined($o_login) || !defined($o_passwd)) ) - { print "Put snmp login info!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if ((defined($o_login) || defined($o_passwd)) && (defined($o_community) || defined($o_version2)) ) - { print "Can't mix snmp v1,2c,3 protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if (defined ($v3protocols)) { - if (!defined($o_login)) { print "Put snmp V3 login info with protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - my @v3proto=split(/,/,$v3protocols); - if ((defined ($v3proto[0])) && ($v3proto[0] ne "")) {$o_authproto=$v3proto[0]; } # Auth protocol - if (defined ($v3proto[1])) {$o_privproto=$v3proto[1]; } # Priv protocol - if ((defined ($v3proto[1])) && (!defined($o_privpass))) { - print "Put snmp V3 priv login info with priv protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - } -} - -########## MAIN ####### - -check_options(); - -# Check gobal timeout if snmp screws up -if (defined($TIMEOUT)) { - verb("Alarm at $TIMEOUT + 5"); - alarm($TIMEOUT+5); -} else { - verb("no global timeout defined : $o_timeout + 10"); - alarm ($o_timeout+10); -} - -$SIG{'ALRM'} = sub { - print "No answer from host\n"; - exit $ERRORS{"UNKNOWN"}; -}; - -# Connect to host -my ($session,$error); -if ( defined($o_login) && defined($o_passwd)) { - # SNMPv3 login - verb("SNMPv3 login"); - if (!defined ($o_privpass)) { - verb("SNMPv3 AuthNoPriv login : $o_login, $o_authproto"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => '3', - -username => $o_login, - -authpassword => $o_passwd, - -authprotocol => $o_authproto, - -timeout => $o_timeout - ); - } else { - verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => '3', - -username => $o_login, - -authpassword => $o_passwd, - -authprotocol => $o_authproto, - -privpassword => $o_privpass, - -privprotocol => $o_privproto, - -timeout => $o_timeout - ); - } -} else { - if (defined ($o_version2)) { - # SNMPv2 Login - verb("SNMP v2c login"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => 2, - -community => $o_community, - -port => $o_port, - -timeout => $o_timeout - ); - } else { - # SNMPV1 login - verb("SNMP v1 login"); - ($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 $ERRORS{"UNKNOWN"}; -} - -my $exit_val=undef; -########### Cisco env checks ############## - -if ($o_check_type eq "cisco") { - -verb("Checking cisco env"); - -# Get load table -my $resultat = (Net::SNMP->VERSION < 4) ? - $session->get_table($ciscoEnvMonMIB) - : $session->get_table(Baseoid => $ciscoEnvMonMIB); - -if (!defined($resultat)) { - printf("ERROR: Description table : %s.\n", $session->error); - $session->close; - exit $ERRORS{"UNKNOWN"}; -} -$session->close; - -# Get env data index -my (@voltindex,@tempindex,@fanindex,@psindex)=(undef,undef,undef,undef); -my ($voltexist,$tempexist,$fanexist,$psexist)=(0,0,0,0); -my @oid=undef; -foreach my $key ( keys %$resultat) { - verb("OID : $key, Desc : $$resultat{$key}"); - if ( $key =~ /$ciscoVoltageTableDesc/ ) { - @oid=split (/\./,$key); - $voltindex[$voltexist++] = pop(@oid); - } - if ( $key =~ /$ciscoTempTableDesc/ ) { - @oid=split (/\./,$key); - $tempindex[$tempexist++] = pop(@oid); - } - if ( $key =~ /$ciscoFanTableDesc/ ) { - @oid=split (/\./,$key); - $fanindex[$fanexist++] = pop(@oid); - } - if ( $key =~ /$ciscoPSTableDesc/ ) { - @oid=split (/\./,$key); - $psindex[$psexist++] = pop(@oid); - } -} - -if ( ($voltexist ==0) && ($tempexist ==0) && ($fanexist ==0) && ($psexist ==0) ) { - print "No Environemental data found : UNKNOWN"; - exit $ERRORS{"UNKNOWN"}; -} - -my $perf_output=""; -# Get the data -my ($i,$cur_status)=(undef,undef); - -my $volt_global=0; -my %volt_status; -if ($fanexist !=0) { - for ($i=0;$i < $voltexist; $i++) { - $cur_status=$$resultat{$ciscoVoltageTableState. "." . $voltindex[$i]}; - verb ($$resultat{$ciscoVoltageTableDesc .".".$voltindex[$i]}); - verb ($cur_status); - if (!defined ($cur_status)) { ### Error TODO - $volt_global=1; - } - $perf_output.=" '".$$resultat{$ciscoVoltageTableDesc .".".$voltindex[$i]}."'=" ; - $perf_output.=$$resultat{$ciscoVoltageTableValue."." . $voltindex[$i]}; - if ($Nagios_state[$CiscoEnvMonNagios{$cur_status}] ne "OK") { - $volt_global= 1; - $volt_status{$$resultat{$ciscoVoltageTableDesc .".".$voltindex[$i]}}=$cur_status; - } - } -} - - -my $temp_global=0; -my %temp_status; -if ($tempexist !=0) { - for ($i=0;$i < $tempexist; $i++) { - $cur_status=$$resultat{$ciscoTempTableState . "." . $tempindex[$i]}; - verb ($$resultat{$ciscoTempTableDesc .".".$tempindex[$i]}); - verb ($cur_status); - if (!defined ($cur_status)) { ### Error TODO - $temp_global=1; - } - $perf_output.=" '".$$resultat{$ciscoTempTableDesc .".".$tempindex[$i]}."'=" ; - $perf_output.=$$resultat{$ciscoTempTableValue."." . $tempindex[$i]}; - if ($Nagios_state[$CiscoEnvMonNagios{$cur_status}] ne "OK") { - $temp_global= 1; - $temp_status{$$resultat{$ciscoTempTableDesc .".".$tempindex[$i]}}=$cur_status; - } - } -} - - -my $fan_global=0; -my %fan_status; -if ($fanexist !=0) { - for ($i=0;$i < $fanexist; $i++) { - $cur_status=$$resultat{$ciscoFanTableState . "." . $fanindex[$i]}; - verb ($$resultat{$ciscoFanTableDesc .".".$fanindex[$i]}); - verb ($cur_status); - if (!defined ($cur_status)) { ### Error TODO - $fan_global=1; - } - if ($Nagios_state[$CiscoEnvMonNagios{$cur_status}] ne "OK") { - $fan_global= 1; - $fan_status{$$resultat{$ciscoFanTableDesc .".".$fanindex[$i]}}=$cur_status; - } - } -} - -my $ps_global=0; -my %ps_status; -if ($psexist !=0) { - for ($i=0;$i < $psexist; $i++) { - $cur_status=$$resultat{$ciscoPSTableState . "." . $psindex[$i]}; - if (!defined ($cur_status)) { ### Error TODO - $fan_global=1; - } - if ($Nagios_state[$CiscoEnvMonNagios{$cur_status}] ne "OK") { - $ps_global= 1; - $ps_status{$$resultat{$ciscoPSTableDesc .".".$psindex[$i]}}=$cur_status; - } - } -} - -my $global_state=0; -my $output=""; - -if ($fanexist !=0) { - if ($fan_global ==0) { - $output .= $fanexist." Fan OK"; - $global_state=1 if ($global_state==0); - } else { - foreach (keys %fan_status) { - $output .= "Fan " . $_ . ":" . $CiscoEnvMonState {$fan_status{$_}} ." "; - if ($global_state < $CiscoEnvMonNagios{$fan_status{$_}} ) { - $global_state = $CiscoEnvMonNagios{$fan_status{$_}} ; - } - } - } -} - -if ($psexist !=0) { - $output .= ", " if ($output ne ""); - if ($ps_global ==0) { - $output .= $psexist." ps OK"; - $global_state=1 if ($global_state==0); - } else { - foreach (keys %ps_status) { - $output .= "ps " . $_ . ":" . $CiscoEnvMonState {$ps_status{$_}} ." "; - if ($global_state < $CiscoEnvMonNagios{$ps_status{$_}} ) { - $global_state = $CiscoEnvMonNagios{$ps_status{$_}} ; - } - } - } -} - -if ($voltexist !=0) { - $output .= ", " if ($output ne ""); - if ($volt_global ==0) { - $output .= $voltexist." volt OK"; - $global_state=1 if ($global_state==0); - } else { - foreach (keys %volt_status) { - $output .= "volt " . $_ . ":" . $CiscoEnvMonState {$volt_status{$_}} ." "; - if ($global_state < $CiscoEnvMonNagios{$volt_status{$_}} ) { - $global_state = $CiscoEnvMonNagios{$volt_status{$_}} ; - } - } - } -} - -if ($tempexist !=0) { - $output .= ", " if ($output ne ""); - if ($temp_global ==0) { - $output .= $tempexist." temp OK"; - $global_state=1 if ($global_state==0); - } else { - foreach (keys %temp_status) { - $output .= "temp " . $_ . ":" . $CiscoEnvMonState {$temp_status{$_}} ." "; - if ($global_state < $CiscoEnvMonNagios{$temp_status{$_}} ) { - $global_state = $CiscoEnvMonNagios{$temp_status{$_}} ; - } - } - } -} - -#print $output," : ",$Nagios_state[$global_state]," | ",$perf_output,"\n"; -print $output," : ",$Nagios_state[$global_state],"\n"; -$exit_val=$ERRORS{$Nagios_state[$global_state]}; - -exit $exit_val; - -} - -############# Nokia checks -if ($o_check_type eq "nokia") { - -verb("Checking nokia env"); - -my $resultat; -# status : 0=ok, 1=nok, 2=temp prb -my ($fan_status,$ps_status,$temp_status)=(0,0,0); -my ($fan_exist,$ps_exist,$temp_exist)=(0,0,0); -my ($num_fan,$num_ps)=(0,0); -my ($num_fan_nok,$num_ps_nok)=(0,0); -my $global_status=0; -my $output=""; -# get temp -$resultat = (Net::SNMP->VERSION < 4) ? - $session->get_table($nokia_temp_tbl) - : $session->get_table(Baseoid => $nokia_temp_tbl); -if (defined($resultat)) { - verb ("temp found"); - $temp_exist=1; - if ($$resultat{$nokia_temp} != 1) { - $temp_status=2;$global_status=1; - $output="Temp CRITICAL "; - } else { - $output="Temp OK "; - } -} - -# Get fan table -$resultat = (Net::SNMP->VERSION < 4) ? - $session->get_table($nokia_fan_table) - : $session->get_table(Baseoid => $nokia_fan_table); - -if (defined($resultat)) { - $fan_exist=1; - foreach my $key ( keys %$resultat) { - verb("OID : $key, Desc : $$resultat{$key}"); - if ( $key =~ /$nokia_fan_status/ ) { - if ($$resultat{$key} != 1) { $fan_status=1; $num_fan_nok++} - $num_fan++; - } - } - if ($fan_status==0) { - $output.= ", ".$num_fan." fan OK"; - } else { - $output.= ", ".$num_fan_nok."/".$num_fan." fan CRITICAL"; - $global_status=2; - } -} - -# Get ps table -$resultat = (Net::SNMP->VERSION < 4) ? - $session->get_table($nokia_ps_table) - : $session->get_table(Baseoid => $nokia_ps_table); - -if (defined($resultat)) { - $ps_exist=1; - foreach my $key ( keys %$resultat) { - verb("OID : $key, Desc : $$resultat{$key}"); - if ( $key =~ /$nokia_ps_status/ ) { - if ($$resultat{$key} != 1) { $ps_status=1; $num_ps_nok++;} - $num_ps++; - } - if ( $key =~ /$nokia_ps_temp/ ) { - if ($$resultat{$key} != 1) { if ($ps_status==0) {$ps_status=2;$num_ps_nok++;} } - } - } - if ($ps_status==0) { - $output.= ", ".$num_ps." ps OK"; - } elsif ($ps_status==2) { - $output.= ", ".$num_ps_nok."/".$num_ps." ps WARNING (temp)"; - if ($global_status != 2) {$global_status=1;} - } else { - $output.= ", ".$num_ps_nok."/".$num_ps." ps CRITICAL"; - $global_status=2; - } -} - -$session->close; - -verb ("status : $global_status"); - -if ( ($fan_exist+$ps_exist+$temp_exist) == 0) { - print "No environemental informations found : UNKNOWN\n"; - exit $ERRORS{"UNKNOWN"}; -} - -if ($global_status==0) { - print $output." : all OK\n"; - exit $ERRORS{"OK"}; -} - -if ($global_status==1) { - print $output." : WARNING\n"; - exit $ERRORS{"WARNING"}; -} - -if ($global_status==2) { - print $output." : CRITICAL\n"; - exit $ERRORS{"CRITICAL"}; -} -} - -############# Bluecoat checks -if ($o_check_type eq "bc") { - - verb("Checking bluecoat env"); - - my $resultat; - my $global_status=0; - my ($num_fan,$num_other,$num_volt,$num_temp,$num_disk)=(0,0,0,0,0); - my ($num_fan_ok,$num_other_ok,$num_volt_ok,$num_temp_ok,$num_disk_ok)=(0,0,0,0,0); - my $output=""; - my $output_perf=""; - - - # get sensor table - $resultat = (Net::SNMP->VERSION < 4) ? - $session->get_table($bc_sensor_table) - : $session->get_table(Baseoid => $bc_sensor_table); - if (defined($resultat)) { - verb ("sensor table found"); - my ($sens_name,$sens_status,$sens_value,$sens_unit)=(undef,undef,undef,undef); - foreach my $key ( keys %$resultat) { - if ($key =~ /$bc_sensor_Name/) { - $sens_name = $$resultat{$key}; - $key =~ s/$bc_sensor_Name//; - $sens_unit = $$resultat{$bc_sensor_units.$key}; - if ($$resultat{$bc_sensor_Status.$key} != 1) { # sensor not operating : output and status unknown - if ($output ne "") { $output.=", ";} - $output .= $sens_name ." sensor ".$bc_SensorStatus[$$resultat{$bc_sensor_Status.$key}]; - if ($global_status==0) {$global_status=3;} - } else { # Get status - $sens_status=$bc_status_nagios[$$resultat{$bc_sensor_Code.$key}]; - if ($sens_status != 0) { # warn/critical/unknown : output - if ($output ne "") { $output.=", ";} - $output .= $sens_name . ":".$bc_SensorCode[$sens_status]; - set_status($sens_status,$global_status); - } - } - if (defined($o_perf)) { - if ($output_perf ne "") { $output_perf .=" ";} - $output_perf .= "'".$sens_name."'="; - my $perf_value = $$resultat{$bc_sensor_Value.$key} * 10 ** $$resultat{$bc_sensor_Scale.$key}; - $output_perf .= $perf_value; - } - ### FAN - if ($bc_mesure[$sens_unit] eq "rpm") { - $num_fan++;if ($sens_status == 0) { $num_fan_ok++; } - } elsif ($bc_mesure[$sens_unit] eq "celsius") { - $num_fan++;if ($sens_status == 0) { $num_temp_ok++; } - } elsif ($bc_mesure[$sens_unit] eq "volts") { - $num_volt++;if ($sens_status == 0) { $num_volt_ok++; } - } else { - $num_other++;if ($sens_status == 0) { $num_other_ok++;}} - } - } - } - - # Get disk table - $resultat = (Net::SNMP->VERSION < 4) ? - $session->get_table($bc_dsk_table) - : $session->get_table(Baseoid => $bc_dsk_table); - - if (defined($resultat)) { - foreach my $key ( keys %$resultat) { - verb("OID : $key, Desc : $$resultat{$key}"); - my ($dsk_name,$dsk_status)=(undef,undef,undef); - if ( $key =~ /$bc_dsk_status/ ) { - $num_disk++; - $dsk_status=$bc_dsk_status_nagios[$$resultat{$key}]; - if ( $dsk_status != 0) { - $key =~ s/$bc_dsk_status//; - $dsk_name = $$resultat{$bc_dsk_vendor.$key} . "(".$$resultat{$bc_dsk_serial.$key} . ")"; - if ($output ne "") { $output.=", ";} - $output .= $dsk_name . ":" . $bc_DiskStatus[$$resultat{$bc_dsk_status.$key}]; - set_status($dsk_status,$global_status); - } else { - $num_disk_ok++; - } - } - } - } - - if ($num_fan+$num_other+$num_volt+$num_temp+$num_disk == 0) { - print "No information found : UNKNOWN\n"; - exit $ERRORS{"UNKNOWN"}; - } - - if ($output ne "") { $output.=", ";} - if ($num_fan_ok != 0) { $output.= $num_fan_ok." fan OK ";} - if ($num_other_ok != 0) { $output.= $num_other_ok." other OK ";} - if ($num_volt_ok != 0) { $output.= $num_volt_ok." voltage OK ";} - if ($num_temp_ok != 0) { $output.= $num_temp_ok." temp OK ";} - if ($num_disk_ok != 0) { $output.= $num_disk_ok." disk OK ";} - - if (defined($o_perf)) { $output_perf = " | " . $output_perf;} - if ($global_status==3) { - print $output," : UNKNOWN",$output_perf,"\n"; - exit $ERRORS{"UNKNOWN"}; - } - if ($global_status==2) { - print $output," : CRITICAL",$output_perf,"\n"; - exit $ERRORS{"CRITICAL"}; - } - if ($global_status==1) { - print $output," : WARNING",$output_perf,"\n"; - exit $ERRORS{"WARNING"}; - } - print $output," : OK",$output_perf,"\n"; - exit $ERRORS{"OK"}; - -} - - -############# Ironport checks -if ($o_check_type eq "iron") { - -verb("Checking Ironport env"); - -my $resultat; -# status : 0=ok, 1=warn, 2=crit -my ($fan_status,$ps_status,$temp_status)=(0,0,0); -my ($fan_exist,$ps_exist,$temp_exist)=(0,0,0); -my ($num_fan,$num_ps,$num_temp)=(0,0,0); -my ($num_fan_nok,$num_ps_nok,$num_temp_nok)=(0,0,0); -my $global_status=0; -my $output=""; -# get temp if $o_temp is defined -if (defined($o_temp)) { - verb("Checking temp < $o_temp"); - $resultat = (Net::SNMP->VERSION < 4) ? - $session->get_table($iron_tmp_table) - : $session->get_table(Baseoid => $iron_tmp_table); - if (defined($resultat)) { - verb ("temp found"); - $temp_exist=1; - foreach my $key ( keys %$resultat) { - verb("OID : $key, Desc : $$resultat{$key}"); - if ( $key =~ /$iron_tmp_celcius/ ) { - verb("Status : $$resultat{$key}"); - if ($$resultat{$key} > $o_temp) { - my @index_oid=split(/\./,$key); - my $index_oid_key=pop(@index_oid); - $output .= ",Temp : ". $$resultat{ $iron_tmp_name.".".$index_oid_key}." : ".$$resultat{$key}." C"; - $temp_status=2; - $num_temp_nok++; - } - $num_temp++; - } - } - if ($temp_status==0) { - $output.= ", ".$num_temp." temp < ".$o_temp." OK"; - } else { - $output.= ", ".$num_temp_nok."/".$num_temp." temp probes CRITICAL"; - $global_status=2; - } - } -} - -# Get fan status if $o_fan is defined -if (defined($o_fan)) { - verb("Checking fan > $o_fan"); - $resultat = (Net::SNMP->VERSION < 4) ? - $session->get_table($iron_fan_table) - : $session->get_table(Baseoid => $iron_fan_table); - if (defined($resultat)) { - verb ("fan found"); - $fan_exist=1; - foreach my $key ( keys %$resultat) { - verb("OID : $key, Desc : $$resultat{$key}"); - if ( $key =~ /$iron_fan_rpm/ ) { - verb("Status : $$resultat{$key}"); - if ($$resultat{$key} < $o_fan) { - my @index_oid=split(/\./,$key); - my $index_oid_key=pop(@index_oid); - $output .= ",Fan ". $$resultat{ $iron_fan_name.".".$index_oid_key}." : ".$$resultat{$key}." RPM"; - $fan_status=2; - $num_fan_nok++; - } - $num_fan++; - } - } - if ($fan_status==0) { - $output.= ", ".$num_fan." fan > ".$o_fan." OK"; - } else { - $output.= ", ".$num_fan_nok."/".$num_fan." fans CRITICAL"; - $global_status=2; - } - } -} - -# Get power supply status - verb("Checking PS"); - $resultat = (Net::SNMP->VERSION < 4) ? - $session->get_table($iron_ps_table) - : $session->get_table(Baseoid => $iron_ps_table); - if (defined($resultat)) { - verb ("ps found"); - $ps_exist=1; - foreach my $key ( keys %$resultat) { - verb("OID : $key, Desc : $$resultat{$key}"); - if ( $key =~ /$iron_ps_status/ ) { - verb("Status : $iron_ps_status_name[$$resultat{$key}]"); - if ($iron_ps_status_nagios[$$resultat{$key}] != 0) { - my @index_oid=split(/\./,$key); - my $index_oid_key=pop(@index_oid); - $output .= ",PS ". $$resultat{$iron_ps_name.".".$index_oid_key}." : ".$iron_ps_status_name[$$resultat{$key}]; - $ps_status=2; - $num_ps_nok++; - } - $num_ps++; - } - } - if ($ps_status==0) { - $output.= ", ".$num_ps." ps OK"; - } else { - $output.= ", ".$num_ps_nok."/".$num_ps." ps CRITICAL"; - $global_status=2; - } - } - -$session->close; - -verb ("status : $global_status"); - -if ( ($fan_exist+$ps_exist+$temp_exist) == 0) { - print "No environemental informations found : UNKNOWN\n"; - exit $ERRORS{"UNKNOWN"}; -} - -$output =~ s/^,//; - -if ($global_status==0) { - print $output." : all OK\n"; - exit $ERRORS{"OK"}; -} - -if ($global_status==1) { - print $output." : WARNING\n"; - exit $ERRORS{"WARNING"}; -} - -if ($global_status==2) { - print $output." : CRITICAL\n"; - exit $ERRORS{"CRITICAL"}; -} -} - - -########### Foundry env checks ############## - -if ($o_check_type eq "foundry") { - -verb("Checking foundry env"); - -my $global_status=0; # status to UNKNOWN -my $output=""; - -# Get temperature - -my @foundry_temp_oid=($foundry_temp,$foundry_temp_warn,$foundry_temp_crit); - -my $result_temp = $session->get_request( - Varbindlist => \@foundry_temp_oid -); - -my $temp_found=0; -if (defined($result_temp)) { - $temp_found=1; - #Temp found - $output = "Temp : " . $$result_temp{$foundry_temp} / 2; - if ($$result_temp{$foundry_temp} > $$result_temp{$foundry_temp_crit}) { # Temp above critical - $output.= " > ". $$result_temp{$foundry_temp_crit} / 2 . " : CRITICAL"; - $global_status=3; - } elsif ( $$result_temp{$foundry_temp} > $$result_temp{$foundry_temp_warn}) { # Temp above warning - $output.= " > ". $$result_temp{$foundry_temp_warn} / 2 . " : WARNING"; - $global_status=2; - } else { - $output.= " < ". $$result_temp{$foundry_temp_warn} / 2 . " : OK"; - $global_status=1; - } -} - -# Get PS table (TODO : Bug in FAN table, see with Foundry). - -my $result_ps = (Net::SNMP->VERSION < 4) ? - $session->get_table($foundry_ps_table) - : $session->get_table(Baseoid => $foundry_ps_table); - -my $ps_num=0; -if (defined($result_ps)) { - $output .=", " if defined($output); - foreach my $key ( keys %$result_ps) { - verb("OID : $key, Desc : $$result_ps{$key}"); - if ($$result_ps{$key} =~ /$foundry_ps_desc/) { - $ps_num++; - my @oid_list = split (/\./,$key); - my $index_ps = pop (@oid_list); - $index_ps= $foundry_ps_status . "." . $index_ps; - if (defined ($$result_ps{$index_ps})) { - if ($$result_ps{$index_ps} == 3) { - $output.="PS ".$$result_ps{$key}." : FAILURE"; - $global_status=3; - } elsif ($$result_ps{$index_ps} == 2) { - $global_status=1 if ($global_status==0); - } else { - $output.= "ps ".$$result_ps{$key}." : OTHER"; - } - } else { - $output.= "ps ".$$result_ps{$key}." : UNDEFINED STATUS"; - } - } - } -} - -$session->close; - -if (($ps_num+$temp_found) == 0) { - print "No data found : UNKNOWN\n"; - exit $ERRORS{"UNKNOWN"}; -} - -if ($global_status==1) { - print $output." : all OK\n"; - exit $ERRORS{"OK"}; -} - -if ($global_status==2) { - print $output." : WARNING\n"; - exit $ERRORS{"WARNING"}; -} - -if ($global_status==3) { - print $output." : CRITICAL\n"; - exit $ERRORS{"CRITICAL"}; -} - -print $output." : UNKNOWN\n"; -exit $ERRORS{"UNKNOWN"}; - -} - -exit (3); diff --git a/check_snmp_int.pl b/check_snmp_int.pl deleted file mode 100755 index 17ab65c..0000000 --- a/check_snmp_int.pl +++ /dev/null @@ -1,800 +0,0 @@ -#!/usr/bin/perl -w -############################## check_snmp_int ############## -# Version : 1.4.6 -# Date : April 23 2007 -# Author : Patrick Proy ( patrick at proy.org ) -# Help : http://nagios.manubulon.com -# Licence : GPL - http://www.fsf.org/licenses/gpl.txt -# Contrib : J. Jungmann, S. Probst, R. Leroy, M. Berger -# TODO : -# Check isdn "dormant" state -# Maybe put base directory for performance as an option -################################################################# -# -# Help : ./check_snmp_int.pl -h -# -use strict; -use Net::SNMP; -use Getopt::Long; - -############### BASE DIRECTORY FOR TEMP FILE ######## -my $o_base_dir="/tmp/tmp_Nagios_int."; -my $file_history=200; # number of data to keep in files. - -# Nagios specific - -use lib "/usr/local/nagios/libexec"; -use utils qw(%ERRORS $TIMEOUT); -#my $TIMEOUT = 5; -#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - -# SNMP Datas - -my $inter_table= '.1.3.6.1.2.1.2.2.1'; -my $index_table = '1.3.6.1.2.1.2.2.1.1'; -my $descr_table = '1.3.6.1.2.1.2.2.1.2'; -my $oper_table = '1.3.6.1.2.1.2.2.1.8.'; -my $admin_table = '1.3.6.1.2.1.2.2.1.7.'; -my $speed_table = '1.3.6.1.2.1.2.2.1.5.'; -my $in_octet_table = '1.3.6.1.2.1.2.2.1.10.'; -my $in_octet_table_64 = '1.3.6.1.2.1.31.1.1.1.6.'; -my $in_error_table = '1.3.6.1.2.1.2.2.1.14.'; -my $in_discard_table = '1.3.6.1.2.1.2.2.1.13.'; -my $out_octet_table = '1.3.6.1.2.1.2.2.1.16.'; -my $out_octet_table_64 = '1.3.6.1.2.1.31.1.1.1.10.'; -my $out_error_table = '1.3.6.1.2.1.2.2.1.20.'; -my $out_discard_table = '1.3.6.1.2.1.2.2.1.19.'; - -my %status=(1=>'UP',2=>'DOWN',3=>'TESTING',4=>'UNKNOWN',5=>'DORMANT',6=>'NotPresent',7=>'lowerLayerDown'); - -# Globals - -my $Version='1.4.6'; - -# Standard options -my $o_host = undef; # hostname -my $o_port = 161; # port -my $o_descr = undef; # description filter -my $o_help= undef; # wan't some help ? -my $o_admin= undef; # admin status instead of oper -my $o_inverse= undef; # Critical when up -my $o_verb= undef; # verbose mode -my $o_version= undef; # print version -my $o_noreg= undef; # Do not use Regexp for name -my $o_short= undef; # set maximum of n chars to be displayed -my $o_label= undef; # add label before speed (in, out, etc...). -# Performance data options -my $o_perf= undef; # Output performance data -my $o_perfe= undef; # Output discard/error also in perf data -my $o_perfs= undef; # include speed in performance output (-S) -my $o_perfp= undef; # output performance data in % of max speed (-y) -my $o_perfr= undef; # output performance data in bits/s or Bytes/s (-Y) -# Speed/error checks -my $o_checkperf= undef; # checks in/out/err/disc values -my $o_delta= 300; # delta of time of perfcheck (default 5min) -my $o_ext_checkperf= undef; # extended perf checks (+error+discard) -my $o_warn_opt= undef; # warning options -my $o_crit_opt= undef; # critical options -my $o_kbits= undef; # Warn and critical in Kbits instead of KBytes -my @o_warn= undef; # warning levels of perfcheck -my @o_crit= undef; # critical levels of perfcheck -my $o_highperf= undef; # Use 64 bits counters -my $o_meg= undef; # output in MBytes or Mbits (-M) -my $o_gig= undef; # output in GBytes or Gbits (-G) -my $o_prct= undef; # output in % of max speed (-u) - -my $o_timeout= undef; # Timeout (Default 5) -# SNMP Message size parameter (Makina Corpus contrib) -my $o_octetlength=undef; -# Login options specific -my $o_community = undef; # community -my $o_version2 = undef; #use snmp v2c -my $o_login= undef; # Login for snmpv3 -my $o_passwd= undef; # Pass for snmpv3 -my $v3protocols=undef; # V3 protocol list. -my $o_authproto='md5'; # Auth protocol -my $o_privproto='des'; # Priv protocol -my $o_privpass= undef; # priv password - -# Readable names for counters (M. Berger contrib) -my @countername = ( "in=" , "out=" , "errors-in=" , "errors-out=" , "discard-in=" , "discard-out=" ); -my $checkperf_out_desc; - -# functions - -sub read_file { - # Input : File, items_number - # Returns : array of value : [line][item] - my ($traffic_file,$items_number)=@_; - my ($ligne,$n_rows)=(undef,0); - my (@last_values,@file_values,$i); - open(FILE,"<".$traffic_file) || return (1,0,0); - - while($ligne = ) - { - chomp($ligne); - @file_values = split(":",$ligne); - #verb("@file_values"); - if ($#file_values >= ($items_number-1)) { - # check if there is enough data, else ignore line - for ( $i=0 ; $i< $items_number ; $i++ ) {$last_values[$n_rows][$i]=$file_values[$i];} - $n_rows++; - } - } - close FILE; - if ($n_rows != 0) { - return (0,$n_rows,@last_values); - } else { - return (1,0,0); - } -} - -sub write_file { - # Input : file , rows, items, array of value : [line][item] - # Returns : 0 / OK, 1 / error - my ($file_out,$rows,$item,@file_values)=@_; - my $start_line= ($rows > $file_history) ? $rows - $file_history : 0; - if ( open(FILE2,">".$file_out) ) { - for (my $i=$start_line;$i<$rows;$i++) { - for (my $j=0;$j<$item;$j++) { - print FILE2 $file_values[$i][$j]; - if ($j != ($item -1)) { print FILE2 ":" }; - } - print FILE2 "\n"; - } - close FILE2; - return 0; - } else { - return 1; - } -} - -sub p_version { print "check_snmp_int version : $Version\n"; } - -sub print_usage { - print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,) [-p ] -n [-i] [-a] [-r] [-f[eSyY]] [-k[qBMGu] -g -w -c -d] [-o ] [-t ] [-s] --label [-V]\n"; -} - -sub isnnum { # Return true if arg is not a number - my $num = shift; - if ( $num =~ /^(\d+\.?\d*)|(^\.\d+)$/ ) { return 0 ;} - return 1; -} - -sub help { - print "\nSNMP Network Interface Monitor for Nagios version ",$Version,"\n"; - print "GPL licence, (c)2004-2007 Patrick Proy\n\n"; - print_usage(); - print <, - : Authentication protocol (md5|sha : default md5) - : Priv protocole (des|aes : default des) --P, --port=PORT - SNMP port (Default 161) --n, --name=NAME - Name in description OID (eth0, ppp0 ...). - This is treated as a regexp : -n eth will match eth0,eth1,... - Test it before, because there are known bugs (ex : trailling /) --r, --noregexp - Do not use regexp to match NAME in description OID --i, --inverse - Make critical when up --a, --admin - Use administrative status instead of operational --o, --octetlength=INTEGER - max-size of the SNMP message, usefull in case of Too Long responses. - Be carefull with network filters. Range 484 - 65535, default are - usually 1472,1452,1460 or 1440. --f, --perfparse - Perfparse compatible output (no output when interface is down). --e, --error - Add error & discard to Perfparse output --S, --intspeed - Include speed in performance output in bits/s --y, --perfprct ; -Y, --perfspeed - -y : output performance data in % of max speed - -Y : output performance data in bits/s or Bytes/s (depending on -B) --k, --perfcheck ; -q, --extperfcheck - -k check the input/ouput bandwidth of the interface - -q also check the error and discard input/output ---label - Add label before speed in output : in=, out=, errors-out=, etc... --g, --64bits - Use 64 bits counters instead of the standard counters - when checking bandwidth & performance data. - You must use snmp v2c or v3 to get 64 bits counters. --d, --delta=seconds - make an average of seconds (default 300=5min) --B, --kbits - Make the warning and critical levels in K|M|G Bits/s instead of K|M|G Bytes/s --G, --giga ; -M, --mega ; -u, --prct - -G : Make the warning and critical levels in Gbps (with -B) or GBps - -M : Make the warning and critical levels in Mbps (with -B) or MBps - -u : Make the warning and critical levels in % of reported interface speed. --w, --warning=input,output[,error in,error out,discard in,discard out] - warning level for input / output bandwidth (0 for no warning) - unit depends on B,M,G,u options - warning for error & discard input / output in error/min (need -q) --c, --critical=input,output[,error in,error out,discard in,discard out] - critical level for input / output bandwidth (0 for no critical) - unit depends on B,M,G,u options - critical for error & discard input / output in error/min (need -q) --s, --short=int - Make the output shorter : only the first chars of the interface(s) - If the number is negative, then get the LAST caracters. --t, --timeout=INTEGER - timeout for SNMP in seconds (Default: 5) --V, --version - prints version number -Note : when multiple interface are selected with regexp, - all be must be up (or down with -i) to get an OK result. -EOT -} - -# For verbose output -sub verb { my $t=shift; print $t,"\n" if defined($o_verb) ; } - -sub check_options { - Getopt::Long::Configure ("bundling"); - GetOptions( - 'v' => \$o_verb, 'verbose' => \$o_verb, - 'h' => \$o_help, 'help' => \$o_help, - 'H:s' => \$o_host, 'hostname:s' => \$o_host, - 'p:i' => \$o_port, 'port:i' => \$o_port, - 'n:s' => \$o_descr, 'name:s' => \$o_descr, - 'C:s' => \$o_community, 'community:s' => \$o_community, - '2' => \$o_version2, 'v2c' => \$o_version2, - 'l:s' => \$o_login, 'login:s' => \$o_login, - 'x:s' => \$o_passwd, 'passwd:s' => \$o_passwd, - 'X:s' => \$o_privpass, 'privpass:s' => \$o_privpass, - 'L:s' => \$v3protocols, 'protocols:s' => \$v3protocols, - 't:i' => \$o_timeout, 'timeout:i' => \$o_timeout, - 'i' => \$o_inverse, 'inverse' => \$o_inverse, - 'a' => \$o_admin, 'admin' => \$o_admin, - 'r' => \$o_noreg, 'noregexp' => \$o_noreg, - 'V' => \$o_version, 'version' => \$o_version, - 'f' => \$o_perf, 'perfparse' => \$o_perf, - 'e' => \$o_perfe, 'error' => \$o_perfe, - 'k' => \$o_checkperf, 'perfcheck' => \$o_checkperf, - 'q' => \$o_ext_checkperf, 'extperfcheck' => \$o_ext_checkperf, - 'w:s' => \$o_warn_opt, 'warning:s' => \$o_warn_opt, - 'c:s' => \$o_crit_opt, 'critical:s' => \$o_crit_opt, - 'B' => \$o_kbits, 'kbits' => \$o_kbits, - 's:i' => \$o_short, 'short:i' => \$o_short, - 'g' => \$o_highperf, '64bits' => \$o_highperf, - 'S' => \$o_perfs, 'intspeed' => \$o_perfs, - 'y' => \$o_perfp, 'perfprct' => \$o_perfp, - 'Y' => \$o_perfr, 'perfspeed' => \$o_perfr, - 'M' => \$o_meg, 'mega' => \$o_meg, - 'G' => \$o_gig, 'giga' => \$o_gig, - 'u' => \$o_prct, 'prct' => \$o_prct, - 'o:i' => \$o_octetlength, 'octetlength:i' => \$o_octetlength, - 'label' => \$o_label, - 'd:i' => \$o_delta, 'delta:i' => \$o_delta - ); - if (defined ($o_help) ) { help(); exit $ERRORS{"UNKNOWN"}}; - if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"}}; - if ( ! defined($o_descr) || ! defined($o_host) ) # check host and filter - { print_usage(); exit $ERRORS{"UNKNOWN"}} - # check snmp information - if ( !defined($o_community) && (!defined($o_login) || !defined($o_passwd)) ) - { print "Put snmp login info!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if ((defined($o_login) || defined($o_passwd)) && (defined($o_community) || defined($o_version2)) ) - { print "Can't mix snmp v1,2c,3 protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if (defined ($v3protocols)) { - if (!defined($o_login)) { print "Put snmp V3 login info with protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - my @v3proto=split(/,/,$v3protocols); - if ((defined ($v3proto[0])) && ($v3proto[0] ne "")) {$o_authproto=$v3proto[0]; } # Auth protocol - if (defined ($v3proto[1])) {$o_privproto=$v3proto[1]; } # Priv protocol - if ((defined ($v3proto[1])) && (!defined($o_privpass))) { - print "Put snmp V3 priv login info with priv protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - } - if (defined($o_timeout) && (isnnum($o_timeout) || ($o_timeout < 2) || ($o_timeout > 60))) - { print "Timeout must be >1 and <60 !\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if (!defined($o_timeout)) {$o_timeout=5;} - # Check snmpv2c or v3 with 64 bit counters - if ( defined ($o_highperf) && (!defined($o_version2) && defined($o_community))) - { print "Can't get 64 bit counters with snmp version 1\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if (defined ($o_highperf)) { - if (eval "require bigint") { - use bigint; - } else { print "Need bigint module for 64 bit counters\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - } - - # check if -e without -f - if ( defined($o_perfe) && !defined($o_perf)) - { print "Cannot output error without -f option!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if (defined ($o_perfr) && defined($o_perfp) ) { - print "-Y and -y options are exclusives\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if ((defined ($o_perfr) || defined($o_perfp) ) && !defined($o_checkperf)) { - print "Cannot put -Y or -y options without perf check option (-k) \n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if (defined ($o_short)) { - #TODO maybe some basic tests ? caracters return empty string - } - if (defined ($o_checkperf)) { - @o_warn=split(/,/,$o_warn_opt); - if (defined($o_ext_checkperf) && ($#o_warn != 5)) { - print "6 warning levels for extended checks \n"; print_usage(); exit $ERRORS{"UNKNOWN"} - } - if (!defined($o_ext_checkperf) &&($#o_warn !=1 )){ - print "2 warning levels for bandwidth checks \n"; print_usage(); exit $ERRORS{"UNKNOWN"} - } - @o_crit=split(/,/,$o_crit_opt); - #verb(" $o_crit_opt :: $#o_crit : @o_crit"); - if (defined($o_ext_checkperf) && ($#o_crit != 5)) { - print "6 critical levels for extended checks \n"; print_usage(); exit $ERRORS{"UNKNOWN"} - } - if (!defined($o_ext_checkperf) && ($#o_crit !=1 )) { - print "2 critical levels for bandwidth checks \n"; print_usage(); exit $ERRORS{"UNKNOWN"} - } - for (my $i=0;$i<=$#o_warn;$i++) { - if (($o_crit[$i]!=0)&&($o_warn[$i] > $o_crit[$i])) { - print "Warning must be < Critical level \n"; print_usage(); exit $ERRORS{"UNKNOWN"} - } - } - if ((defined ($o_meg) && defined($o_gig) ) || (defined ($o_meg) && defined($o_prct) )|| (defined ($o_gig) && defined($o_prct) )) { - print "-M -G and -u options are exclusives\n"; print_usage(); exit $ERRORS{"UNKNOWN"} - } - } - #### octet length checks - if (defined ($o_octetlength) && (isnnum($o_octetlength) || $o_octetlength > 65535 || $o_octetlength < 484 )) { - print "octet lenght must be < 65535 and > 484\n";print_usage(); exit $ERRORS{"UNKNOWN"}; - } -} - -########## MAIN ####### - -check_options(); - -# Check gobal timeout if snmp screws up -if (defined($TIMEOUT)) { - verb("Alarm at $TIMEOUT + 5"); - alarm($TIMEOUT+5); -} else { - verb("no timeout defined : $o_timeout + 10"); - alarm ($o_timeout+10); -} - -$SIG{'ALRM'} = sub { - print "No answer from host\n"; - exit $ERRORS{"UNKNOWN"}; -}; - -# Connect to host -my ($session,$error); -if ( defined($o_login) && defined($o_passwd)) { - # SNMPv3 login - if (!defined ($o_privpass)) { - verb("SNMPv3 AuthNoPriv login : $o_login, $o_authproto"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => '3', - -port => $o_port, - -username => $o_login, - -authpassword => $o_passwd, - -authprotocol => $o_authproto, - -timeout => $o_timeout - ); - } else { - verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => '3', - -username => $o_login, - -port => $o_port, - -authpassword => $o_passwd, - -authprotocol => $o_authproto, - -privpassword => $o_privpass, - -privprotocol => $o_privproto, - -timeout => $o_timeout - ); - } -} else { - if (defined ($o_version2)) { - # SNMPv2c Login - verb("SNMP v2c login"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => 2, - -community => $o_community, - -port => $o_port, - -timeout => $o_timeout - ); - } else { - # SNMPV1 login - verb("SNMP v1 login"); - ($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 $ERRORS{"UNKNOWN"}; -} - -if (defined($o_octetlength)) { - my $oct_resultat=undef; - my $oct_test= $session->max_msg_size(); - verb(" actual max octets:: $oct_test"); - $oct_resultat = $session->max_msg_size($o_octetlength); - if (!defined($oct_resultat)) { - printf("ERROR: Session settings : %s.\n", $session->error); - $session->close; - exit $ERRORS{"UNKNOWN"}; - } - $oct_test= $session->max_msg_size(); - verb(" new max octets:: $oct_test"); -} - -# Get desctiption table -my $resultat = $session->get_table( - Baseoid => $descr_table -); - -if (!defined($resultat)) { - printf("ERROR: Description table : %s.\n", $session->error); - $session->close; - exit $ERRORS{"UNKNOWN"}; -} -my @tindex = undef; -my @oids = undef; -my @descr = undef; -my (@oid_perf,@oid_perf_outoct,@oid_perf_inoct,@oid_perf_inerr,@oid_perf_outerr,@oid_perf_indisc,@oid_perf_outdisc)= - (undef,undef,undef,undef,undef,undef,undef); -my @oid_speed=undef; -my $num_int = 0; - -# Change to 64 bit counters if option is set : -if (defined($o_highperf)) { - $out_octet_table=$out_octet_table_64; - $in_octet_table=$in_octet_table_64; -} - - -# Select interface by regexp of exact match -# and put the oid to query in an array - -verb("Filter : $o_descr"); -foreach my $key ( keys %$resultat) { - verb("OID : $key, Desc : $$resultat{$key}"); - # test by regexp or exact match - my $test = defined($o_noreg) - ? $$resultat{$key} eq $o_descr - : $$resultat{$key} =~ /$o_descr/; - if ($test) { - # get the index number of the interface - my @oid_list = split (/\./,$key); - $tindex[$num_int] = pop (@oid_list); - # get the full description - $descr[$num_int]=$$resultat{$key}; - # Get rid of special caracters (specially for Windows) - $descr[$num_int] =~ s/[[:cntrl:]]//g; - # put the admin or oper oid in an array - $oids[$num_int]= defined ($o_admin) ? $admin_table . $tindex[$num_int] - : $oper_table . $tindex[$num_int] ; - # Put the performance oid - if (defined($o_perf) || defined($o_checkperf)) { - $oid_perf_inoct[$num_int]= $in_octet_table . $tindex[$num_int]; - $oid_perf_outoct[$num_int]= $out_octet_table . $tindex[$num_int]; - $oid_speed[$num_int]=$speed_table . $tindex[$num_int]; - if (defined($o_ext_checkperf) || defined($o_perfe)) { - $oid_perf_indisc[$num_int]= $in_discard_table . $tindex[$num_int]; - $oid_perf_outdisc[$num_int]= $out_discard_table . $tindex[$num_int]; - $oid_perf_inerr[$num_int]= $in_error_table . $tindex[$num_int]; - $oid_perf_outerr[$num_int]= $out_error_table . $tindex[$num_int]; - } - } - verb("Name : $descr[$num_int], Index : $tindex[$num_int]"); - $num_int++; - } -} -# No interface found -> error -if ( $num_int == 0 ) { print "ERROR : Unknown interface $o_descr\n" ; exit $ERRORS{"UNKNOWN"};} - -my ($result,$resultf)=(undef,undef); -# Get the requested oid values -$result = $session->get_request( - Varbindlist => \@oids -); -if (!defined($result)) { printf("ERROR: Status table : %s.\n", $session->error); $session->close; - exit $ERRORS{"UNKNOWN"}; -} -# Get the perf value if -f (performance) option defined or -k (check bandwidth) -if (defined($o_perf)||defined($o_checkperf)) { - @oid_perf=(@oid_perf_outoct,@oid_perf_inoct,@oid_perf_inerr,@oid_perf_outerr,@oid_perf_indisc,@oid_perf_outdisc,@oid_speed); - $resultf = $session->get_request( - Varbindlist => \@oid_perf - ); - if (!defined($resultf)) { printf("ERROR: Statistics table : %s.\n", $session->error); $session->close; - exit $ERRORS{"UNKNOWN"}; - } -} - - -$session->close; - -my $num_ok=0; -my @checkperf_out=undef; -my @checkperf_out_raw=undef; -### Bandwidth test variables -my $temp_file_name; -my ($return,@file_values)=(undef,undef); -my $n_rows=0; -my $n_items_check=(defined($o_ext_checkperf))?7:3; -my $timenow=time; -my $trigger=$timenow - ($o_delta - ($o_delta/10)); -my $trigger_low=$timenow - 3*$o_delta; -my ($old_value,$old_time)=undef; -my $speed_unit=undef; - -# define the OK value depending on -i option -my $ok_val= defined ($o_inverse) ? 2 : 1; -my $final_status = 0; -my ($print_out,$perf_out)=(undef,undef); - -# make all checks and output for all interfaces -for (my $i=0;$i < $num_int; $i++) { - $print_out.=", " if (defined($print_out)); - $perf_out .= " " if (defined ($perf_out)) ; - my $usable_data=1; - # Get the status of the current interface - my $int_status= defined ($o_admin) ? $$result{$admin_table . $tindex[$i]} - : $$result{ $oper_table . $tindex[$i] }; - - # Make the bandwith & error checks if necessary - if (defined ($o_checkperf) && $int_status==1) { - $temp_file_name=$descr[$i]; - $temp_file_name =~ s/[ ;\/]/_/g; - $temp_file_name = $o_base_dir . $o_host ."." . $temp_file_name; - # First, read entire file - my @ret_array=read_file($temp_file_name,$n_items_check); - $return = shift(@ret_array); - $n_rows = shift(@ret_array); - if ($n_rows != 0) { @file_values = @ret_array }; - verb ("File read returns : $return with $n_rows rows"); - verb ("Interface speed : $$resultf{$oid_speed[$i]}"); - #make the checks if the file is OK - if ($return ==0) { - my $j=$n_rows-1; - @checkperf_out=undef; - @checkperf_out_raw=undef; - do { - if ($file_values[$j][0] < $trigger) { - if ($file_values[$j][0] > $trigger_low) { - # Define the speed metric ( K | M | G ) (Bits|Bytes) or % - my $speed_metric=undef; - if (defined($o_prct)) { # in % of speed - # Speed is in bits/s, calculated speed is in Bytes/s - $speed_metric=$$resultf{$oid_speed[$i]}/800; - $speed_unit="%"; - } else { - if (defined($o_kbits)) { # metric in bits - if (defined($o_meg)) { # in Mbit/s = 1000000 bit/s - $speed_metric=125000; # (1000/8) * 1000 - $speed_unit="Mbps"; - } elsif (defined($o_gig)) { # in Gbit/s = 1000000000 bit/s - $speed_metric=125000000; # (1000/8) * 1000 * 1000 - $speed_unit="Gbps"; - } else { # in Kbits - $speed_metric=125; # ( 1000/8 ) - $speed_unit="Kbps"; - } - } else { # metric in byte - if (defined($o_meg)) { # in Mbits - $speed_metric=1048576; # 1024^2 - $speed_unit="MBps"; - } elsif (defined($o_gig)) { # in Mbits - $speed_metric=1073741824; # 1024^3 - $speed_unit="GBps"; - } else { - $speed_metric=1024; # 1024^3 - $speed_unit="KBps"; - } - } - } - # check if the counter is back to 0 after 2^32 / 2^64. - # First set the modulus depending on highperf counters or not - my $overfl_mod = defined ($o_highperf) ? 18446744073709551616 : 4294967296; - # Check counter (s) - my $overfl = ($$resultf{$oid_perf_inoct[$i]} >= $file_values[$j][1] ) ? 0 : $overfl_mod; - $checkperf_out_raw[0] = ( ($overfl + $$resultf{$oid_perf_inoct[$i]} - $file_values[$j][1])/ - ($timenow - $file_values[$j][0] )); - $checkperf_out[0] = $checkperf_out_raw[0] / $speed_metric; - - $overfl = ($$resultf{$oid_perf_outoct[$i]} >= $file_values[$j][2] ) ? 0 : $overfl_mod; - $checkperf_out_raw[1] = ( ($overfl + $$resultf{$oid_perf_outoct[$i]} - $file_values[$j][2])/ - ($timenow - $file_values[$j][0] )); - $checkperf_out[1] = $checkperf_out_raw[1] / $speed_metric; - - if (defined($o_ext_checkperf)) { - $checkperf_out[2] = ( ($$resultf{$oid_perf_inerr[$i]} - $file_values[$j][3])/ - ($timenow - $file_values[$j][0] ))*60; - $checkperf_out[3] = ( ($$resultf{$oid_perf_outerr[$i]} - $file_values[$j][4])/ - ($timenow - $file_values[$j][0] ))*60; - $checkperf_out[4] = ( ($$resultf{$oid_perf_indisc[$i]} - $file_values[$j][5])/ - ($timenow - $file_values[$j][0] ))*60; - $checkperf_out[5] = ( ($$resultf{$oid_perf_outdisc[$i]} - $file_values[$j][6])/ - ($timenow - $file_values[$j][0] ))*60; - } - } - } - $j--; - } while ( ($j>=0) && (!defined($checkperf_out[0])) ); - } - # Put the new values in the array and write the file - $file_values[$n_rows][0]=$timenow; - $file_values[$n_rows][1]=$$resultf{$oid_perf_inoct[$i]}; - $file_values[$n_rows][2]=$$resultf{$oid_perf_outoct[$i]}; - if (defined($o_ext_checkperf)) { # Add other values (error & disc) - $file_values[$n_rows][3]=$$resultf{$oid_perf_inerr[$i]}; - $file_values[$n_rows][4]=$$resultf{$oid_perf_outerr[$i]}; - $file_values[$n_rows][5]=$$resultf{$oid_perf_indisc[$i]}; - $file_values[$n_rows][6]=$$resultf{$oid_perf_outdisc[$i]}; - } - $n_rows++; - $return=write_file($temp_file_name,$n_rows,$n_items_check,@file_values); - verb ("Write file returned : $return"); - # Print the basic status - if (defined ($o_short)) { - my $short_desc=undef; - if ($o_short < 0) {$short_desc=substr($descr[$i],$o_short);} - else {$short_desc=substr($descr[$i],0,$o_short);} - $print_out.=sprintf("%s:%s",$short_desc, $status{$int_status} ); - } else { - $print_out.=sprintf("%s:%s",$descr[$i], $status{$int_status} ); - } - if ($return !=0) { # On error writing, return Unknown status - $final_status=3; - $print_out.= " !!Unable to write file ".$temp_file_name." !! "; - } - # print the other checks if it was calculated - if (defined($checkperf_out[0])) { - $print_out.= " ("; - # check 2 or 6 values depending on ext_check_perf - my $num_checkperf=(defined($o_ext_checkperf))?6:2; - for (my $l=0;$l < $num_checkperf;$l++) { - # Set labels if needed - $checkperf_out_desc= (defined($o_label)) ? $countername[$l] : ""; - verb("Interface $i, check $l : $checkperf_out[$l]"); - if ($l!=0) {$print_out.="/";} - if (($o_crit[$l]!=0) && ($checkperf_out[$l]>$o_crit[$l])) { - $final_status=2; - $print_out.= sprintf("CRIT %s%.1f",$checkperf_out_desc,$checkperf_out[$l]); - } elsif (($o_warn[$l]!=0) && ($checkperf_out[$l]>$o_warn[$l])) { - $final_status=($final_status==2)?2:1; - $print_out.= sprintf("WARN %s%.1f",$checkperf_out_desc,$checkperf_out[$l]); - } else { - $print_out.= sprintf("%s%.1f",$checkperf_out_desc,$checkperf_out[$l]); - } - if ( $l==0 || $l == 1) { $print_out.= $speed_unit; } - } - $print_out .= ")"; - } else { # Return unknown when no data - $print_out.= " No usable data on file (".$n_rows." rows) "; - $final_status=3;$usable_data=0; - } - } else { - if (defined ($o_short)) { - my $short_desc=undef; - if ($o_short < 0) {$short_desc=substr($descr[$i],$o_short);} - else {$short_desc=substr($descr[$i],0,$o_short);} - $print_out.=sprintf("%s:%s",$short_desc, $status{$int_status} ); - } else { - $print_out.=sprintf("%s:%s",$descr[$i], $status{$int_status} ); - } - } - # Get rid of special caracters for performance in description - $descr[$i] =~ s/'\/\(\)/_/g; - if ( $int_status == $ok_val) { - $num_ok++; - } - if (( $int_status == 1 ) && defined ($o_perf)) { - if (defined ($o_perfp)) { # output in % of speed - if ($usable_data==1) { - $perf_out .= "'" . $descr[$i] ."_in_prct'="; - $perf_out .= sprintf("%.0f",$checkperf_out_raw[0] * 800 / $$resultf{$oid_speed[$i]}) ."%;"; - $perf_out .= ($o_warn[0]!=0) ? $o_warn[0] . ";" : ";"; - $perf_out .= ($o_crit[0]!=0) ? $o_crit[0] . ";" : ";"; - $perf_out .= "0;100 "; - $perf_out .= "'" . $descr[$i] ."_out_prct'="; - $perf_out .= sprintf("%.0f",$checkperf_out_raw[1] * 800 / $$resultf{$oid_speed[$i]}) ."%;"; - $perf_out .= ($o_warn[1]!=0) ? $o_warn[1] . ";" : ";"; - $perf_out .= ($o_crit[1]!=0) ? $o_crit[1] . ";" : ";"; - $perf_out .= "0;100 "; - } - } elsif (defined ($o_perfr)) { # output in bites or Bytes /s - if ($usable_data==1) { - if (defined($o_kbits)) { # bps - # put warning and critical levels into bps or Bps - my $warn_factor = (defined($o_meg)) ? 1000000 : (defined($o_gig)) ? 1000000000 : 1000; - $perf_out .= "'" . $descr[$i] ."_in_bps'="; - $perf_out .= sprintf("%.0f",$checkperf_out_raw[0] * 8) .";"; - $perf_out .= ($o_warn[0]!=0) ? $o_warn[0]*$warn_factor . ";" : ";"; - $perf_out .= ($o_crit[0]!=0) ? $o_crit[0]*$warn_factor . ";" : ";"; - $perf_out .= "0;". $$resultf{$oid_speed[$i]} ." "; - $perf_out .= "'" . $descr[$i] ."_out_bps'="; - $perf_out .= sprintf("%.0f",$checkperf_out_raw[1] * 8) .";"; - $perf_out .= ($o_warn[1]!=0) ? $o_warn[1]*$warn_factor . ";" : ";"; - $perf_out .= ($o_crit[1]!=0) ? $o_crit[1]*$warn_factor . ";" : ";"; - $perf_out .= "0;". $$resultf{$oid_speed[$i]} ." "; - } else { # Bps - my $warn_factor = (defined($o_meg)) ? 1048576 : (defined($o_gig)) ? 1073741824 : 1024; - $perf_out .= "'" . $descr[$i] ."_in_Bps'=" . sprintf("%.0f",$checkperf_out_raw[0]) .";"; - $perf_out .= ($o_warn[0]!=0) ? $o_warn[0]*$warn_factor . ";" : ";"; - $perf_out .= ($o_crit[0]!=0) ? $o_crit[0]*$warn_factor . ";" : ";"; - $perf_out .= "0;". $$resultf{$oid_speed[$i]} ." "; - $perf_out .= "'" . $descr[$i] ."_out_Bps'=" . sprintf("%.0f",$checkperf_out_raw[1]) .";" ; - $perf_out .= ($o_warn[1]!=0) ? $o_warn[1]*$warn_factor . ";" : ";"; - $perf_out .= ($o_crit[1]!=0) ? $o_crit[1]*$warn_factor . ";" : ";"; - $perf_out .= "0;". $$resultf{$oid_speed[$i]} ." "; - } - } - } else { # output in octet counter - $perf_out .= "'" . $descr[$i] ."_in_octet'=". $$resultf{$oid_perf_inoct[$i]} ."c "; - $perf_out .= "'" . $descr[$i] ."_out_octet'=". $$resultf{$oid_perf_outoct[$i]} ."c"; - } - if (defined ($o_perfe)) { - $perf_out .= " '" . $descr[$i] ."_in_error'=". $$resultf{$oid_perf_inerr[$i]} ."c "; - $perf_out .= "'" . $descr[$i] ."_in_discard'=". $$resultf{$oid_perf_indisc[$i]} ."c "; - $perf_out .= "'" . $descr[$i] ."_out_error'=". $$resultf{$oid_perf_outerr[$i]} ."c "; - $perf_out .= "'" . $descr[$i] ."_out_discard'=". $$resultf{$oid_perf_outdisc[$i]} ."c"; - } - if (defined ($o_perfs)) { - $perf_out .= " '" . $descr[$i] ."_speed_bps'=".$$resultf{$oid_speed[$i]}; - } - } -} - -# Only a few ms left... -alarm(0); - -# Check if all interface are OK -if ($num_ok == $num_int) { - if ($final_status==0) { - print $print_out,":", $num_ok, " UP: OK"; - if (defined ($o_perf)) { print " | ",$perf_out; } - print "\n"; - exit $ERRORS{"OK"}; - } elsif ($final_status==1) { - print $print_out,":(", $num_ok, " UP): WARNING"; - if (defined ($o_perf)) { print " | ",$perf_out; } - print "\n"; - exit $ERRORS{"WARNING"}; - } elsif ($final_status==2) { - print $print_out,":(", $num_ok, " UP): CRITICAL"; - if (defined ($o_perf)) { print " | ",$perf_out; } - print "\n"; - exit $ERRORS{"CRITICAL"}; - } else { - print $print_out,":(", $num_ok, " UP): UNKNOWN"; - if (defined ($perf_out)) { print " | ",$perf_out; } - print "\n"; - exit $ERRORS{"UNKNOWN"}; - } -} - -# else print the not OK interface number and exit (return is always critical if at least one int is down). - -print $print_out,": ", $num_int-$num_ok, " int NOK : CRITICAL"; -if (defined ($perf_out)) { print " | ",$perf_out; } -print "\n"; -exit $ERRORS{"CRITICAL"}; - diff --git a/check_snmp_linkproof_nhr.pl b/check_snmp_linkproof_nhr.pl deleted file mode 100755 index 387f188..0000000 --- a/check_snmp_linkproof_nhr.pl +++ /dev/null @@ -1,319 +0,0 @@ -#!/usr/bin/perl -w -############################## check_snmp_linkproof_nhr ################# -# Version : 1.0 -# Date : Aug 24 2006 -# Author : Patrick Proy ( patrick at proy.org) -# Help : http://www.manubulon.com/nagios/ -# Licence : GPL - http://www.fsf.org/licenses/gpl.txt -# Changelog : -# Contributors : -################################################################# -# -# Help : ./check_snmp_linkproof_nhr.pl -h -# - -use strict; -use Net::SNMP; -use Getopt::Long; - -# Nagios specific - -use lib "/usr/local/nagios/libexec"; -use utils qw(%ERRORS $TIMEOUT); -#my $TIMEOUT = 15; -#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - -# SNMP Datas - -my $lp_type = "1.3.6.1.4.1.89.35.1.38.1.1.13"; # node type (1=regular, 2=nhr). -my $lp_name = "1.3.6.1.4.1.89.35.1.38.1.1.2"; # nhr name -my $lp_users = "1.3.6.1.4.1.89.35.1.38.1.1.5"; # nhr users -my $lp_state = "1.3.6.1.4.1.89.35.1.38.1.1.3"; # state : 1=active, 2=Notinservice, 3= nonewsessions. -my $lp_port = "1.3.6.1.4.1.89.35.1.38.1.1.15"; # nhr users - - -# Globals - -my $Version='1.0'; - -my $o_host = undef; # hostname -my $o_community = undef; # community -my $o_port = 161; # port -my $o_help= undef; # wan't some help ? -my $o_verb= undef; # verbose mode -my $o_version= undef; # print version -# specific -my $o_nhr_num= undef; # nhr number TODO -my $o_nhr_max= undef; # Maximum connexions TODO - -my $o_timeout= undef; # Timeout (Default 5) -my $o_perf= undef; # Output performance data -my $o_version2= undef; # use snmp v2c -# SNMPv3 specific -my $o_login= undef; # Login for snmpv3 -my $o_passwd= undef; # Pass for snmpv3 -my $v3protocols=undef; # V3 protocol list. -my $o_authproto='md5'; # Auth protocol -my $o_privproto='des'; # Priv protocol -my $o_privpass= undef; # priv password - -# functions - -sub p_version { print "check_snmp_linkproof_nhr version : $Version\n"; } - -sub print_usage { - print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] [-f] [-t ] [-V]\n"; -} - -sub isnnum { # Return true if arg is not a number - my $num = shift; - if ( $num =~ /^(\d+\.?\d*)|(^\.\d+)$/ ) { return 0 ;} - return 1; -} - -sub help { - print "\nSNMP Radware Linkproof NHR monitor for Nagios version ",$Version,"\n"; - print "(c)2004-2006 Patrick Proy\n\n"; - print_usage(); - print <, - : Authentication protocol (md5|sha : default md5) - : Priv protocole (des|aes : default des) --P, --port=PORT - SNMP port (Default 161) --f, --perfparse - Perfparse compatible output --t, --timeout=INTEGER - timeout for SNMP in seconds (Default: 5) --V, --version - prints version number -EOT -} - -# For verbose output -sub verb { my $t=shift; print $t,"\n" if defined($o_verb) ; } - -sub check_options { - Getopt::Long::Configure ("bundling"); - GetOptions( - 'v' => \$o_verb, 'verbose' => \$o_verb, - 'h' => \$o_help, 'help' => \$o_help, - 'H:s' => \$o_host, 'hostname:s' => \$o_host, - 'p:i' => \$o_port, 'port:i' => \$o_port, - 'C:s' => \$o_community, 'community:s' => \$o_community, - 'l:s' => \$o_login, 'login:s' => \$o_login, - 'x:s' => \$o_passwd, 'passwd:s' => \$o_passwd, - 'X:s' => \$o_privpass, 'privpass:s' => \$o_privpass, - 'L:s' => \$v3protocols, 'protocols:s' => \$v3protocols, - 't:i' => \$o_timeout, 'timeout:i' => \$o_timeout, - 'V' => \$o_version, 'version' => \$o_version, - '2' => \$o_version2, 'v2c' => \$o_version2, - 'f' => \$o_perf, 'perfparse' => \$o_perf, - ); - # Basic checks - if (defined($o_timeout) && (isnnum($o_timeout) || ($o_timeout < 2) || ($o_timeout > 60))) - { print "Timeout must be >1 and <60 !\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if (!defined($o_timeout)) {$o_timeout=5;} - if (defined ($o_help) ) { help(); exit $ERRORS{"UNKNOWN"}}; - if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"}}; - if ( ! defined($o_host) ) # check host and filter - { print_usage(); exit $ERRORS{"UNKNOWN"}} - # check snmp information - if ( !defined($o_community) && (!defined($o_login) || !defined($o_passwd)) ) - { print "Put snmp login info!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if ((defined($o_login) || defined($o_passwd)) && (defined($o_community) || defined($o_version2)) ) - { print "Can't mix snmp v1,2c,3 protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if (defined ($v3protocols)) { - if (!defined($o_login)) { print "Put snmp V3 login info with protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - my @v3proto=split(/,/,$v3protocols); - if ((defined ($v3proto[0])) && ($v3proto[0] ne "")) {$o_authproto=$v3proto[0]; } # Auth protocol - if (defined ($v3proto[1])) {$o_privproto=$v3proto[1]; } # Priv protocol - if ((defined ($v3proto[1])) && (!defined($o_privpass))) { - print "Put snmp V3 priv login info with priv protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - } -} - -########## MAIN ####### - -check_options(); - -# Check gobal timeout if snmp screws up -if (defined($TIMEOUT)) { - verb("Alarm at $TIMEOUT + 5"); - alarm($TIMEOUT+5); -} else { - verb("no global timeout defined : $o_timeout + 10"); - alarm ($o_timeout+10); -} - -# Connect to host -my ($session,$error); -if ( defined($o_login) && defined($o_passwd)) { - # SNMPv3 login - verb("SNMPv3 login"); - if (!defined ($o_privpass)) { - verb("SNMPv3 AuthNoPriv login : $o_login, $o_authproto"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => '3', - -username => $o_login, - -authpassword => $o_passwd, - -authprotocol => $o_authproto, - -timeout => $o_timeout - ); - } else { - verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => '3', - -username => $o_login, - -authpassword => $o_passwd, - -authprotocol => $o_authproto, - -privpassword => $o_privpass, - -privprotocol => $o_privproto, - -timeout => $o_timeout - ); - } -} else { - if (defined ($o_version2)) { - # SNMPv2 Login - verb("SNMP v2c login"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => 2, - -community => $o_community, - -port => $o_port, - -timeout => $o_timeout - ); - } else { - # SNMPV1 login - verb("SNMP v1 login"); - ($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 $ERRORS{"UNKNOWN"}; -} - -my $exit_val=undef; -########### NHR checks ############## - -my $nhr_num=0; # nujmber of NHR -my @nhr_table=undef; # index of NHR -my $output=undef; -my $perf_output=""; -my @oids=undef; -my $inactive_nhr=0; -my $global_status=0; - -# Get load table -my $resultat = (Net::SNMP->VERSION < 4) ? - $session->get_table($lp_type) - : $session->get_table(Baseoid => $lp_type); - -if (!defined($resultat)) { - printf("ERROR: NHR table : %s.\n", $session->error); - $session->close; - exit $ERRORS{"UNKNOWN"}; -} -my $oidindex=0; -foreach my $key ( keys %$resultat) { - verb("OID : $key, Desc : $$resultat{$key}"); - if ($$resultat{$key} == 2) { # found NHR - $key =~ s/$lp_type\.//; - $nhr_table[$nhr_num++]=$key; - $oids[$oidindex++]=$lp_name.".".$key; - $oids[$oidindex++]=$lp_users.".".$key; - $oids[$oidindex++]=$lp_state.".".$key; - $oids[$oidindex++]=$lp_port.".".$key; - verb ("found nhr : $key"); - } -} - -if ($nhr_num==0) { - print "No NHR found : CRITICAL\n"; - exit $ERRORS{"CRITICAL"}; -} - -my $result=undef; -if (Net::SNMP->VERSION < 4) { - $result = $session->get_request(@oids); -} else { - if ($session->version == 0) { - # snmpv1 - $result = $session->get_request(-varbindlist => \@oids); - } else { - # snmp v2c or v3 : get_bulk_request is not really good for this, so do simple get - $result = $session->get_request(-varbindlist => \@oids); - } -} - -if (!defined($result)) { - printf("ERROR: NHR table get : %s.\n", $session->error); - $session->close; - exit $ERRORS{"UNKNOWN"}; -} - -my ($nhr_name,$nhr_state,$nhr_users)=(undef,undef,undef); -my @nhr_text_state=("","active","Not in service","No new session"); -for (my $i=0;$i<$nhr_num;$i++) { - if (defined ($output)) { $output .= "; ";} - $nhr_name=$$result{$lp_name .".".$nhr_table[$i]}; - $nhr_state=$$result{$lp_state .".".$nhr_table[$i]}; - $nhr_users=$$result{$lp_users .".".$nhr_table[$i]}; - $output .= $nhr_name ."(" . $nhr_users . "):" . $nhr_text_state[$nhr_state]; - if ($nhr_state == 1) { - if (defined ($o_perf)) { - if (defined ($perf_output)) { $perf_output .= " ";} - $perf_output .= $nhr_name."=".$nhr_users; - } - } elsif ($nhr_state == 2) { - $inactive_nhr++; $global_status=1; - } else { $global_status=1;} -} - -$session->close; - -if ($inactive_nhr == $nhr_num) { - $output .= " : CRITICAL"; - if (defined ($o_perf)) {$output .= " | " . $perf_output;} - print $output,"\n"; - exit $ERRORS{"CRITICAL"}; -} - -if ($global_status ==1) { - $output .= " : WARNING"; - if (defined ($o_perf)) {$output .= " | " . $perf_output;} - print $output,"\n"; - exit $ERRORS{"WARNING"}; -} - -$output .= " : OK"; -if (defined ($o_perf)) {$output .= " | " . $perf_output;} -print $output,"\n"; -exit $ERRORS{"OK"}; diff --git a/check_snmp_load.pl b/check_snmp_load.pl deleted file mode 100755 index f9512b8..0000000 --- a/check_snmp_load.pl +++ /dev/null @@ -1,731 +0,0 @@ -#!/usr/bin/perl -w -############################## check_snmp_load ################# -# Version : 1.3.2 -# Date : Jan 16 2007 -# Author : Patrick Proy ( patrick at proy.org) -# Help : http://www.manubulon.com/nagios/ -# Licence : GPL - http://www.fsf.org/licenses/gpl.txt -# Changelog : HP-UX load added. -# Contributors : F. Lacroix and many others !!! -################################################################# -# -# Help : ./check_snmp_load.pl -h -# - -use strict; -use Net::SNMP; -use Getopt::Long; - -# Nagios specific - -use lib "/usr/local/nagios/libexec"; -use utils qw(%ERRORS $TIMEOUT); -#my $TIMEOUT = 15; -#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - -# SNMP Datas - -# Generic with host-ressource-mib -my $base_proc = "1.3.6.1.2.1.25.3.3.1"; # oid for all proc info -my $proc_id = "1.3.6.1.2.1.25.3.3.1.1"; # list of processors (product ID) -my $proc_load = "1.3.6.1.2.1.25.3.3.1.2"; # %time the proc was not idle over last minute - -# Linux load - -my $linload_table= "1.3.6.1.4.1.2021.10.1"; # net-snmp load table -my $linload_name = "1.3.6.1.4.1.2021.10.1.2"; # text 'Load-1','Load-5', 'Load-15' -my $linload_load = "1.3.6.1.4.1.2021.10.1.3"; # effective load table - -# Cisco cpu/load - -my $cisco_cpu_5m = "1.3.6.1.4.1.9.2.1.58.0"; # Cisco CPU load (5min %) -my $cisco_cpu_1m = "1.3.6.1.4.1.9.2.1.57.0"; # Cisco CPU load (1min %) -my $cisco_cpu_5s = "1.3.6.1.4.1.9.2.1.56.0"; # Cisco CPU load (5sec %) - -# Cisco catalyst cpu/load - -my $ciscocata_cpu_5m = ".1.3.6.1.4.1.9.9.109.1.1.1.1.5.9"; # Cisco CPU load (5min %) -my $ciscocata_cpu_1m = ".1.3.6.1.4.1.9.9.109.1.1.1.1.3.9"; # Cisco CPU load (1min %) -my $ciscocata_cpu_5s = ".1.3.6.1.4.1.9.9.109.1.1.1.1.4.9"; # Cisco CPU load (5sec %) - -# Netscreen cpu/load - -my $nsc_cpu_5m = "1.3.6.1.4.1.3224.16.1.4.0"; # NS CPU load (5min %) -my $nsc_cpu_1m = "1.3.6.1.4.1.3224.16.1.2.0"; # NS CPU load (1min %) -my $nsc_cpu_5s = "1.3.6.1.4.1.3224.16.1.3.0"; # NS CPU load (5sec %) - -# AS/400 CPU - -my $as400_cpu = "1.3.6.1.4.1.2.6.4.5.1.0"; # AS400 CPU load (10000=100%); - -# Net-SNMP CPU - -my $ns_cpu_idle = "1.3.6.1.4.1.2021.11.11.0"; # Net-snmp cpu idle -my $ns_cpu_user = "1.3.6.1.4.1.2021.11.9.0"; # Net-snmp user cpu usage -my $ns_cpu_system = "1.3.6.1.4.1.2021.11.10.0"; # Net-snmp system cpu usage - -# Procurve CPU -my $procurve_cpu = "1.3.6.1.4.1.11.2.14.11.5.1.9.6.1.0"; # Procurve CPU Counter - -# Nokia CPU -my $nokia_cpu = "1.3.6.1.4.1.94.1.21.1.7.1.0"; # Nokia CPU % usage - -# Bluecoat Appliance -my $bluecoat_cpu = "1.3.6.1.4.1.3417.2.4.1.1.1.4.1"; # Bluecoat %cpu usage. - -# Fortigate CPU -my $fortigate_cpu = ".1.3.6.1.4.1.12356.1.8.0"; # Fortigate CPU % usage - -# Linkproof Appliance -my $linkproof_cpu= "1.3.6.1.4.1.89.35.1.55.0"; # CPU RE (Routing Engine Tasks) -# 1.3.6.1.4.1.89.35.1.53.0 : Ressource utilisation (%) Considers network utilization and internal CPU utilization -# 1.3.6.1.4.1.89.35.1.54 : CPU only (%) -# 1.3.6.1.4.1.89.35.1.55 : network only (%) - -# HP-UX cpu usage (thanks to krizb for the OIDs). -my $hpux_load_1_min="1.3.6.1.4.1.11.2.3.1.1.3.0"; -my $hpux_load_5_min="1.3.6.1.4.1.11.2.3.1.1.4.0"; -my $hpux_load_15_min="1.3.6.1.4.1.11.2.3.1.1.5.0"; - -# valid values -my @valid_types = ("stand","netsc","netsl","as400","cisco","cata","nsc","fg","bc","nokia","hp","lp","hpux"); -# CPU OID array -my %cpu_oid = ("netsc",$ns_cpu_idle,"as400",$as400_cpu,"bc",$bluecoat_cpu,"nokia",$nokia_cpu,"hp",$procurve_cpu,"lp",$linkproof_cpu,"fg",$fortigate_cpu); - -# Globals - -my $Version='1.3.2'; - -my $o_host = undef; # hostname -my $o_community = undef; # community -my $o_port = 161; # port -my $o_help= undef; # wan't some help ? -my $o_verb= undef; # verbose mode -my $o_version= undef; # print version -# check type : stand | netsc | netsl | as400 | cisco | cata | nsc | fg | bc | nokia | hp | lp | hpux -my $o_check_type= "stand"; -# End compatibility -my $o_warn= undef; # warning level -my @o_warnL= undef; # warning levels for Linux Load or Cisco CPU -my $o_crit= undef; # critical level -my @o_critL= undef; # critical level for Linux Load or Cisco CPU -my $o_timeout= undef; # Timeout (Default 5) -my $o_perf= undef; # Output performance data -my $o_version2= undef; # use snmp v2c -# SNMPv3 specific -my $o_login= undef; # Login for snmpv3 -my $o_passwd= undef; # Pass for snmpv3 -my $v3protocols=undef; # V3 protocol list. -my $o_authproto='md5'; # Auth protocol -my $o_privproto='des'; # Priv protocol -my $o_privpass= undef; # priv password - -# functions - -sub p_version { print "check_snmp_load version : $Version\n"; } - -sub print_usage { - print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -w -c -T=[stand|netsl|netsc|as400|cisco|cata|nsc|fg|bc|nokia|hp|lp|hpux] [-f] [-t ] [-V]\n"; -} - -sub isnnum { # Return true if arg is not a number - my $num = shift; - if ( $num =~ /^(\d+\.?\d*)|(^\.\d+)$/ ) { return 0 ;} - return 1; -} - -sub help { - print "\nSNMP Load & CPU Monitor for Nagios version ",$Version,"\n"; - print "GPL licence, (c)2004-2007 Patrick Proy\n\n"; - print_usage(); - print <, - : Authentication protocol (md5|sha : default md5) - : Priv protocole (des|aes : default des) --P, --port=PORT - SNMP port (Default 161) --w, --warn=INTEGER | INT,INT,INT - 1 value check : warning level for cpu in percent (on one minute) - 3 value check : comma separated level for load or cpu for 1min, 5min, 15min --c, --crit=INTEGER | INT,INT,INT - critical level for cpu in percent (on one minute) - 1 value check : critical level for cpu in percent (on one minute) - 3 value check : comma separated level for load or cpu for 1min, 5min, 15min --T, --type=stand|netsl|netsc|as400|cisco|bc|nokia|hp|lp - CPU check : - stand : standard MIBII (works with Windows), - can handle multiple CPU. - netsl : linux load provided by Net SNMP (1,5 & 15 minutes values) - netsc : cpu usage given by net-snmp (100-idle) - as400 : as400 CPU usage - cisco : Cisco CPU usage - cata : Cisco catalyst CPU usage - nsc : NetScreen CPU usage - fg : Fortigate CPU usage - bc : Bluecoat CPU usage - nokia : Nokia CPU usage - hp : HP procurve switch CPU usage - lp : Linkproof CPU usage - hpux : HP-UX load (1,5 & 15 minutes values) --f, --perfparse - Perfparse compatible output --t, --timeout=INTEGER - timeout for SNMP in seconds (Default: 5) --V, --version - prints version number -EOT -} - -# For verbose output -sub verb { my $t=shift; print $t,"\n" if defined($o_verb) ; } - -sub check_options { - Getopt::Long::Configure ("bundling"); - GetOptions( - 'v' => \$o_verb, 'verbose' => \$o_verb, - 'h' => \$o_help, 'help' => \$o_help, - 'H:s' => \$o_host, 'hostname:s' => \$o_host, - 'p:i' => \$o_port, 'port:i' => \$o_port, - 'C:s' => \$o_community, 'community:s' => \$o_community, - 'l:s' => \$o_login, 'login:s' => \$o_login, - 'x:s' => \$o_passwd, 'passwd:s' => \$o_passwd, - 'X:s' => \$o_privpass, 'privpass:s' => \$o_privpass, - 'L:s' => \$v3protocols, 'protocols:s' => \$v3protocols, - 't:i' => \$o_timeout, 'timeout:i' => \$o_timeout, - 'V' => \$o_version, 'version' => \$o_version, - '2' => \$o_version2, 'v2c' => \$o_version2, - 'c:s' => \$o_crit, 'critical:s' => \$o_crit, - 'w:s' => \$o_warn, 'warn:s' => \$o_warn, - 'f' => \$o_perf, 'perfparse' => \$o_perf, - 'T:s' => \$o_check_type, 'type:s' => \$o_check_type - ); - # check the -T option - my $T_option_valid=0; - foreach (@valid_types) { if ($_ eq $o_check_type) {$T_option_valid=1} }; - if ( $T_option_valid == 0 ) - {print "Invalid check type (-T)!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - # Basic checks - if (defined($o_timeout) && (isnnum($o_timeout) || ($o_timeout < 2) || ($o_timeout > 60))) - { print "Timeout must be >1 and <60 !\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if (!defined($o_timeout)) {$o_timeout=5;} - if (defined ($o_help) ) { help(); exit $ERRORS{"UNKNOWN"}}; - if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"}}; - if ( ! defined($o_host) ) # check host and filter - { print_usage(); exit $ERRORS{"UNKNOWN"}} - # check snmp information - if ( !defined($o_community) && (!defined($o_login) || !defined($o_passwd)) ) - { print "Put snmp login info!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if ((defined($o_login) || defined($o_passwd)) && (defined($o_community) || defined($o_version2)) ) - { print "Can't mix snmp v1,2c,3 protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if (defined ($v3protocols)) { - if (!defined($o_login)) { print "Put snmp V3 login info with protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - my @v3proto=split(/,/,$v3protocols); - if ((defined ($v3proto[0])) && ($v3proto[0] ne "")) {$o_authproto=$v3proto[0]; } # Auth protocol - if (defined ($v3proto[1])) {$o_privproto=$v3proto[1]; } # Priv protocol - if ((defined ($v3proto[1])) && (!defined($o_privpass))) { - print "Put snmp V3 priv login info with priv protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - } - # Check warnings and critical - if (!defined($o_warn) || !defined($o_crit)) - { print "put warning and critical info!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - # Get rid of % sign - $o_warn =~ s/\%//g; - $o_crit =~ s/\%//g; - # Check for multiple warning and crit in case of -L - if (($o_check_type eq "netsl") || ($o_check_type eq "cisco") || ($o_check_type eq "cata") || - ($o_check_type eq "nsc") || ($o_check_type eq "hpux")) { - @o_warnL=split(/,/ , $o_warn); - @o_critL=split(/,/ , $o_crit); - if (($#o_warnL != 2) || ($#o_critL != 2)) - { print "3 warnings and critical !\n";print_usage(); exit $ERRORS{"UNKNOWN"}} - for (my $i=0;$i<3;$i++) { - if ( isnnum($o_warnL[$i]) || isnnum($o_critL[$i])) - { print "Numeric value for warning or critical !\n";print_usage(); exit $ERRORS{"UNKNOWN"}} - if ($o_warnL[$i] > $o_critL[$i]) - { print "warning <= critical ! \n";print_usage(); exit $ERRORS{"UNKNOWN"}} - } - } else { - if (($o_warn =~ /,/) || ($o_crit =~ /,/)) { - { print "Multiple warning/critical levels not available for this check\n";print_usage(); exit $ERRORS{"UNKNOWN"}} - } - if ( isnnum($o_warn) || isnnum($o_crit) ) - { print "Numeric value for warning or critical !\n";print_usage(); exit $ERRORS{"UNKNOWN"}} - if ($o_warn > $o_crit) - { print "warning <= critical ! \n";print_usage(); exit $ERRORS{"UNKNOWN"}} - } -} - -########## MAIN ####### - -check_options(); - -# Check gobal timeout if snmp screws up -if (defined($TIMEOUT)) { - verb("Alarm at $TIMEOUT + 5"); - alarm($TIMEOUT+5); -} else { - verb("no global timeout defined : $o_timeout + 10"); - alarm ($o_timeout+10); -} - -$SIG{'ALRM'} = sub { - print "No answer from host\n"; - exit $ERRORS{"UNKNOWN"}; -}; - -# Connect to host -my ($session,$error); -if ( defined($o_login) && defined($o_passwd)) { - # SNMPv3 login - verb("SNMPv3 login"); - if (!defined ($o_privpass)) { - verb("SNMPv3 AuthNoPriv login : $o_login, $o_authproto"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => '3', - -username => $o_login, - -authpassword => $o_passwd, - -authprotocol => $o_authproto, - -timeout => $o_timeout - ); - } else { - verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => '3', - -username => $o_login, - -authpassword => $o_passwd, - -authprotocol => $o_authproto, - -privpassword => $o_privpass, - -privprotocol => $o_privproto, - -timeout => $o_timeout - ); - } -} else { - if (defined ($o_version2)) { - # SNMPv2 Login - verb("SNMP v2c login"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => 2, - -community => $o_community, - -port => $o_port, - -timeout => $o_timeout - ); - } else { - # SNMPV1 login - verb("SNMP v1 login"); - ($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 $ERRORS{"UNKNOWN"}; -} - -my $exit_val=undef; -########### Linux load check ############## - -if ($o_check_type eq "netsl") { - -verb("Checking linux load"); -# Get load table -my $resultat = (Net::SNMP->VERSION < 4) ? - $session->get_table($linload_table) - : $session->get_table(Baseoid => $linload_table); - -if (!defined($resultat)) { - printf("ERROR: Description table : %s.\n", $session->error); - $session->close; - exit $ERRORS{"UNKNOWN"}; -} -$session->close; - -my @load = undef; -my @iload = undef; -my @oid=undef; -my $exist=0; -foreach my $key ( keys %$resultat) { - verb("OID : $key, Desc : $$resultat{$key}"); - if ( $key =~ /$linload_name/ ) { - @oid=split (/\./,$key); - $iload[0]= pop(@oid) if ($$resultat{$key} eq "Load-1"); - $iload[1]= pop(@oid) if ($$resultat{$key} eq "Load-5"); - $iload[2]= pop(@oid) if ($$resultat{$key} eq "Load-15"); - $exist=1 - } -} - -if ($exist == 0) { - print "Can't find snmp information on load : UNKNOWN\n"; - exit $ERRORS{"UNKNOWN"}; -} - -for (my $i=0;$i<3;$i++) { $load[$i] = $$resultat{$linload_load . "." . $iload[$i]}}; - -print "Load : $load[0] $load[1] $load[2] :"; - -$exit_val=$ERRORS{"OK"}; -for (my $i=0;$i<3;$i++) { - if ( $load[$i] > $o_critL[$i] ) { - print " $load[$i] > $o_critL[$i] : CRITICAL"; - $exit_val=$ERRORS{"CRITICAL"}; - } - if ( $load[$i] > $o_warnL[$i] ) { - # output warn error only if no critical was found - if ($exit_val eq $ERRORS{"OK"}) { - print " $load[$i] > $o_warnL[$i] : WARNING"; - $exit_val=$ERRORS{"WARNING"}; - } - } -} -print " OK" if ($exit_val eq $ERRORS{"OK"}); -if (defined($o_perf)) { - print " | load_1_min=$load[0];$o_warnL[0];$o_critL[0] "; - print "load_5_min=$load[1];$o_warnL[1];$o_critL[1] "; - print "load_15_min=$load[2];$o_warnL[2];$o_critL[2]\n"; -} else { - print "\n"; -} -exit $exit_val; -} - -############## Cisco CPU check ################ - -if ($o_check_type eq "cisco") { -my @oidlists = ($cisco_cpu_5m, $cisco_cpu_1m, $cisco_cpu_5s); -my $resultat = (Net::SNMP->VERSION < 4) ? - $session->get_request(@oidlists) - : $session->get_request(-varbindlist => \@oidlists); - -if (!defined($resultat)) { - printf("ERROR: Description table : %s.\n", $session->error); - $session->close; - exit $ERRORS{"UNKNOWN"}; -} - -$session->close; - -if (!defined ($$resultat{$cisco_cpu_5s})) { - print "No CPU information : UNKNOWN\n"; - exit $ERRORS{"UNKNOWN"}; -} - -my @load = undef; - -$load[0]=$$resultat{$cisco_cpu_5s}; -$load[1]=$$resultat{$cisco_cpu_1m}; -$load[2]=$$resultat{$cisco_cpu_5m}; - -print "CPU : $load[0] $load[1] $load[2] :"; - -$exit_val=$ERRORS{"OK"}; -for (my $i=0;$i<3;$i++) { - if ( $load[$i] > $o_critL[$i] ) { - print " $load[$i] > $o_critL[$i] : CRITICAL"; - $exit_val=$ERRORS{"CRITICAL"}; - } - if ( $load[$i] > $o_warnL[$i] ) { - # output warn error only if no critical was found - if ($exit_val eq $ERRORS{"OK"}) { - print " $load[$i] > $o_warnL[$i] : WARNING"; - $exit_val=$ERRORS{"WARNING"}; - } - } -} -print " OK" if ($exit_val eq $ERRORS{"OK"}); -if (defined($o_perf)) { - print " | load_5_sec=$load[0]%;$o_warnL[0];$o_critL[0] "; - print "load_1_min=$load[1]%;$o_warnL[1];$o_critL[1] "; - print "load_5_min=$load[2]%;$o_warnL[2];$o_critL[2]\n"; -} else { - print "\n"; -} - -exit $exit_val; -} - -############## Cisco Catalyst CPU check ################ - -if ($o_check_type eq "cata") { -my @oidlists = ($ciscocata_cpu_5m, $ciscocata_cpu_1m, $ciscocata_cpu_5s); -my $resultat = (Net::SNMP->VERSION < 4) ? - $session->get_request(@oidlists) - : $session->get_request(-varbindlist => \@oidlists); - -if (!defined($resultat)) { - printf("ERROR: Description table : %s.\n", $session->error); - $session->close; - exit $ERRORS{"UNKNOWN"}; -} - -$session->close; - -if (!defined ($$resultat{$ciscocata_cpu_5s})) { - print "No CPU information : UNKNOWN\n"; - exit $ERRORS{"UNKNOWN"}; -} - -my @load = undef; - -$load[0]=$$resultat{$ciscocata_cpu_5s}; -$load[1]=$$resultat{$ciscocata_cpu_1m}; -$load[2]=$$resultat{$ciscocata_cpu_5m}; - -print "CPU : $load[0] $load[1] $load[2] :"; - -$exit_val=$ERRORS{"OK"}; -for (my $i=0;$i<3;$i++) { - if ( $load[$i] > $o_critL[$i] ) { - print " $load[$i] > $o_critL[$i] : CRITICAL"; - $exit_val=$ERRORS{"CRITICAL"}; - } - if ( $load[$i] > $o_warnL[$i] ) { - # output warn error only if no critical was found - if ($exit_val eq $ERRORS{"OK"}) { - print " $load[$i] > $o_warnL[$i] : WARNING"; - $exit_val=$ERRORS{"WARNING"}; - } - } -} -print " OK" if ($exit_val eq $ERRORS{"OK"}); -if (defined($o_perf)) { - print " | load_5_sec=$load[0]%;$o_warnL[0];$o_critL[0] "; - print "load_1_min=$load[1]%;$o_warnL[1];$o_critL[1] "; - print "load_5_min=$load[2]%;$o_warnL[2];$o_critL[2]\n"; -} else { - print "\n"; -} - -exit $exit_val; -} - -############## Netscreen CPU check ################ - -if ($o_check_type eq "nsc") { -my @oidlists = ($nsc_cpu_5m, $nsc_cpu_1m, $nsc_cpu_5s); -my $resultat = (Net::SNMP->VERSION < 4) ? - $session->get_request(@oidlists) - : $session->get_request(-varbindlist => \@oidlists); - -if (!defined($resultat)) { - printf("ERROR: Description table : %s.\n", $session->error); - $session->close; - exit $ERRORS{"UNKNOWN"}; -} - -$session->close; - -if (!defined ($$resultat{$nsc_cpu_5s})) { - print "No CPU information : UNKNOWN\n"; - exit $ERRORS{"UNKNOWN"}; -} - -my @load = undef; - -$load[0]=$$resultat{$nsc_cpu_5s}; -$load[1]=$$resultat{$nsc_cpu_1m}; -$load[2]=$$resultat{$nsc_cpu_5m}; - -print "CPU : $load[0] $load[1] $load[2] :"; - -$exit_val=$ERRORS{"OK"}; -for (my $i=0;$i<3;$i++) { - if ( $load[$i] > $o_critL[$i] ) { - print " $load[$i] > $o_critL[$i] : CRITICAL"; - $exit_val=$ERRORS{"CRITICAL"}; - } - if ( $load[$i] > $o_warnL[$i] ) { - # output warn error only if no critical was found - if ($exit_val eq $ERRORS{"OK"}) { - print " $load[$i] > $o_warnL[$i] : WARNING"; - $exit_val=$ERRORS{"WARNING"}; - } - } -} -print " OK" if ($exit_val eq $ERRORS{"OK"}); -if (defined($o_perf)) { - print " | cpu_5_sec=$load[0]%;$o_warnL[0];$o_critL[0] "; - print "cpu_1_min=$load[1]%;$o_warnL[1];$o_critL[1] "; - print "cpu_5_min=$load[2]%;$o_warnL[2];$o_critL[2]\n"; -} else { - print "\n"; -} - -exit $exit_val; -} - -################## CPU for : AS/400 , Netsnmp, HP, Bluecoat, linkproof, fortigate ########### -if ( $o_check_type =~ /netsc|as400|bc|nokia|^hp$|lp|fg/ ) { - -# Get load table -my @oidlist = $cpu_oid{$o_check_type}; -verb("Checking OID : @oidlist"); -my $resultat = (Net::SNMP->VERSION < 4) ? - $session->get_request(@oidlist) - : $session->get_request(-varbindlist => \@oidlist); -if (!defined($resultat)) { - printf("ERROR: Description table : %s.\n", $session->error); - $session->close; - exit $ERRORS{"UNKNOWN"}; -} -$session->close; - -if (!defined ($$resultat{$cpu_oid{$o_check_type}})) { - print "No CPU information : UNKNOWN\n"; - exit $ERRORS{"UNKNOWN"}; -} - -my $load=$$resultat{$cpu_oid{$o_check_type}}; -verb("OID returned $load"); -# for AS400, divide by 100 -if ($o_check_type eq "as400") {$load /= 100; }; -# for Net-snmp : oid returned idle time so load = 100-idle. -if ($o_check_type eq "netsc") {$load = 100 - $load; }; - -printf("CPU used %.1f%% (",$load); - -$exit_val=$ERRORS{"OK"}; -if ($load > $o_crit) { - print ">$o_crit) : CRITICAL"; - $exit_val=$ERRORS{"CRITICAL"}; -} else { - if ($load > $o_warn) { - print ">$o_warn) : WARNING"; - $exit_val=$ERRORS{"WARNING"}; - } -} -print "<$o_warn) : OK" if ($exit_val eq $ERRORS{"OK"}); -(defined($o_perf)) ? - print " | cpu_prct_used=$load%;$o_warn;$o_crit\n" - : print "\n"; -exit $exit_val; - -} - -##### Checking hpux load -if ($o_check_type eq "hpux") { - -verb("Checking hpux load"); - -my @oidlists = ($hpux_load_1_min, $hpux_load_5_min, $hpux_load_15_min); -my $resultat = (Net::SNMP->VERSION < 4) ? - $session->get_request(@oidlists) - : $session->get_request(-varbindlist => \@oidlists); - -if (!defined($resultat)) { - printf("ERROR: Load table : %s.\n", $session->error); - $session->close; - exit $ERRORS{"UNKNOWN"}; -} - -$session->close; - -if (!defined ($$resultat{$hpux_load_1_min})) { - print "No Load information : UNKNOWN\n"; - exit $ERRORS{"UNKNOWN"}; -} - -my @load = undef; - -$load[0]=$$resultat{$hpux_load_1_min}/100; -$load[1]=$$resultat{$hpux_load_5_min}/100; -$load[2]=$$resultat{$hpux_load_15_min}/100; - -print "Load : $load[0] $load[1] $load[2] :"; - -$exit_val=$ERRORS{"OK"}; -for (my $i=0;$i<3;$i++) { - if ( $load[$i] > $o_critL[$i] ) { - print " $load[$i] > $o_critL[$i] : CRITICAL"; - $exit_val=$ERRORS{"CRITICAL"}; - } - if ( $load[$i] > $o_warnL[$i] ) { - # output warn error only if no critical was found - if ($exit_val eq $ERRORS{"OK"}) { - print " $load[$i] > $o_warnL[$i] : WARNING"; - $exit_val=$ERRORS{"WARNING"}; - } - } -} -print " OK" if ($exit_val eq $ERRORS{"OK"}); -if (defined($o_perf)) { - print " | load_1_min=$load[0]%;$o_warnL[0];$o_critL[0] "; - print "load_5_min=$load[1]%;$o_warnL[1];$o_critL[1] "; - print "load_15_min=$load[2]%;$o_warnL[2];$o_critL[2]\n"; -} else { - print "\n"; -} - -exit $exit_val; -} - -########## Standard cpu usage check ############ -# Get desctiption table -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 $ERRORS{"UNKNOWN"}; -} - -$session->close; - -my ($cpu_used,$ncpu)=(0,0); -foreach my $key ( keys %$resultat) { - verb("OID : $key, Desc : $$resultat{$key}"); - if ( $key =~ /$proc_load/) { - $cpu_used += $$resultat{$key}; - $ncpu++; - } -} - -if ($ncpu==0) { - print "Can't find CPU usage information : UNKNOWN\n"; - exit $ERRORS{"UNKNOWN"}; -} - -$cpu_used /= $ncpu; - -print "$ncpu CPU, ", $ncpu==1 ? "load" : "average load"; -printf(" %.1f%%",$cpu_used); -$exit_val=$ERRORS{"OK"}; - -if ($cpu_used > $o_crit) { - print " > $o_crit% : CRITICAL"; - $exit_val=$ERRORS{"CRITICAL"}; -} else { - if ($cpu_used > $o_warn) { - print " > $o_warn% : WARNING"; - $exit_val=$ERRORS{"WARNING"}; - } -} -print " < $o_warn% : OK" if ($exit_val eq $ERRORS{"OK"}); -(defined($o_perf)) ? - print " | cpu_prct_used=$cpu_used%;$o_warn;$o_crit\n" - : print "\n"; -exit $exit_val; - diff --git a/check_snmp_mem.pl b/check_snmp_mem.pl deleted file mode 100755 index 4cda8d2..0000000 --- a/check_snmp_mem.pl +++ /dev/null @@ -1,525 +0,0 @@ -#!/usr/bin/perl -w -############################## check_snmp_mem ############## -# Version : 1.1 -# Date : Jul 09 2006 -# Author : Patrick Proy (nagios at proy.org) -# Help : http://www.manubulon.com/nagios/ -# Licence : GPL - http://www.fsf.org/licenses/gpl.txt -# Contrib : Jan Jungmann -# TODO : -################################################################# -# -# Help : ./check_snmp_mem.pl -h -# - -use strict; -use Net::SNMP; -use Getopt::Long; - -# Nagios specific - -use lib "/usr/local/nagios/libexec"; -use utils qw(%ERRORS $TIMEOUT); -#my $TIMEOUT = 15; -#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - -# SNMP Datas - -# Net-snmp memory - -my $nets_ram_free = "1.3.6.1.4.1.2021.4.6.0"; # Real memory free -my $nets_ram_total = "1.3.6.1.4.1.2021.4.5.0"; # Real memory total -my $nets_ram_cache = "1.3.6.1.4.1.2021.4.15.0"; # Real memory cached -my $nets_swap_free = "1.3.6.1.4.1.2021.4.4.0"; # swap memory free -my $nets_swap_total = "1.3.6.1.4.1.2021.4.3.0"; # Swap memory total -my @nets_oids = ($nets_ram_free,$nets_ram_total,$nets_swap_free,$nets_swap_total,$nets_ram_cache); - -# Cisco - -my $cisco_mem_pool = "1.3.6.1.4.1.9.9.48.1.1.1"; # Cisco memory pool -my $cisco_index = "1.3.6.1.4.1.9.9.48.1.1.1.2"; # memory pool name and index -my $cisco_valid = "1.3.6.1.4.1.9.9.48.1.1.1.4"; # Valid memory if 1 -my $cisco_used = "1.3.6.1.4.1.9.9.48.1.1.1.5"; # Used memory -my $cisco_free = "1.3.6.1.4.1.9.9.48.1.1.1.6"; # Free memory -# .1 : type, .2 : name, .3 : alternate, .4 : valid, .5 : used, .6 : free, .7 : max free - -# HP Procurve - -my $hp_mem_pool = "1.3.6.1.4.1.11.2.14.11.5.1.1.2.2.1.1"; # HP memory pool -my $hp_mem_index = "1.3.6.1.4.1.11.2.14.11.5.1.1.2.2.1.1.1"; # memory slot index -my $hp_mem_total = "1.3.6.1.4.1.11.2.14.11.5.1.1.2.2.1.1.5"; # Total Bytes -my $hp_mem_free = "1.3.6.1.4.1.11.2.14.11.5.1.1.2.2.1.1.6"; # Free Bytes -my $hp_mem_free_seg = "1.3.6.1.4.1.11.2.14.11.5.1.1.2.2.1.1.3"; # Free segments - -# AS/400 - -# Windows NT/2K/(XP?) - -# check_snmp_storage.pl -C -H -m "^Virtual Memory$" -w -c - - -# Globals - -my $Version='1.1'; - -my $o_host = undef; # hostname -my $o_community = undef; # community -my $o_port = 161; # port -my $o_help= undef; # wan't some help ? -my $o_verb= undef; # verbose mode -my $o_version= undef; # print version -my $o_netsnmp= 1; # Check with netsnmp (default) -my $o_cisco= undef; # Check cisco router mem -my $o_hp= undef; # Check hp procurve mem -my $o_warn= undef; # warning level option -my $o_warnR= undef; # warning level for Real memory -my $o_warnS= undef; # warning levels for swap -my $o_crit= undef; # Critical level option -my $o_critR= undef; # critical level for Real memory -my $o_critS= undef; # critical level for swap -my $o_perf= undef; # Performance data option -my $o_cache= undef; # Include cached memory as used memory -my $o_timeout= undef; # Timeout (Default 5) -my $o_version2= undef; # use snmp v2c -# SNMPv3 specific -my $o_login= undef; # Login for snmpv3 -my $o_passwd= undef; # Pass for snmpv3 -my $v3protocols=undef; # V3 protocol list. -my $o_authproto='md5'; # Auth protocol -my $o_privproto='des'; # Priv protocol -my $o_privpass= undef; # priv password - -# functions - -sub p_version { print "check_snmp_mem version : $Version\n"; } - -sub print_usage { - print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -w -c [-I|-N|-E] [-f] [-m] [-t ] [-V]\n"; -} - -sub isnnum { # Return true if arg is not a number - my $num = shift; - if ( $num =~ /^(\d+\.?\d*)|(^\.\d+)$/ ) { return 0 ;} - return 1; -} - -sub round ($$) { - sprintf "%.$_[1]f", $_[0]; -} - -sub help { - print "\nSNMP Memory Monitor for Nagios version ",$Version,"\n"; - print "(c)2004-2006 to my cat Ratoune - Author: Patrick Proy\n\n"; - print_usage(); - print <, - : Authentication protocol (md5|sha : default md5) - : Priv protocole (des|aes : default des) --P, --port=PORT - SNMP port (Default 161) --w, --warn=INTEGER | INT,INT - warning level for memory in percent (0 for no checks) - Default (-N switch) : comma separated level for Real Memory and Swap - -I switch : warning level --c, --crit=INTEGER | INT,INT - critical level for memory in percent (0 for no checks) - Default (-N switch) : comma separated level for Real Memory and Swap - -I switch : critical level --N, --netsnmp (default) - check linux memory & swap provided by Net SNMP --m, --memcache - include cached memory in used memory (only with Net-SNMP) --I, --cisco - check cisco memory (sum of all memory pools) --E, --hp - check HP proccurve memory --f, --perfdata - Performance data output --t, --timeout=INTEGER - timeout for SNMP in seconds (Default: 5) --V, --version - prints version number -EOT -} - -# For verbose output -sub verb { my $t=shift; print $t,"\n" if defined($o_verb) ; } - -# Get the alarm signal (just in case snmp timout screws up) -$SIG{'ALRM'} = sub { - print ("ERROR: Alarm signal (Nagios time-out)\n"); - exit $ERRORS{"UNKNOWN"}; -}; - -sub check_options { - Getopt::Long::Configure ("bundling"); - GetOptions( - 'v' => \$o_verb, 'verbose' => \$o_verb, - 'h' => \$o_help, 'help' => \$o_help, - 'H:s' => \$o_host, 'hostname:s' => \$o_host, - 'p:i' => \$o_port, 'port:i' => \$o_port, - 'C:s' => \$o_community, 'community:s' => \$o_community, - 'l:s' => \$o_login, 'login:s' => \$o_login, - 'x:s' => \$o_passwd, 'passwd:s' => \$o_passwd, - 'X:s' => \$o_privpass, 'privpass:s' => \$o_privpass, - 'L:s' => \$v3protocols, 'protocols:s' => \$v3protocols, - 't:i' => \$o_timeout, 'timeout:i' => \$o_timeout, - 'V' => \$o_version, 'version' => \$o_version, - 'I' => \$o_cisco, 'cisco' => \$o_cisco, - 'N' => \$o_netsnmp, 'netsnmp' => \$o_netsnmp, - 'E' => \$o_hp, 'hp' => \$o_hp, - '2' => \$o_version2, 'v2c' => \$o_version2, - 'c:s' => \$o_crit, 'critical:s' => \$o_crit, - 'w:s' => \$o_warn, 'warn:s' => \$o_warn, - 'm' => \$o_cache, 'memcache' => \$o_cache, - 'f' => \$o_perf, 'perfdata' => \$o_perf - ); - if (defined ($o_help) ) { help(); exit $ERRORS{"UNKNOWN"}}; - if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"}}; - if ( ! defined($o_host) ) # check host and filter - { print "No host defined!\n";print_usage(); exit $ERRORS{"UNKNOWN"}} - # check snmp information - if ( !defined($o_community) && (!defined($o_login) || !defined($o_passwd)) ) - { print "Put snmp login info!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if ((defined($o_login) || defined($o_passwd)) && (defined($o_community) || defined($o_version2)) ) - { print "Can't mix snmp v1,2c,3 protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if (defined ($v3protocols)) { - if (!defined($o_login)) { print "Put snmp V3 login info with protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - my @v3proto=split(/,/,$v3protocols); - if ((defined ($v3proto[0])) && ($v3proto[0] ne "")) {$o_authproto=$v3proto[0]; } # Auth protocol - if (defined ($v3proto[1])) {$o_privproto=$v3proto[1]; } # Priv protocol - if ((defined ($v3proto[1])) && (!defined($o_privpass))) { - print "Put snmp V3 priv login info with priv protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - } - if (defined($o_timeout) && (isnnum($o_timeout) || ($o_timeout < 2) || ($o_timeout > 60))) - { print "Timeout must be >1 and <60 !\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if (!defined($o_timeout)) {$o_timeout=5;} - #Check Warning and crit are present - if ( ! defined($o_warn) || ! defined($o_crit)) - { print "Put warning and critical values!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - # Get rid of % sign - $o_warn =~ s/\%//g; - $o_crit =~ s/\%//g; - # if -N or -E switch , undef $o_netsnmp - if (defined($o_cisco) || defined($o_hp) ) { - $o_netsnmp=undef; - if ( isnnum($o_warn) || isnnum($o_crit)) - { print "Numeric value for warning or critical !\n";print_usage(); exit $ERRORS{"UNKNOWN"} } - if ( ($o_crit != 0) && ($o_warn > $o_crit) ) - { print "warning <= critical ! \n";print_usage(); exit $ERRORS{"UNKNOWN"}} - } - if (defined($o_netsnmp)) { - my @o_warnL=split(/,/ , $o_warn); - my @o_critL=split(/,/ , $o_crit); - if (($#o_warnL != 1) || ($#o_critL != 1)) - { print "2 warnings and critical !\n";print_usage(); exit $ERRORS{"UNKNOWN"}} - for (my $i=0;$i<2;$i++) { - if ( isnnum($o_warnL[$i]) || isnnum($o_critL[$i])) - { print "Numeric value for warning or critical !\n";print_usage(); exit $ERRORS{"UNKNOWN"} } - if (($o_critL[$i]!= 0) && ($o_warnL[$i] > $o_critL[$i])) - { print "warning <= critical ! \n";print_usage(); exit $ERRORS{"UNKNOWN"}} - if ( $o_critL[$i] > 100) - { print "critical percent must be < 100 !\n";print_usage(); exit $ERRORS{"UNKNOWN"}} - } - $o_warnR=$o_warnL[0];$o_warnS=$o_warnL[1]; - $o_critR=$o_critL[0];$o_critS=$o_critL[1]; - } - -} - -########## MAIN ####### - -check_options(); - -# Check gobal timeout if snmp screws up -if (defined($TIMEOUT)) { - verb("Alarm at $TIMEOUT"); - alarm($TIMEOUT); -} else { - verb("no timeout defined : $o_timeout + 10"); - alarm ($o_timeout+10); -} - -# Connect to host -my ($session,$error); -if ( defined($o_login) && defined($o_passwd)) { - # SNMPv3 login - if (!defined ($o_privpass)) { - verb("SNMPv3 AuthNoPriv login : $o_login, $o_authproto"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => '3', - -username => $o_login, - -authpassword => $o_passwd, - -authprotocol => $o_authproto, - -timeout => $o_timeout - ); - } else { - verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => '3', - -username => $o_login, - -authpassword => $o_passwd, - -authprotocol => $o_authproto, - -privpassword => $o_privpass, - -privprotocol => $o_privproto, - -timeout => $o_timeout - ); - } -} else { - if (defined ($o_version2)) { - # SNMPv2 Login - verb("SNMP v2c login"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => 2, - -community => $o_community, - -port => $o_port, - -timeout => $o_timeout - ); - } else { - # SNMPV1 login - verb("SNMP v1 login"); - ($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 $ERRORS{"UNKNOWN"}; -} - -# Global variable -my $resultat=undef; - -########### Cisco memory check ############ -if (defined ($o_cisco)) { - - # Get Cisco memory table - $resultat = (Net::SNMP->VERSION < 4) ? - $session->get_table($cisco_mem_pool) - :$session->get_table(Baseoid => $cisco_mem_pool); - - if (!defined($resultat)) { - printf("ERROR: Description table : %s.\n", $session->error); - $session->close; - exit $ERRORS{"UNKNOWN"}; - } - my (@oid,@index)=(undef,undef); - my $nindex=0; - foreach my $key ( keys %$resultat) { - verb("OID : $key, Desc : $$resultat{$key}"); - if ( $key =~ /$cisco_index/ ) { - @oid=split (/\./,$key); - $index[$nindex++] = pop(@oid); - } - } - - # Check if at least 1 memory pool exists - if ($nindex == 0) { - printf("ERROR: No memory pools found"); - $session->close; - exit $ERRORS{"UNKNOWN"}; - } - - # Test every memory pool - my ($c_output,$prct_free)=(undef,undef); - my ($warn_s,$crit_s)=(0,0); - my ($used,$free)=(0,0); - foreach (@index) { - $c_output .="," if defined ($c_output); - if ( $$resultat{$cisco_valid . "." . $_} == 1 ) { - $used += $$resultat{$cisco_used . "." . $_}; - $free += $$resultat{$cisco_free . "." . $_}; - $prct_free=round($$resultat{$cisco_used . "." . $_}*100/($$resultat{$cisco_free . "." . $_}+$$resultat{$cisco_used . "." . $_}) ,0); - $c_output .= $$resultat{$cisco_index . "." . $_} . ":" . $prct_free . "%"; - if (($o_crit!=0)&&($o_crit <= $prct_free)) { - $crit_s =1; - } elsif (($o_warn!=0)&&($o_warn <= $prct_free)) { - $warn_s=1; - } - } else { - $c_output .= $$resultat{$cisco_index . "." . $_} . ": INVALID"; - $crit_s =1; - } - } - my $total=$used+$free; - $prct_free=round($used*100/($total),0); - verb("Total used : $used, free: $free, output : $c_output"); - my $c_status="OK"; - $c_output .=" : " . $prct_free ."% : "; - if ($crit_s == 1 ) { - $c_output .= " > " . $o_crit ; - $c_status="CRITICAL"; - } else { - if ($warn_s == 1 ) { - $c_output.=" > " . $o_warn; - $c_status="WARNING"; - } - } - $c_output .= " ; ".$c_status; - if (defined ($o_perf)) { - $c_output .= " | ram_used=" . $used.";"; - $c_output .= ($o_warn ==0)? ";" : round($o_warn * $total/100,0).";"; - $c_output .= ($o_crit ==0)? ";" : round($o_crit * $total/100,0).";"; - $c_output .= "0;" . $total ; - } - $session->close; - print "$c_output \n"; - exit $ERRORS{$c_status}; -} - -########### HP Procurve memory check ############ -if (defined ($o_hp)) { - - # Get hp memory table - $resultat = (Net::SNMP->VERSION < 4) ? - $session->get_table($hp_mem_pool) - :$session->get_table(Baseoid => $hp_mem_pool); - - if (!defined($resultat)) { - printf("ERROR: Description table : %s.\n", $session->error); - $session->close; - exit $ERRORS{"UNKNOWN"}; - } - my (@oid,@index)=(undef,undef); - my $nindex=0; - foreach my $key ( keys %$resultat) { - verb("OID : $key, Desc : $$resultat{$key}"); - if ( $key =~ /$hp_mem_index/ ) { - @oid=split (/\./,$key); - $index[$nindex++] = pop(@oid); - } - } - - # Check if at least 1 memory slots exists - if ($nindex == 0) { - printf("ERROR: No memory slots found"); - $session->close; - exit $ERRORS{"UNKNOWN"}; - } - - # Consolidate the datas - my ($total,$free)=(0,0); - my ($c_output,$prct_free)=(undef,undef); - foreach (@index) { - $c_output .="," if defined ($c_output); - $total += $$resultat{$hp_mem_total . "." . $_}; - $free += $$resultat{$hp_mem_free . "." . $_}; - $c_output .= "Slot " . $$resultat{$hp_mem_index . "." . $_} . ":" - .round( - 100 - ($$resultat{$hp_mem_free . "." . $_} *100 / - $$resultat{$hp_mem_total . "." . $_}) ,0) - . "%"; - } - my $used = $total - $free; - $prct_free=round($used*100/($total),0); - verb("Used : $used, Free: $free, Output : $c_output"); - my $c_status="OK"; - $c_output .=" : " . $prct_free ."% : "; - if (($o_crit!=0)&&($o_crit <= $prct_free)) { - $c_output .= " > " . $o_crit ; - $c_status="CRITICAL"; - } else { - if (($o_warn!=0)&&($o_warn <= $prct_free)) { - $c_output.=" > " . $o_warn; - $c_status="WARNING"; - } - } - $c_output .= " ; ".$c_status; - if (defined ($o_perf)) { - $c_output .= " | ram_used=" . $used.";"; - $c_output .= ($o_warn ==0)? ";" : round($o_warn * $total/100,0).";"; - $c_output .= ($o_crit ==0)? ";" : round($o_crit * $total/100,0).";"; - $c_output .= "0;" . $total ; - } - $session->close; - print "$c_output \n"; - exit $ERRORS{$c_status}; -} - -########### Net snmp memory check ############ -if (defined ($o_netsnmp)) { - - # Get NetSNMP memory values - $resultat = (Net::SNMP->VERSION < 4) ? - $session->get_request(@nets_oids) - :$session->get_request(-varbindlist => \@nets_oids); - - if (!defined($resultat)) { - printf("ERROR: netsnmp : %s.\n", $session->error); - $session->close; - exit $ERRORS{"UNKNOWN"}; - } - - my ($realused,$swapused)=(undef,undef); - - $realused= defined($o_cache) ? - ($$resultat{$nets_ram_total}-$$resultat{$nets_ram_free})/$$resultat{$nets_ram_total} - : - ($$resultat{$nets_ram_total}-($$resultat{$nets_ram_free}+$$resultat{$nets_ram_cache}))/$$resultat{$nets_ram_total}; - - if($$resultat{$nets_ram_total} == 0) { $realused = 0; } - - $swapused= ($$resultat{$nets_swap_total} == 0) ? 0 : - ($$resultat{$nets_swap_total}-$$resultat{$nets_swap_free})/$$resultat{$nets_swap_total}; - $realused=round($realused*100,0); - $swapused=round($swapused*100,0); - defined($o_cache) ? - verb ("Ram : $$resultat{$nets_ram_free} / $$resultat{$nets_ram_total} : $realused") - : - verb ("Ram : $$resultat{$nets_ram_free} ($$resultat{$nets_ram_cache} cached) / $$resultat{$nets_ram_total} : $realused"); - verb ("Swap : $$resultat{$nets_swap_free} / $$resultat{$nets_swap_total} : $swapused"); - - my $n_status="OK"; - my $n_output="Ram : " . $realused . "%, Swap : " . $swapused . "% :"; - if ((($o_critR!=0)&&($o_critR <= $realused)) || (($o_critS!=0)&&($o_critS <= $swapused))) { - $n_output .= " > " . $o_critR . ", " . $o_critS; - $n_status="CRITICAL"; - } else { - if ((($o_warnR!=0)&&($o_warnR <= $realused)) || (($o_warnS!=0)&&($o_warnS <= $swapused))) { - $n_output.=" > " . $o_warnR . ", " . $o_warnS; - $n_status="WARNING"; - } - } - $n_output .= " ; ".$n_status; - if (defined ($o_perf)) { - if (defined ($o_cache)) { - $n_output .= " | ram_used=" . ($$resultat{$nets_ram_total}-$$resultat{$nets_ram_free}).";"; - } - else { - $n_output .= " | ram_used=" . ($$resultat{$nets_ram_total}-$$resultat{$nets_ram_free}-$$resultat{$nets_ram_cache}).";"; - } - $n_output .= ($o_warnR ==0)? ";" : round($o_warnR * $$resultat{$nets_ram_total}/100,0).";"; - $n_output .= ($o_critR ==0)? ";" : round($o_critR * $$resultat{$nets_ram_total}/100,0).";"; - $n_output .= "0;" . $$resultat{$nets_ram_total}. " "; - $n_output .= "swap_used=" . ($$resultat{$nets_swap_total}-$$resultat{$nets_swap_free}).";"; - $n_output .= ($o_warnS ==0)? ";" : round($o_warnS * $$resultat{$nets_swap_total}/100,0).";"; - $n_output .= ($o_critS ==0)? ";" : round($o_critS * $$resultat{$nets_swap_total}/100,0).";"; - $n_output .= "0;" . $$resultat{$nets_swap_total}; - } - $session->close; - print "$n_output \n"; - exit $ERRORS{$n_status}; - -} diff --git a/check_snmp_nsbox.pl b/check_snmp_nsbox.pl deleted file mode 100755 index 25eef4b..0000000 --- a/check_snmp_nsbox.pl +++ /dev/null @@ -1,351 +0,0 @@ -#!/usr/bin/perl -w -############################## check_snmp_nsbox ################# -# Version : 1.0 -# Date : Jan 16 2007 -# Author : Patrick Proy ( patrick at proy.org) -# Help : http://www.manubulon.com/nagios/ -# Licence : GPL - http://www.fsf.org/licenses/gpl.txt -# Changelog : -# Contributors : -################################################################# -# -# Help : ./check_snmp_nsbox.pl -h -# - -use strict; -use Net::SNMP; -use Getopt::Long; - -# Nagios specific - -use lib "/usr/local/nagios/libexec"; -use utils qw(%ERRORS $TIMEOUT); -#my $TIMEOUT = 15; -#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - -# SNMP Datas -my $ns_service_status= "1.3.6.1.4.1.14020.2.2.1.3.0"; # service status 1= ok ?? - -my $ns_service_table= "1.3.6.1.4.1.14020.2.3"; # vhost & diode table -my $ns_vhost_table= "1.3.6.1.4.1.14020.2.3.1"; # vhost table -my $ns_vhost_name= "1.0"; # GUI Vhost Name -my $ns_vhost_requests= "2.0"; # Instant Vhost Requests per Second : NOT POPULATED IN V 2.0.8 -my $ns_vhost_Trequests= "2.0"; # Total Vhost Requests : NOT POPULATED IN V 2.0.8 -my $ns_diode_table= "1.3.6.1.4.1.14020.2.3.2"; # diode table -my $ns_diode_name= "1.0"; # GUI Diode Name -my $ns_diode_status= "2.0"; # Last diode Status (" " = OK?) (undocumented) - -my $ns_rsa_prct_usage= ".1.3.6.1.4.1.14020.1.1.1.3.0"; # % usage of RSA operations. (undocumented) -my $ns_rsa_oper_second= ".1.3.6.1.4.1.14020.1.1.3.4.0;"; # number of RSA operations/s (undocumented) - -# Globals - -my $Version='1.0'; - -my $o_host = undef; # hostname -my $o_community = undef; # community -my $o_port = 161; # port -my $o_help= undef; # wan't some help ? -my $o_verb= undef; # verbose mode -my $o_version= undef; # print version -my $o_timeout= undef; # Timeout (Default 5) -my $o_perf= undef; # Output performance data -my $o_version2= undef; # use snmp v2c -# specific -my $o_vhost= undef; # vhost regexp -my $o_diode= undef; # diode regexp -my $o_nvhost= undef; # vhost number -my $o_ndiode= undef; # diode number - -# SNMPv3 specific -my $o_login= undef; # Login for snmpv3 -my $o_passwd= undef; # Pass for snmpv3 -my $v3protocols=undef; # V3 protocol list. -my $o_authproto='md5'; # Auth protocol -my $o_privproto='des'; # Priv protocol -my $o_privpass= undef; # priv password - -# functions - -sub p_version { print "check_snmp_nsbox version : $Version\n"; } - -sub print_usage { - print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) -d -s -n , [-p ] [-f] [-t ] [-V]\n"; -} - -sub isnnum { # Return true if arg is not a number - my $num = shift; - if ( $num =~ /^(\d+\.?\d*)|(^\.\d+)$/ ) { return 0 ;} - return 1; -} - -sub set_status { # return worst status with this order : OK, unknwonw, warning, critical - my $new_status=shift; - my $cur_status=shift; - if (($cur_status == 0)|| ($new_status==$cur_status)){ return $new_status; } - if ($new_status==3) { return $cur_status; } - if ($new_status > $cur_status) {return $new_status;} - return $cur_status; -} - -sub is_pattern_valid { # Test for things like "" or "+5-i" - my $pat = shift; - if (!defined($pat)) { $pat=" ";} # Just to get rid of compilation time warnings - return eval { "" =~ /$pat/; 1 } || 0; -} - -sub help { - print "\nSNMP NetSecureOne Netbox monitor for Nagios version ",$Version,"\n"; - print "(c)2004-2006 Patrick Proy\n\n"; - print_usage(); - print <, - : Authentication protocol (md5|sha : default md5) - : Priv protocole (des|aes : default des) --d, --diode= - Diode selection by regexp --s, --vhost= - Vhost selection by regexp --n, --number=, - number of diode and vhost that must be up. --P, --port=PORT - SNMP port (Default 161) --f, --perfparse - Perfparse compatible output --t, --timeout=INTEGER - timeout for SNMP in seconds (Default: 5) --V, --version - prints version number -EOT -} - -# For verbose output -sub verb { my $t=shift; print $t,"\n" if defined($o_verb) ; } - -sub check_options { - Getopt::Long::Configure ("bundling"); - GetOptions( - 'v' => \$o_verb, 'verbose' => \$o_verb, - 'h' => \$o_help, 'help' => \$o_help, - 'H:s' => \$o_host, 'hostname:s' => \$o_host, - 'p:i' => \$o_port, 'port:i' => \$o_port, - 'C:s' => \$o_community, 'community:s' => \$o_community, - 'l:s' => \$o_login, 'login:s' => \$o_login, - 'x:s' => \$o_passwd, 'passwd:s' => \$o_passwd, - 'X:s' => \$o_privpass, 'privpass:s' => \$o_privpass, - 'L:s' => \$v3protocols, 'protocols:s' => \$v3protocols, - 't:i' => \$o_timeout, 'timeout:i' => \$o_timeout, - 'V' => \$o_version, 'version' => \$o_version, - '2' => \$o_version2, 'v2c' => \$o_version2, - 'f' => \$o_perf, 'perfparse' => \$o_perf, - 'd:s' => \$o_diode, 'diode:s' => \$o_diode, - 's:s' => \$o_vhost, 'vhost:s' => \$o_vhost, - 'n:s' => \$o_nvhost, 'number:s' => \$o_nvhost - ); - # Basic checks - if (defined($o_timeout) && (isnnum($o_timeout) || ($o_timeout < 2) || ($o_timeout > 60))) - { print "Timeout must be >1 and <60 !\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if (!defined($o_timeout)) {$o_timeout=5;} - if (defined ($o_help) ) { help(); exit $ERRORS{"UNKNOWN"}}; - if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"}}; - if ( ! defined($o_host) ) # check host and filter - { print_usage(); exit $ERRORS{"UNKNOWN"}} - # check snmp information - if ( !defined($o_community) && (!defined($o_login) || !defined($o_passwd)) ) - { print "Put snmp login info!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if ((defined($o_login) || defined($o_passwd)) && (defined($o_community) || defined($o_version2)) ) - { print "Can't mix snmp v1,2c,3 protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if (defined ($v3protocols)) { - if (!defined($o_login)) { print "Put snmp V3 login info with protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - my @v3proto=split(/,/,$v3protocols); - if ((defined ($v3proto[0])) && ($v3proto[0] ne "")) {$o_authproto=$v3proto[0]; } # Auth protocol - if (defined ($v3proto[1])) {$o_privproto=$v3proto[1]; } # Priv protocol - if ((defined ($v3proto[1])) && (!defined($o_privpass))) { - print "Put snmp V3 priv login info with priv protocols!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - } - if (!defined($o_vhost) || !(is_pattern_valid($o_vhost))) - { print "Vhost selection must be set and be a valid regexp (-s)\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if (!defined($o_diode) || !(is_pattern_valid($o_diode))) - { print "Diode selection must be set and be a valid regexp (-d)\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if (!defined($o_nvhost)) - { print "Diode and vhost number must be set (-n)\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - my @nsbox_number=split(/,/,$o_nvhost); - if ($#nsbox_number != 1) - { print "2 numbers must be set with -n option\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - if (isnnum($nsbox_number[0]) || isnnum($nsbox_number[1])) - { print "2 numbers must be set with -n option\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - $o_ndiode=$nsbox_number[0]; - $o_nvhost=$nsbox_number[1]; -} - -########## MAIN ####### - -check_options(); - -# Check gobal timeout if snmp screws up -if (defined($TIMEOUT)) { - verb("Alarm at $TIMEOUT + 5"); - alarm($TIMEOUT+5); -} else { - verb("no global timeout defined : $o_timeout + 10"); - alarm ($o_timeout+10); -} - -# Connect to host -my ($session,$error); -if ( defined($o_login) && defined($o_passwd)) { - # SNMPv3 login - verb("SNMPv3 login"); - if (!defined ($o_privpass)) { - verb("SNMPv3 AuthNoPriv login : $o_login, $o_authproto"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => '3', - -username => $o_login, - -authpassword => $o_passwd, - -authprotocol => $o_authproto, - -timeout => $o_timeout - ); - } else { - verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => '3', - -username => $o_login, - -authpassword => $o_passwd, - -authprotocol => $o_authproto, - -privpassword => $o_privpass, - -privprotocol => $o_privproto, - -timeout => $o_timeout - ); - } -} else { - if (defined ($o_version2)) { - # SNMPv2 Login - verb("SNMP v2c login"); - ($session, $error) = Net::SNMP->session( - -hostname => $o_host, - -version => 2, - -community => $o_community, - -port => $o_port, - -timeout => $o_timeout - ); - } else { - # SNMPV1 login - verb("SNMP v1 login"); - ($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 $ERRORS{"UNKNOWN"}; -} - - -########### check global status ############## -my @oidlist=($ns_service_status); -my $resultat = (Net::SNMP->VERSION < 4) ? - $session->get_request(@oidlist) - : $session->get_request(-varbindlist => \@oidlist); - -if (!defined($resultat) || ($$resultat{$ns_service_status} eq "noSuchObject")) { - printf("ERROR: Global status oid not found : %s.\n", $session->error); - $session->close; - exit $ERRORS{"UNKNOWN"}; -} - -if ($$resultat{$ns_service_status} != 1) { - print "Global service is in state ",$$resultat{$ns_service_status}," : CRITICAL\n"; - exit $ERRORS{"CRITICAL"}; -} - -########### check vhost & diode status ############## -$resultat=undef; -$resultat = (Net::SNMP->VERSION < 4) ? - $session->get_table($ns_service_table) - : $session->get_table(Baseoid => $ns_service_table); - -if (!defined($resultat)) { - printf("ERROR: vhost and diode status table : %s.\n", $session->error); - $session->close; - exit $ERRORS{"UNKNOWN"}; -} -$session->close; - -my $output=""; -my $output_perf=""; -my ($index,$name)=undef; -my ($nvhost,$ndiode)=(0,0); -my (@found_vhost,@found_diode)=(undef,undef); - -foreach my $key ( keys %$resultat) { - verb("OID : $key, Desc : $$resultat{$key}"); - if ( $key =~ /($ns_vhost_table)\.(\d+)\.($ns_vhost_name)/ ) { # Get index of vhost with name - $index=$2;$name=$$resultat{$key}; - if ($name =~ /$o_vhost/) { - $found_vhost[$nvhost++]=$name; - verb ("found vhost $name"); - } - } - if ( $key =~ /($ns_diode_table)\.(\d+)\.($ns_diode_name)/ ) { # Get index of diode with name - $index=$2;$name=$$resultat{$key}; - if ($name =~ /$o_diode/) { - # TODO Check diode status : undocumented for now. - $found_diode[$ndiode++]=$name; - verb ("found diode $name"); - } - } -} - -if (($ndiode<$o_ndiode) || ($nvhost<$o_nvhost)) { - $output = "Diode"; - if ($ndiode == 0 ) { $output.= ": none ";} - else { - $output.= "(".$ndiode."): :"; - for (my $i=0;$i<$ndiode;$i++) { - $output.=$found_diode[$i]." "; - } - } - $output .= "Vhost"; - if ($nvhost == 0 ) { $output.= ": none ";} - else { - $output.= "(".$nvhost."): :"; - for (my $i=0;$i<$nvhost;$i++) { - $output.=$found_vhost[$i]." "; - } - } - $output .= " < " . $o_ndiode .",". $o_nvhost ." : CRITICAL"; - print $output,"\n"; - exit $ERRORS{"CRITICAL"}; -} - -$output = $ndiode . " diodes, " .$nvhost." vhosts :"; -if (($ndiode>$o_ndiode) || ($nvhost>$o_nvhost)) { - $output .= " > " . $o_ndiode .",". $o_nvhost ." : WARNING"; -} else { - $output .= " OK"; -} -print $output,"\n"; -exit $ERRORS{"OK"}; - diff --git a/check_snmp_process.pl b/check_snmp_process.pl deleted file mode 100755 index d8fe0c6..0000000 --- a/check_snmp_process.pl +++ /dev/null @@ -1,668 +0,0 @@ -#!/usr/bin/perl -w -############################## check_snmp_process ############## -# Version : 1.4 -# Date : March 12 2007 -# Author : Patrick Proy (patrick at proy.org) -# Help : http://nagios.manubulon.com -# Licence : GPL - http://www.fsf.org/licenses/gpl.txt -# Contrib : Makina Corpus -# TODO : put $o_delta as an option -# Contrib : -############################################################### -# -# help : ./check_snmp_process -h - -############### BASE DIRECTORY FOR TEMP FILE ######## -my $o_base_dir="/tmp/tmp_Nagios_proc."; -my $file_history=200; # number of data to keep in files. -my $delta_of_time_to_make_average=300; # 5minutes by default - -use strict; -use Net::SNMP; -use Getopt::Long; - -# Nagios specific - -use lib "/usr/local/nagios/libexec"; -use utils qw(%ERRORS $TIMEOUT); -#my $TIMEOUT = 5; -#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - -# SNMP Datas -my $process_table= '1.3.6.1.2.1.25.4.2.1'; -my $index_table = '1.3.6.1.2.1.25.4.2.1.1'; -my $run_name_table = '1.3.6.1.2.1.25.4.2.1.2'; -my $run_path_table = '1.3.6.1.2.1.25.4.2.1.4'; -my $proc_mem_table = '1.3.6.1.2.1.25.5.1.1.2'; # Kbytes -my $proc_cpu_table = '1.3.6.1.2.1.25.5.1.1.1'; # Centi sec of CPU -my $proc_run_state = '1.3.6.1.2.1.25.4.2.1.7'; - -# Globals - -my $Version='1.4'; - -my $o_host = undef; # hostname -my $o_community =undef; # community -my $o_port = 161; # port -my $o_version2 = undef; #use snmp v2c -my $o_descr = undef; # description filter -my $o_warn = 0; # warning limit -my @o_warnL= undef; # warning limits (min,max) -my $o_crit= 0; # critical limit -my @o_critL= undef; # critical limits (min,max) -my $o_help= undef; # wan't some help ? -my $o_verb= undef; # verbose mode -my $o_version= undef; # print version -my $o_noreg= undef; # Do not use Regexp for name -my $o_path= undef; # check path instead of name -my $o_inverse= undef; # checks max instead of min number of process -my $o_get_all= undef; # get all tables at once -my $o_timeout= 5; # Default 5s Timeout -# SNMP V3 specific -my $o_login= undef; # snmp v3 login -my $o_passwd= undef; # snmp v3 passwd -my $v3protocols=undef; # V3 protocol list. -my $o_authproto='md5'; # Auth protocol -my $o_privproto='des'; # Priv protocol -my $o_privpass= undef; # priv password -# SNMP Message size parameter (Makina Corpus contrib) -my $o_octetlength=undef; -# Memory & CPU -my $o_mem= undef; # checks memory (max) -my @o_memL= undef; # warn and crit level for mem -my $o_mem_avg= undef; # cheks memory average -my $o_cpu= undef; # checks CPU usage -my @o_cpuL= undef; # warn and crit level for cpu -my $o_delta= $delta_of_time_to_make_average; # delta time for CPU check - -# functions - -sub p_version { print "check_snmp_process version : $Version\n"; } - -sub print_usage { - print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd) [-p ] -n [-w [,] -c [,max_proc] ] [-m, -a -u, ] [-t ] [-o ] [-f ] [-r] [-V] [-g]\n"; -} - -sub isnotnum { # Return true if arg is not a number - my $num = shift; - if ( $num =~ /^-?(\d+\.?\d*)|(^\.\d+)$/ ) { return 0 ;} - return 1; -} - -# Get the alarm signal (just in case snmp timout screws up) -$SIG{'ALRM'} = sub { - print ("ERROR: Alarm signal (Nagios time-out)\n"); - exit $ERRORS{"UNKNOWN"}; -}; - -sub read_file { - # Input : File, items_number - # Returns : array of value : [line][item] - my ($traffic_file,$items_number)=@_; - my ($ligne,$n_rows)=(undef,0); - my (@last_values,@file_values,$i); - open(FILE,"<".$traffic_file) || return (1,0,0); - - while($ligne = ) - { - chomp($ligne); - @file_values = split(":",$ligne); - #verb("@file_values"); - if ($#file_values >= ($items_number-1)) { - # check if there is enough data, else ignore line - for ( $i=0 ; $i< $items_number ; $i++ ) {$last_values[$n_rows][$i]=$file_values[$i]; } - $n_rows++; - } - } - close FILE; - if ($n_rows != 0) { - return (0,$n_rows,@last_values); - } else { - return (1,0,0); - } -} - -sub write_file { - # Input : file , rows, items, array of value : [line][item] - # Returns : 0 / OK, 1 / error - my ($file_out,$rows,$item,@file_values)=@_; - my $start_line= ($rows > $file_history) ? $rows - $file_history : 0; - if ( open(FILE2,">".$file_out) ) { - for (my $i=$start_line;$i<$rows;$i++) { - for (my $j=0;$j<$item;$j++) { - print FILE2 $file_values[$i][$j]; - if ($j != ($item -1)) { print FILE2 ":" }; - } - print FILE2 "\n"; - } - close FILE2; - return 0; - } else { - return 1; - } -} - -sub help { - print "\nSNMP Process Monitor for Nagios version ",$Version,"\n"; - print "GPL licence, (c)2004-2006 Patrick Proy\n\n"; - print_usage(); - print <, - : Authentication protocol (md5|sha : default md5) - : Priv protocole (des|aes : default des) --p, --port=PORT - SNMP port (Default 161) --n, --name=NAME - Name of the process (regexp) - No trailing slash ! --r, --noregexp - Do not use regexp to match NAME in description OID --f, --fullpath - Use full path name instead of process name - (Windows doesn't provide full path name) --w, --warn=MIN[,MAX] - Number of process that will cause a warning - -1 for no warning, MAX must be >0. Ex : -w-1,50 --c, --critical=MIN[,MAX] - number of process that will cause an error ( - -1 for no critical, MAX must be >0. Ex : -c-1,50 -Notes on warning and critical : - with the following options : -w m1,x1 -c m2,x2 - you must have : m2 <= m1 < x1 <= x2 - you can omit x1 or x2 or both --m, --memory=WARN,CRIT - checks memory usage (default max of all process) - values are warning and critical values in Mb --a, --average - makes an average of memory used by process instead of max --u, --cpu=WARN,CRIT - checks cpu usage of all process - values are warning and critical values in % of CPU usage - if more than one CPU, value can be > 100% : 100%=1 CPU --g, --getall - In some cases, it is necessary to get all data at once because - process die very frequently. - This option eats bandwidth an cpu (for remote host) at breakfast. --o, --octetlength=INTEGER - max-size of the SNMP message, usefull in case of Too Long responses. - Be carefull with network filters. Range 484 - 65535, default are - usually 1472,1452,1460 or 1440. --t, --timeout=INTEGER - timeout for SNMP in seconds (Default: 5) --V, --version - prints version number -Note : - CPU usage is in % of one cpu, so maximum can be 100% * number of CPU - example : - Browse process list : + + + + + ----------- + + + SourceForge.net Logo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FAQ
+ +

 

+ +

Last update : May 25 2007

+ +
+ +

 

+

FIRST, look at the web page associated + with every script.

+

Running the scripts :

+

- The scripts outputs "Can't + locate Net/SNMP.pm in @INC....."

+

- How do I install Net::SNMP + perl module

+

- What are the supported platforms + to run the scripts on ?

+

- How do I get help on the + options ?

+

- Return code of X is out of + bounds

+

- Are these plugins compatible + with Nagios 2.0 ?

+

- ERROR: XXXXXX : Expected + OBJECT IDENTIFIER in dotted notation.

+

- "No Output" using + Nagios 2

+

- Getting : "ERROR: Size + table :Message size exceeded buffer maxMsgSize"

+

- No usable data on file (X rows)

+

Misc
+

+

- Are these scripts secure + ?

+

- How can I get help ? Is + there a mailling list ? a forum ?

+

- Can I donate to help this + project ?

+
+

The scripts outputs "Can't + locate Net/SNMP.pm in @INC....."

+

You don't have Net::SNMP installed, see below

+

How do I install Net::SNMP + perl module ?

+

There are 2 ways of doing this

+

1) By CPAN (best)

+

on command line, as root :
+
+ [your_host]# perl -MCPAN -e shell
+ cpan shell -- CPAN exploration and modules installation (v1.76)
+ ReadLine support enabled
+ cpan> install Net::SNMP
+

+

If it's the first time you run CPAN, it will + probably ask you some (simple) questions.

+

CPAN will also ask you to satisfy some dependencies + (Crypt::DES, Digest::MD5, etc..).

+

2) "By hand"
+

+

Get the folowings modules (tar.gz format) on + www.cpan.org

+

- Crypt::DES
+ - Digest::MD5
+ - Digest::SHA1
+ - Digest::HMAC
+ - Net::SNMP
+
+ for each one (you must install Net::SNMP at the end) :
+ tar zxf <module>.tar.gz
+ cd <module>
+ perl Makefile.pl
+ make test
+ make install

+

What are the supported + platforms to run the scripts on ?

+

Most Linux, maybe some unixes and maybe Cygwin.
+ Actually anything you can run perl on.
+ If you can install the latest Net::SNMP module, then the perl version + should be OK.

+

How do I get help on the + options ?

+

Just run <script> -h on the command + line.
+
+

+

Return code of X is out + of bounds

+

Have a look at : http://www.nagios.org/faqs/viewfaq.php?faq_id=17

+

In case of return code 127, try putting perl + in the command line definition :

+

define command{
+ command_name check_disk
+ command_line /usr/bin/perl $USER1$/check_snmp_storage.pl + -C $ARG1$ [........]
+ }
+

+

Are these plugins compatible + with Nagios 2.0 ?

+

Yes.

+

ERROR: XXXXXX : Expected OBJECT IDENTIFIER in dotted notation. +

+

Upgrade your Net::SNMP module version (5 is good, 4 maybe OK, 3 gives this error)
+ This happens with Debian Woody (Net::SNMP version 3.6).
+ I have special patches if you can't upgrade : contact me.

+

"No Output" using + Nagios 2

+

It's a "bug" of embeded perl. It + has been corrected in latest Nagios releases.

+

You can :
+

+

- Add a patch if your nagios release is old. + Here is a patch made by Gavin Carr for the p1.pl file to correct + this (it should be in nagios CVS shortly). http://nagios.manubulon.com/p1-print.pl.patch +

+

- Upgrade Nagios.
+
+ - add "/usr/bin/perl" before the script command so Nagios + won't use embeded perl.

+

Getting : "ERROR: + Size table :Message size exceeded buffer maxMsgSize"

+

Your snmp table is too big.

+

Some of my scripts (check_snmp_storage and + check_snmp_process) now have an option (-o) to set this directly + on command line (thx to Makina Corpus for the patch).

+

In other scripts, try adding :

+

$session->max_msg_size(5000);
+

+

After the session has been initialized.

+

No usable data on file (X rows)

+

Scripts like check_snmp_int need to store data when they get a SNMP counter so they can outpout readable data like bandwidth, cpu, etc....

+

For example, to output a bandwidth with an octet counter, check_snmp_int will store data every time it is run. It will also read the previous data, and try to get data old enough to make a correct average. By default, it needs data which was produced 5 minutes ago.

+

So, when you first run the script - or if you run it a long time ago -, it won't be able to get data old enough and will report an error (UNKNOWN status) saying the is "no usable data on file (X rows)".
+ If you leave the 5 minutes default delta value, the script will need data wich is :
+ - At least 4 minutes and 30 seconds old (5 min - 10%)
+ - At most 15 minutes old (3 * 5 min)

+

You can change this 5 minutes value using the '-d <sec>' option. The script will then look for data which is at least <sec>-10% old and at most 3*<sec>.

+

This option will only tell to make an average on <sec> seconds, you can run the service every minute with Nagios, it will always get the newest value which is at least <sec>-10% old.
+ The only thing you must check is that your service will at least run every 15 minutes, or the script will always output "unknown" as the value will be too old for him.

+


+ Are these scripts secure ?

+

Not at all ! You must secure the Nagios server.
+ Nobody else than the nagios user should be allowed to even think + about running these scripts.
+

+

How can I get help ? Is + there a mailling list ? a forum ?

+

Go to the sourceforge project page for all this : Nagios-snmp +

Can + I donate to help this project ?

+

Of course you can, I just haven't got any idea + of how, so just send a postcard to my son (Jolan) with a nice drawing (or buy a cookie to your son/daughter/nephew/grand-ma...).
+ You can get my postal address on my resume (www.manubulon.com/cvpproy.htm).
+ He will answer you when he knows how to write (in several years).

+
+

This project is also hosted by :
+ + SourceForge.net Logo +

+ + + + + + + +

 

+ + + + + diff --git a/doc/html/nagios.manubulon.com/img/sideback.jpg b/doc/html/nagios.manubulon.com/img/sideback.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ccb3099397bab133025129716f852a2cb78f626d GIT binary patch literal 1083 zcmex=Hq-)3-T;9z58XJh4H zXJ_Z+|EI`$@KzRlhK~^C}Lq|5@z(jVX zLJ_0Ji3>TDoi-j64Z8S2#W<;`iIYoATtZSxRZU$(Q_IBE%-q7#%Gt%$&E3P(D>x)H zEIcAIDmf)JEj=SMtGJ}Jth}PKs=1}Lt-YhOYtrN?Q>RUzF>}_U#Y>hhTfSoDs!f}> zY~8kf$Ie}c4j(ys?D&b3r!HN-a`oEv8#iw~eDwIq(`V0LynOZX)8{W=zkUDl^B2fp zj10^WZ^3Na!7z&H5(dowZvp@| C*J`Q& literal 0 HcmV?d00001 diff --git a/doc/html/nagios.manubulon.com/img/smalllogo7.jpg b/doc/html/nagios.manubulon.com/img/smalllogo7.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8a743981250c0a50241ceea1f2293ab9eee771de GIT binary patch literal 5338 zcmbVQc|25a+duX#YseB)S&}tdvSd;rc@U8pOoePowoHr}WzCWzl*$?+OJXR=*i{l) ze@4tgQOHa*j%J*BPw(?S&-1?TKhOJl@AEmIbDz(-uIs+P*L{7j`??S3FAfEeIAvpJ z18{M11H0i1;LHHW;kSR^xVd2+Sd9B0?O#3aKSutWh5sS;5AlEduj^0tf)$;`_U8;J+FdHxDl#zkr~Sum~(bkN~*3czC#ZdHDEvd12{z_&dNW z$tSf}-->^y^96x@;nD^-?v@Iw9Bb^7ars17HM|&cQ%G2Lmz=zUn)-f?1DZz0hfEHe znjJr3ZDV`V?$jAqx3li&JUo5<{4WIr1_eh(MPG}-T#rpmN=`{lyOo}kdoM4);QoWc zvhpVtl~qrxYhE-p6IxndzH004>Fw(uc>C`C=-BwgrElLEKi4;Y zF*m`j-+yp%0X+Y7+24WvFIb*O?LU$I-+x2`O-

!Z$^-;B z0P5#DB)H811dKsnNcaHj6gWsh^oOMuiEI}`6P1Ua(I2|LWQ3fY+gGSnannf*{jOS$ z7V2Gk*GFHOXPzr|Dgod1{m}1rV&m}2#E~~8xwb9fShbSPx3e~JK?`(NMaf0!8k;SP zM-lhs56eJd9deWHc2ozHBO^7XAzDerg$`8 yfUwsxeQbfuj4Chg<7A5@ihkBm&M z9zCuCXf?tn?XzV)ub_E+tI4W;C9aPHya?+bCgI&i$bGWKg6%T#w5J<_y1WACUM3BQ z<`t6wORos8Aqj1+y>=?b>~#*%r3yP|5e5l&tvNtYJP*^GvDujl9;a~t`JmrPb5c`L z96<7MfbDqn5wq#~C!_T$g?yMx80XB(VnQyWSS2bE)QU;LQ_9KoD{HH96hs=dw>5)V z0IJb14fhls9#eayTS}`l8)Z4QezHJ^2$|Qb+&gjWs_kqZSJ)f$&@Q$jc2$5a%fmcv z10cZhz!|BYn$5Sb)3hNQ*ge)yj1KcPy;+4BvGE z3#;>f+`f$sV>v9xp77C`SScE?qVGx;ohD@W7HLl2axj=fCGq9IlQw#hC;wLhw_#yr zq1~qBZN3169^&+v zkNwkpbLT|E9ap^n8kYG%Zbq<`?OEQR!Pnis6nvLc>YUK0+NdMC2xUw_Kgp-GW*JGp ze_~aZ=pPcbDHvLt)c8DALn-D0vPj1;YkU^f#VETh&jCBWk9XX32 zo?OH|W#QpVwO4!m!+3DWj2!e;eA-=l8mqu*>y$u0luM=z{*yB;zK z2e~)^{~u07TONQ&$d*+Ou(HZPFylcXiUvEBf|OjIoYMoXDG!kX-Y175_<=`qzW_GT}8`I z6<@Km;34GxAnYz!aC9@|L5MmZKcnA{@%(wt(|MPTQa`< zL*Yr9do%|yLyF+LLh+OZ4v>iu{6P%Hr=WRPqSq2WImKKxCX2B5rn-$PklvqBB2PQ( z7JdIdXL79eZPr#K`Za=nYz@>#uj;^Xtj0U`;XV>uVpe*d21gARBBIi(EpUV%^0VteESs{~-Q%$<{!2Q8kZ7`8OVYvrWFrRu$ z^%D*;>$n^yaFZ}3JFEAwZy)wbkZ%@KbMIi-R?0!!pVKf4zT&$MTPna*IE4fL>v&q+ETy1QERh{r{WcQbP3_*!OZpCHpOds*y>J%MWjSzI@AnjpRZ(4eQH%4 z_U^9jdzNxb#ZAbRjkR6aqo4;vDopA#CYbg^33+CsIm_1349f^AaNp5*%jM|p_a6)d zl$IBVLE{WasGQ{v4{phpVL3Um+_0)GU_c$)b_%#-{yLL;8N6U9=z{MC^X>GJh>oa{2K{7Vj}2WEj)({cz>|?bklQhZbr-9*Q zg_xeT6rx~Qbe+2!!-53m)p&+DUe?vt2{k&rv7D>=^W^$7em}Qvzj@UitJhx*p4COQ z%*;SsEI5ntv0;{WrWGY#Nz!^a~St|y-H#Po-q(_;sB{P_>wqHZ4Y_07IEm zY&cCDcDD5wvy9k+Ep5ft%@b_2ZekT?rpHsc%3?G)tlWq6;L7NOy!a0Xdu~eC z?SDTph3@P?MZEvk(1&eBK1!sLv+zQ2a5g~vgzdKGAruO%uELEei;Q<@qO@#v<_O{8 zv^cwqug6H^cbM6%l(ap(`;rG@p+zEP&0C;%P7`+N1&r`=x3bK{uTb$*U=uYy&a1tV zPuV!=jhC19=&l z2JykWIU=J-E-b}8b~w{m#2e}KlEF`?P}Eo$?U>5iyz5PTEDLC=@ZQlJuWl|EJp5k4 z{27{X8#Bqw)9gCt?7F&UG#WEEHAlX|#^Af|yCa+O3T_ZXge=@6DJXOnex_*mPd|n> z$;*?--h-GPQ@l}isB%ko-n2e5P|wBUJx#!TUh5lAOf=z6|9!XaHjii5hP={=k{MGwBp3jZse&1BAh; zm(Rf_3Q=LMAuao+Ue(!K^+r1UOU4sDo^8ozkOh0?-*z=DPW>555#!Dj-)^$piyML@ z7#rlBd+5>%JIn?$b-&ux6Z9nJzFqZN7L6($&efaoE7-jJ;r(H4$G~LfYZq@9Vo~M$ zD%G+=aHHk>;47%OSQgcdkVjH(n6vau7*n}zkI^jw-uagyGidjq0%?4S^x-U7+& zUyVnSB5H0A-Hug&dXSfjr)LI;tp#kwM0ynypMh@sWD&#AV)~3VI|#T0gqm-g+vj^k zDQdO2dbb!11cmNSmGi^?6vZjQ?0Zv8KSl&KkSpFWr*}7kYb+bA(OA0>eTvEflCl19 z?Hg*>@U86@Lk%JXPI_WKh1Nca$>BZ|XP!hlDDIX1ru=P-BL^tiYJM>j$q0bNvgi%H z*}|}CPw0>j$U0pJ4fGZ2B}Wf)UC*_+>xntCu|y#dTC!#&_jz?)eF7NRSuV2vWD^^< z_V%OmaL0(v`zb0^pv#>oZgGZXN#FpzcFKbeg@bMrVMZCP45QyGb;{~(cI=VH4igHngx=I%(&L7EH~0T z>y{atUm72nsn$H2X>ij2q~L7Mp>;c(hq(1GGasrQI#6+sYDh6_-|?mj=Cc?)BrI8F zMYo<-9mNN0P{4@aXAYfJM5oR9r0aNc(DbYBY)K@I$d(?X7I%ha zaR4Egm?Gfm?m}22w(^DSUabS#~XpdT6T8XwVlbUkQa1L_ZO`W)H+K@w} z?^&7`Nk- zh2xar^^uVL-zkr;-cqkn5Z8FpqbO$E{I1Wt&h^?D`sKZQBsaC!6C9uunRk~3?{-~% zWV$suRY4v^)q=&n#XMhL5FZ7?$AwD-@D-f{Sl|A-zi5LTc$4JUl=1amft!Ag_z=1h zuC88T)%%l@;h~eQ2Jg7TnH`mZ>YAw7^=n19e8x zI{o}uY3AG4yQR1KBSOBSr>m${Y$bn|Db|$Xw9-gHa4mZh6BY}Xd#dZOr;2;#^fIiQ zCS_Ky)MHI)IsvDz^FLU4zw$&YdH1}E%w`o^@--xy3Qn^OaFcTi+b>{N=%wL=CoOC# zLvZl*btr;(%9v$|Zo6;IliV!Sx$*XwWv!^VXVvGd6(l@PB>?=-3LRRtjHW&)&gx{Z z{)!cggkqgf@dE+`=_DL{9PNV5_!2?QU8@eXVlEQYizJ+VK9;DPqwOof*hP3SPmCMm-Wm^v&U*2jl)b$Yma3o#B6ZKYn z!H{_o4pR(~(t+o)h_NiDFEXEwLOU>*n50nI^*#lYzARtYCNpi9gGpA@wfh72=}R|U zOFLJ+-MgJYBYS2Sn94eb?+#@J;zpFk7%|;j(V&Ifyp!Cw*!uE%aEc~fw&4{1)*o{khpKEIGJBHs(Cmee8$|c*Z>Fh}8+>~ei8>bB+(3d{dMHYY%7$h|&!3c#G z$7prpl*cUes9CZ@vgYx~lcS+7qocfTz|Jov+Tr<^w67b_g(@fhEK9#3a?*9TU(`2i nX&{uR)eCp;ymI)k*C%U0ePRQOD&ZQz7r_fBVl91IfHVCc)gFQW literal 0 HcmV?d00001 diff --git a/doc/html/nagios.manubulon.com/index.html b/doc/html/nagios.manubulon.com/index.html new file mode 100644 index 0000000..3109f66 --- /dev/null +++ b/doc/html/nagios.manubulon.com/index.html @@ -0,0 +1,352 @@ + + +Nagios plugins + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
This site :
Home
Nagios plugins
Info on snmp
Nagios config
FAQ
Project page on SourceForge
-----------
Links :
Nagios + + Home
Nagios + Plugins
Oreon project
NagiosExchange
Opsyx + forum
Forum 2037
-----------
Others :
+ + +
-----------
SourceForge.net Logo
+ +
+ + + + + + + + + + +
My plugins for Nagios

Last update : Oct 12 2007

+

Lastest updates :

+

I've set up a wiki for the FAQ and the nagios config so users can contribute : http://nagios.manubulon.com/wiki

+

------------

+

Three scripts have been rewriten in C : check_snmp_int, check_snmp_process, check_snmp_storage
+ Have a look at the C plugin page

+

About the scripts

+


+ The general idea of these scripts is to check as many things as + possible with snmp : disks, memory, load, interface, running procsses, + etc...
+

+

The other idea is to select (or exclude) disks, + interfaces, process using regular expressions
+
+ - it is possible to test more than one disk/int/process in one Nagios + check (ex : eth* instead of eth0,eth1,eth2,...)
+
+ - you only have to provide a unique part of the name to select a + disk/int/process (ex : "^C:" instead of "C:\ Label: + Serial Number xxxxxxx" makes it easy to use on multiple Windows + hosts).

+

Most of these scripts can output performance data.

+

Perl plugins main page

+

Information + on useful parts of mibs (currently MIB-2,Net-SNMP,Cisco,CheckPoint).

+

Configurations + examples for Nagios with the scripts.
+

+

FAQ

+

Get + + support, subscribe to mailing-list, etc..

+
+

Go to the perl plugins + main page for more details and compatibility matrix
+ or here is a brief description of the scripts :

+

You can also download the all the plugins + with install script : nagios-snmp-plugins.1.1.1.tgz
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Script detail pageDescriptionperformance
+ output
Supported platforms / snmp agentsDownloadVersion
Full C package

All the rewritten scripts in C :
+ check_snmp_int, check_snmp_process, check_snmp_storage
+

+
  nagios-plugins-snmp-0.6.0.tgz0.6.0
Full perl packageAll the scripts with install script in a tgz file or in a + rpm file for FC6.  

nagios-snmp-plugins.1.1.1.tgz

+

nagios-plugins-snmp-extras-1.1-1.noarch.rpm

1.1.1
check_snmp_storagechecks storages (disks, swap, memory, etc...)YesAll MIB-2 compliantcheck_snmp_storage.pl  
check_snmp_intchecks interface states, usage on hosts, switch, routers, + etc....YesAll MIB-2 compliantcheck_snmp_int.pl  
check_snmp_processchecks if process are running, the number that are running, + memory and cpu used.NoAll MIB-2 compliantcheck_snmp_process.pl 
check_snmp_loadchecks the load or the cpu of a machineYesLinux, Windows, Cisco, AS400, HP Procurve, LinkProof, Blucoat, + Nokia, Fortinet, Netscreen,HP-UX.check_snmp_load.pl 
check_snmp_vrrpchecks the interface state of vrrp clusterNoNokia IP (VRRP & Clustering), LinkProof, Alteoncheck_snmp_vrrp.pl 
check_snmp_cpfwchecks Checkpoint Firewall-1 status YesCheckpoint Firewall-1check_snmp_cpfw.pl 
check_snmp_memChecks memory and swap usageYesLinux/Net-snmp, Cisco, HP Switchcheck_snmp_mem.pl 
check_snmp_winChecks windows servicesNoWindowscheck_snmp_win.pl 
check_snmp_cssChecks css services stateNoCSScheck_snmp_css.pl 
check_snmp_envChecks environemental status (fan, temp, power supply).NoCisco, Nokia, Bluecoat, IronPort, Foundrycheck_snmp_env.pl 
check_snmp_nsboxChecks nsbox vhost & diode status.NoNetSecureOne Netboxcheck_snmp_nsbox.pl 
check_snmp_boostedgeChecks Boostedge servicesNoBoostedgecheck_snmp_boostedge.pl 
check_snmp_linkproof_nhrChecks linkproof NHRNoRadware Linkproofcheck_snmp_linkproof_nhr.pl 
+

Try <script> -h for help.
+ More information on the main plugin page
+

+

Get latest CVS + versions : In case I told you so, or you want to see how + the plugins will be in next version

+
+

To contact me : + +

Thanks to all of you for your small or big + contributions, or simply your feedbacks :
+
+ Christoph Maser, Alexius Ludeman, John Vincent, Anti Andreimann, + Matteo Contri, Sean Finney, Eric Poelke, Russel Adams, Vincent Carpentier, + Kaya, Dimo Velev, Jan Jungmann, DonKiShoot, Makina Corpus.
+
+ And all the others I forgot !!

+
+

All code here is under GPL licence.

+

This project is hosted on :
+ SourceForge.net Logo

Nagios and the Nagios logo are registered + trademarks of Ethan Galstad.

+

 

+ + + diff --git a/doc/html/nagios.manubulon.com/index_commands.html b/doc/html/nagios.manubulon.com/index_commands.html new file mode 100644 index 0000000..3dc3ecd --- /dev/null +++ b/doc/html/nagios.manubulon.com/index_commands.html @@ -0,0 +1,2028 @@ + + +Nagios plugins + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
This site :
Home
Nagios plugins
Info on snmp
Nagios config
FAQ
Project page on SourceForge
-----------
Links :
Nagios + + Home
Nagios + Plugins
Oreon project
NagiosExchange
Opsyx + forum
Forum 2037
-----------
Others :
+ + +
-----------
SourceForge.net Logo
+ +
+ + + + + + + + + + + + + + + + + +
My plugins for Nagios + +
+ +

Last update : Jun24 2006

+ +

This page is been migrated on the wiki : http://nagios.manubulon.com/wiki/index.php/Commands-host-url

+

It will remain until all has been migrated.

+

Commands

+

Here are commands example to use my scripts + + with nagios.
+ + It's only the basic things you can do, check the help of every + + script if you need more advanced features especially if you need + + performance outputs.
+ + The command definitions are complete, but not the service definitions + + : you must add host name, contact groups, etc....

+ +

All these commands use $USER<n>$ macros + + to put snmp login. The reason for this is that the ressources.cfg + + file cannot be read by the CGI, preventing your "passwords" + + to be seen with the config.
+ + You must set the $USER7$ or $USER8$ to make these examples work. + +
+ + The $USER<n>$ macro are defined in the resources.cfg file

+ +

SNMP login with $USER<n>$
+ + About regular expressions

+ +

Configuration examples + + of
+ +
+ + check_snmp_boostedge.pl
+ +
check_snmp_cpfw.pl
+ +
check_snmp_css.pl + + & check_snmp_css_main.pl
+ +
check_snmp_env.pl
+ +
check_snmp_linkproof_nhr.pl
+ + check_snmp_load.pl
+ + check_snmp_interface.pl
+ + check_snmp_mem.pl
+ +
check_snmp_nsbox.pl + +
+ + check_snmp_process.pl
+ + check_snmp_storage.pl
+ + check_snmp_vrrp.pl
+ +
check_snmp_win.pl

+ +

Checks you can make by + host type

+ +

SNMP + + login
+ +

+ +
For more information, you can have a look at information + + on snmp login

+ +

If you are using snmp v1 :
+ + $USER7$=-C <community>

+ +

If you are using snmp v2c :
+ + $USER7$=-C <community> -2

+ +

or you can use $USER9$ if you need both v1 and v2c.

+ +

Examples of snmp v3 login :
+ + AuthNoPriv (md5) :
+ + $USER8$=-l <login> -x <pass>

+ +

AuthPriv (md5,aes) :
+ +
$USER8$=-l <login> -x <pass> -X <pass> + + -L md5,aes
+ +

+ +

+ +

About + + regular expressions

+ +

With all these scripts, when you select an + + interface, a service or process name etc... you use by default regular + + expresions :
+ + Note : you can disable this by using "-r"

+ +

Examples : Don't forget it is perl regular + + expressions.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
RegexpWill match
etheth0, eth1, eth2 but also Fastethernet0/0 + + ....
eth[1-9]eth1, eth2, ... eth9 but also eth10, eth11
eth[1-2]$eth1, eth2 only (not eth11 for ex).
dhcpdhcpc, dhpcd
+ +

 

+ +

check_snmp_boostedge.pl + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Commandcheck_snmp_boostedge
Nagios cmddefine command{
+ + command_name check_snmp_boostedge_v1
+ + command_line $USER1$/check_snmp_boostedge.pl -H $HOSTADDRESS$ + + $USER7$ -s $ARG1$ -n $ARG2$ $ARG3$
+ + }
ArgumentsARG1 : Service name (regexp)
+ + ARG2 : Number of services selected by regexp which must be in + + running & enabled state
+ + ARG3 : additional arguments if needed.
Service + +

boostedge_services : checks is there is 3 active + + & enabled service matching "test" with + + snmp v2c

+ +
Nagios servicedefine service {
+ +    name boostedge_services
+ +    check_command check_snmp_boostedge_v1!test!3!-2
+ + }
+ +

check_snmp_cpfw.pl

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Commandcheck_cpfw1_v3
Nagios cmddefine command{
+ +   command_name check_cpfw1_v3
+ +   command_line $USER1$/check_snmp_cpfw.pl -H $HOSTADDRESS$ + + $USER8$ $ARG1$
+ + }
ArgumentsARG1 : all arguments.
Service + +

checkpoint_verification : checks high availability + + cluster, with policy "CP_Policy" installed, and + + warning at 100000 connexions, critical at 200000
+ + CP_Management : checks management station

+ +
Nagios servicedefine service {
+ +    name checkpoint_verification
+ +    check_command check_cpfw1_v3!-swa -p CP_Policy + + -c 100000,200000 -f
+ + }
Nagios service + +

define service {
+ +    name CP_Management
+ +    service_description CPFW1 management
+ +    check_command check_cpfw1_v3!-sm
+ + }

+ +
+ +

check_snmp_css.pl + + & check_snmp_css_main.pl

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Command + +

check_snmp_css_main : get index from the host, services + + are then checked using check_snmp_css_indexed (snmpv2)
+ + check_snmp_css_indexed : check services indexed by + + check_snmp_css_main (snmpv2)
+ + check_snmp_css : directly read index & data from + + the host (snmpv2)

+ +
Nagios cmddefine command{
+ +   command_name check_snmp_css_main
+ +   command_line $USER1$/check_snmp_css_main.pl -H $HOSTADDRESS$ + + $USER7$ -2
+ + }
Nagios cmddefine command{
+ +   command_name check_snmp_css_indexed
+ +   command_line $USER1$/check_snmp_css.pl -H $HOSTADDRESS$ + + $USER7$ -2 -d -n $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$
+ + }
Nagios cmddefine command{
+ +   command_name check_snmp_css
+ +   command_line $USER1$/check_snmp_css.pl -H $HOSTADDRESS$ + + $USER7$ -2 -n $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$
+ + }
Arguments + +

ARG1 : regexp of service(s) to check
+ + ARG2 : warning level for : minimum number of active & + + alive service , average response time, number of connexions
+ + ARG3 : critical level for : minimum number of active & + + alive service , average response time, number of connexions + +
+ + ARG4 : additional arguments if needed.

+ +
Service + +

css_index_file_create : This is a "fake" + + service, which only creates index file in /tmp. It normally + + returns the number of services it indexes, or an error if + + he can't.
+ + css_verif_TEST : checks at least 2 services + + mathnig TEST are up. Warning if 1, critical if 0. This service + + uses the index file created by css_index_file_create, and + + returns UNKNOWN if it can't find it.
+ + css_verif_TEST2 : checks at least 2 services + + mathnig TEST2 are up. Warning if 1, critical if 0. This service + + doesn't use an index file.

+ +
Nagios servicedefine service {
+ +    name css_index_file_create
+ +    check_command check_snmp_css_main
+ + }
Nagios service + +

define service {
+ +    name css_verif_TEST
+ +    check_command check_snmp_css_indexed!"TEST"!1!0 + +
+ + }

+ +
Nagios service + +

define service {
+ +    name css_verif_TEST2
+ +    check_command check_snmp_css!"TEST2"!1!0 + +
+ + }

+ +
+ +

 

+ +

check_snmp_env.pl

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Commandcheck_snmp_env (snmpv1)
+ + check_snmp_env_v3 (snmpv3)
Nagios cmddefine command{
+ +   command_name check_snmp_env
+ +   command_line $USER1$/check_snmp_env.pl -H $HOSTADDRESS$ + + $USER7$ -T $ARG1$ $ARG2$
+ + }
Nagios cmddefine command{
+ +   command_name check_snmp_env_v3
+ +   command_line $USER1$/check_snmp_env.pl -H $HOSTADDRESS$ + + $USER8$ -T $ARG1$ $ARG2$
+ + }
ArgumentsARG1 : type (cisco|nokia|bc|iron)
+ + ARG2 : additional arguments if needed.
Service + +

ironport_env : checks ironport fans RPM > 1500 + + and temp < 70 deg celcius
+ + nokia_env : checks nokia IP fans and power supply status
+ + cisco_env : checks cisco fans and power supply status + +

+ +
Nagios servicedefine service {
+ +    name ironport_env
+ +    check_command check_snmp_env!iron!-F + + 1500 -c 70
+ + }
Nagios service + +

define service {
+ +   name nokia_env
+ +   check_command check_snmp_env_v3!nokia
+ + }

+ +
Nagios service + +

define service {
+ +   name cisco_env
+ +   check_command check_snmp_env_v3!cisco
+ + }

+ +
+ +

check_snmp_linkproof_nhr.pl

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Commandcheck_snmp_lp_nhr_v3 (snmpv3 and performance output)
Nagios cmddefine command{
+ +   command_name check_snmp_lp_nhr_v3
+ +   command_line $USER1$/check_snmp_linkproof_nhr.pl + + -H $HOSTADDRESS$ $USER8$ -f
+ + }
ArgumentsNone
Service + +

linkproof_nhr : returns
+ + WARNING if one nhr at least is in "no new session" + + or "inactive" mode.
+ + CRITICAL if all nhr are inactive.

+ +
Nagios servicedefine service {
+ +    name linkproof_nhr
+ +    check_command check_snmp_lp_nhr_v3
+ + }
+ +

check_snmp_load.pl

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Commandcheck_snmp_load_v1 : using snmpv1 (or v2 depending + + on $USER7$ value)
+ + check_snmp_load_v3 : using snmpv3
Commanddefine command{
+ +    command_name check_snmp_load_v1
+ +    command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ + + $USER7$ -T $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$
+ + }
Commanddefine command{
+ +    command_name check_snmp_load_v3
+ +    command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ + + $USER8$ -T $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$
+ + }
Arguments + +

ARG1 : host type (stand,netsc,netsl,as400,cisco,cata,nsc,fg,bc,nokia,hp,lp,hpux)
+ + ARG2 : warning level
+ + ARG3 : critical level
+ + ARG4 : additional arguments if needed.

+ +
Servicebluecoat_load : Bluecoat cpu usage
+ + Linux_load : Linux load (1min, 5 min, 15 min)
+ + Cisco_load : Cisco cpu usage
+ + lp_load : Radware Linkproff cpu usage
Servicedefine service {
+ +    name bluecoat_load
+ +    check_command check_snmp_load_v1!bc!95!99
+ + }
Service + +

define service {
+ +    name Linux_load
+ +    check_command check_snmp_load_v1!netsl!4,3,3!8,5,5
+ + }

+ +
Service + +

define service {
+ +    name Cisco_load
+ +    check_command check_snmp_load_v1!cisco!90,80,60!100,100,100
+ + }

+ +
Servicedefine service {
+ +    name lp_load
+ +    check_command check_snmp_load_v1!lp!90!99
+ + }
+ +

check_snmp_interface.pl

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Command +

check_snmp_int_v1 : using snmpv1
+ check_snmp_int_v3 : using snmpv3

+
Commanddefine command{
+ +   command_name check_snmp_int_v1
+ +   command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ + + $USER7$ -n $ARG1$ $ARG2$
+ + }
Commanddefine command{
+ +   command_name check_snmp_int_v3
+ +   command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ + + $USER8$ -n $ARG1$ $ARG2$
+ + }
Arguments + +

ARG1 : regexp of interface
+ + ARG2 : additional arguments if needed.

+ +
Servicecheck_int_1_6: Checks FastEthernet 1 to 6 are up (snmpv1)
+ + check_int_eth0_bdw : Checks input bandwith on eth1 is + + < 100 KBytes/s and output is < 50 Kbytes/s (critical at + + 0,0 means no critical levels). (snmpv3)
Service + +

define service {
+ +   name check_int_1_6
+ +   check_command check_snmp_int_v1!"FastEthernet-[1-6]"
+ + }

+ +
Servicedefine service {
+ +   name check_int_eth0_bdw
+ +   check_command check_snmp_int_v3!eth0!-k + + -w 100,50 -c 0,0
+ + }
+ +

check_snmp_mem.pl

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Commandcheck_snmp_mem
Commanddefine command{
+ +   command_name check_snmp_mem_v1
+ +   command_line $USER1$/check_snmp_mem.pl -H $HOSTADDRESS$ + + $USER7$ $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$
+ + }
Commanddefine command{
+ +   command_name check_snmp_mem_v3
+ +   command_line $USER1$/check_snmp_mem.pl -H $HOSTADDRESS$ + + $USER8$ $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$
+ + }
Arguments + +

ARG1 : Host type (-N, -I, -E)
+ + ARG2 : warning level(s)
+ + ARG3 : critical level(s)
+ + ARG4 : additional arguments if needed.

+ +
ServiceLinux_memory : warning at 95% memory used and 60% swap + + used, critical at 99% mem and 90% swap
+ + Cisco_mem : warning at 80% used, critical at 99% used.
Servicedefine service {
+ +   name Linux_memory
+ +   check_command check_snmp_mem_v1!-N!95,60!99,90
+ + }
Service + +

define service {
+ +   name Cisco_mem
+ +   check_command check_snmp_mem_v1!-I!80!99 + +
+ + }

+ +
+ +

check_snmp_nsbox.pl + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Commandcheck_snmp_nsbox (snmpv1 or v2c)
Nagios cmddefine command{
+ + command_name check_snmp_nsbox
+ + command_line $USER1$/check_snmp_nsbox.pl -H $HOSTADDRESS$ $USER7$ + + -d $ARG1$ -s $ARG2$ -n $ARG3$ $ARG4$
+ + }
Arguments + +

ARG1 : Diode name (regexp)
+ + ARG2 : Vhost name (regexp)
+ + ARG3 : Number of diodes and vhost that must be up
+ + ARG4 : additional arguments if needed.

+ +
Service + +

check_service_nsbox : checks using snmpv2
+ + - 6 diodes matching "diode_name" are up
+ + - 3 vhosts matching "vhost_name" are up

+ +
Nagios servicedefine service {
+ +     name check_service_nsbox
+ +     check_command check_snmp_nsbox_v1!diode_name!vhost_name!6,3!-2
+ + }
+ +

check_snmp_process.pl

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Commandcheck_snmp_process
Commanddefine command{
+ +   command_name check_snmp_process_v1
+ +   command_line $USER1$/check_snmp_process.pl -H $HOSTADDRESS$ + + $USER7$ -n $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$
+ + }
Arguments + +

ARG1 : regexp of process name
+ + ARG2 : warning level(s)
+ + ARG3 : critical level(s)
+ + ARG4 : additional arguments if needed.

+ +
Servicesproxy_checks : checks with snmpv2 (-2 option) that + + there is more than 21 process matching "proxy", but + + no more than 1999 (critical at 20 & 2000)
+ + Check_httpd_all : Checks that process matching + + "httpd"
+ + - Process number is > 5 and < 100 (or returns warning)
+ + - Process number is > 0 (or returns critical)
+ + - Memory used (by httpd process using the max memory) is < + + 20 Mbytes or < 30 Mbytes
+ + - Cpu used (by all process together) is < 90% or 99%.
+ + check_crontab : checks crontab is running (critical if + + not, no warnings).
Servicedefine command {
+ +   name proxy_checks
+ +   check_command check_snmp_process_v1!proxy!21,1999!20,2000!-2 + +
+ + }
Servicedefine command {
+ +   name Check_httpd_all
+ +   check_command check_snmp_process_v1!httpd!5,100!0!-2 + + -m 20,30 -u 90,99
+ + }
Service + +

define service {
+ +   name check_crontab
+ +   check_command check_snmp_process!crond!0!0
+ + }

+ +
+ +

check_snmp_storage.pl

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Commandcheck_snmp_storage
Commanddefine command{
+ +   command_name check_snmp_storage_v1
+ +   command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ + + $USER7$ -m $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$
+ + }
Commanddefine command{
+ +   command_name check_snmp_storage_v3
+ +   command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ + + $USER8$ -m $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$
+ + }
Arguments + +

ARG1 : regexp of storage name
+ + ARG2 : warning level
+ + ARG3 : critical level
+ + ARG4 : additional arguments if needed.

+ +
ServiceCheck_LinDisk_home : Checks "/home" mountpoint + + (and only this one because of -r) usage < 90 and 97 %
  + +

define service {
+ +   name Check_LinDisk_home
+ +   service_description Verification /home
+ +   check_command check_snmp_storage_v3!/home!90!97!-r + +
+ + }

+ +
ServiceWin_check_swap : Checks virtual (ram+swap) mem on windows + + < 60% or 90%
  + +

define command {
+ +   name Win_check_swap
+ +   service_description Verification swap Windows
+ +   check_command check_snmp_storage_v3!Virtual!60!90
+ + }

+ +
Servicecheck_linux_swap : checks Linux swap < 60 and 90%
  define command {
+ +   name check_linux_swap
+ +   service_description Verfication swap linux
+ +   check_command check_snmp_storage_v1!Swap!60!90!
+ + }
Servicecheck_disk_all : Checks that "/", "/opt" + + , "/var", "/config" mountpoints usage is + + < 80 and 90%
  define command {
+ +   name check_disk_all
+ +   service_description Verification / /opt /var /config
+ +   check_command check_snmp_storage_v1!"^/$|opt|config|var"!80!90!
+ + }
+ +

check_snmp_vrrp.pl

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Commandcheck_snmp_vrrp
Commanddefine command{
+ +   command_name check_snmp_vrrp_v1
+ +   command_line $USER1$/check_snmp_vrrp.pl -H $HOSTADDRESS$ + + $USER7$ -T $ARG1$ -s $ARG2$
+ + }
Commanddefine command{
+ +   command_name check_snmp_vrrp_v3
+ +   command_line $USER1$/check_snmp_vrrp.pl -H $HOSTADDRESS$ + + $USER8$ -T $ARG1$ -s $ARG2$
+ + }
Arguments + +

ARG1 : Host type (nokia, alteon, lp, nsc, ipso)
+ + ARG2 : state (master or backup) or number of members, max + + % assigned to nodes (for ipso).

+ +
ServiceLinkproof_check_vrrp_master : Checks that all interface + + are in master state
Service + +

define service {
+ +   name Linkproof_check_vrrp_master
+ +   check_command check_snmp_vrrp_v3!lp!master
+ + }

+ +
ServiceNokia_check_vrrp_backup : Checks that all interface + + are in backup state
Servicedefine service {
+ +   name Linkproof_check_vrrp_backup
+ +   check_command check_snmp_vrrp_v3!lp!backup
+ + }
ServiceNokia_clustering : checks that nokia cluster has 2 + + members and that the load assigned to each member < 98%
Servicedefine service {
+ +   name Nokia_clustering
+ +   check_command check_snmp_vrrp_v3!ipso!2,98%
+ + }
+ +

check_snmp_win.pl

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Commandcheck_snmp_win
Nagiosdefine command {
+ +   command_name check_win
+ +   command_line $USER1$/check_snmp_win.pl -H $HOSTADDRESS$ + + $USER7$ -n $ARG1$
+ +   # comment community service(s) name
+ + }
Servicecheck_win_dhcp : Checks dhcp service is running
Nagios + +

define service {
+ +   name check_win_dhcp
+ +   service_description Checks dhcp service is running
+ +   check_command check_win!dhcp
+ + }

+ +
Servicecheck_win_reg_spool: Checks registery access & + + print spool is active (French windows !!)
Nagios + +

define service {
+ +   name check_win_reg_spool
+ +   service_description Checks registery access & + + print spool is active
+ +   check_command check_win!"au registre",spouleur
+ + }

+ +
+ +

Checks you can + make by host type

+

N/A : nothing of this type to check
+ SNMP : yes with simple snmp query
+ ?? : not tested because useless most of the time.

+

Specific : name of the script to look + at for platform specific checks.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Host typeInterfacestorageload/cpumemprocessenvspecific
LinuxYesYesYesYesYesNo 
WindowsYesYesYesYesYesNocheck_snmp_win.pl
Cisco router/switchYesN/AYesYesN/AYes 
HP router/switchYesN/AYesYesN/ANo 
Bluecoat proxyYessnmpYessnmpNoYes 
CheckPoint on SPLATYesYesYesYesYesNocheck_snmp_cpfw.pl
CheckPoint on Nokia IPYesYesYesNo??Nocheck_snmp_vrrp.pl
BoostedgeYesYesYesYes??Nocheck_snmp_boostedge.pl
AS400YesYesYesYesNoNo 
NetsecureOne NetboxYesYesYes??YesNo 
Radware LinkproofYesN/AsnmpsnmpNoNo +

check_snmp_linkproof_nhr
+ check_snmp_vrrp.pl

+
IronPortYessnmpsnmpsnmpNoYes 
Cisco CSSYes??YesYesNo??check_snmp_css.pl
+

 

+ +
+ +

This project is hosted on :
+ + SourceForge.net Logo + +

+ +

Nagios and the Nagios logo are registered trademarks + + of Ethan Galstad.

+ +
+ +
+ + + + + diff --git a/doc/html/nagios.manubulon.com/index_info.html b/doc/html/nagios.manubulon.com/index_info.html new file mode 100644 index 0000000..a460222 --- /dev/null +++ b/doc/html/nagios.manubulon.com/index_info.html @@ -0,0 +1,604 @@ + + +Nagios plugins + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
This site :
Home
Nagios plugins
Info on snmp
Nagios config
FAQ
Project page on SourceForge
-----------
Links :
Nagios + + Home
Nagios + Plugins
Oreon project
NagiosExchange
Opsyx + forum
Forum 2037
-----------
Others :
+ + +
-----------
SourceForge.net Logo
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
My plugins for Nagios +
+

Last update : Jan 14 2006

+

Information on SNMP

+

Snmp login with v1,v2c, + V3

+

These are interesting parts - for me - of different + mibs.
+
+ MIB-2
+ Net-SNMP/UCD-SNMP
+ Cisco
+ CheckPoint
+ Hewlett Packard

+
+

 

+

Snmp login with v1,v2c, + V3

+

There is 3 version of snmp :

+

V1 : you need a community to log in + :
+     <script> -C <community>

+

V2c : you need a community to log in + :
+     <script> -C <community> + -2

+

V3 : you need a login and password. + You can either encrypt data (AuthPriv) or not (AuthNoPriv). Authentication + is encrypted in any case : NoAuthNoPriv is not supported, and is + useless anyway : use snmpv1 in this case.

+

AuthNoPriv : Data is sent in clear, + login and password are encrypted.
+ With default protocol (md5) :
+     <script> -l login -x passwd
+
With sha protocol :
+
    <script> -l login -x passwd -L + sha

+

AuthPriv : Data, login and password + are encrypted
+ With default protocol (md5,des) :
+     <script> -l login -x passwd -X + privpasswd
+
With md5 for logging and aes for encrypting :
+
    <script> -l login -x passwd -X + privpasswd -L md5,aes

+

 

+
+

MIB-2
+

+

Interface :

+

1.3.6.1.2.1.2.2.1 : interface table
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OIDType Description
.1.XIntIndex
.2.XstringDescription
.3.X??Type : 6=ethernet,23=ppp, 24=loopback, 27=atm
.4.X MTU
.5.X Speed
.6.X Phys address
.7.X Administrative status (1=>'UP',2=>'DOWN',3=>'TESTING')
.8.X Operational status (cf admin status)
.9.XCounterInput Octets
.13.XCounterOutput Octets
+

Storages :

+

1.3.6.1.2.1.25.2.2.0 : system memory
+ 1.3.6.1.2.1.25.2.3.1 : storage table
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OIDType Description
.1.XIntIndex
.2.XOIDType : points on OID
.3.XstringDescription
.4.XIntAllocation unit
.5.XIntSize
.6.XIntUsed
.7.XCounter32Allocation failures
+

CPU
+

+ 1.3.6.1.2.1.25.3.3.1 : CPU table
+

+ + + + + + + + + + + + + + + + +
OIDType Description
.X.4OIDType (hrProcessorFrwID)
.X.5Int%used on 1 min (hrProcessorLoad)
+

 

+
+
+

Net-SNMP

+

Load

+

1.3.6.1.4.1.2021.10.1 : load table
+

+ + + + + + + + + + + + + + + + + + + + + +
OIDType Description
.1.XIntIndex
.2.XstringDescription (Load-1, Load-5, Load 15)
.3.XstringLoad (decimal)
+

Memory

+

1.3.6.1.4.1.2021.4 : memory table

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OIDType Description
.1.XIntIndex
.2.XstringError name
.3.XIntTotalSwap
.4.XIntAvailSwap
.5.XIntTotalReal
.6.XIntAvailReal
.11.XIntTotalFree
.13.XIntmemShared
.14.XIntmemBuffer
.15.XIntmemCached
+

CPU

+

1.3.6.1.4.1.2021.11 : CPU table

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OIDType Description
.1.XIntIndex
.2.XstringDescription
.3.XIntSwapIn
.4.XIntSwapOut
.5.XIntIOSent
.6.XIntIOReceive
.7.XIntSysInterrupts
.8.XIntSysContext
.9.XIntCpuUser
.10.XIntCpuSystem
.11.XIntCpuIdle
.50.XCounter32User
.51.XCounter32Nice
.52.XCounter32System
.53.XCounter32Idle
+

+
+

Cisco

+

Generic for routers and switch

+

Cisco CPU load (5min %) : 1.3.6.1.4.1.9.2.1.58.0
+ Cisco CPU load (1min %) : 1.3.6.1.4.1.9.2.1.57.0
+ Cisco CPU load (5sec %) : 1.3.6.1.4.1.9.2.1.56.0
+

+

Memory :

+

1.3.6.1.4.1.9.9.48.1 + : cisco memory pool
+ 1.3.6.1.4.1.9.9.48.1.1.1 : pool table.poolentry

+

.1 : type
+ .2 : name
+ .3 : alternate
+ .4 : valid
+ .5 : used
+ .6 : free
+ .7 : max free
+
+ Routeurs : 2 entry : memory IO and Processor
+ Pix : 1 entry PIX Memory

+
+ CPU

+

1.3.6.1.4.1.9.9.109.1.1.1.1 : cpmCPUTotalEntry
+ 1 : index
+ 2 : phys index
+ 3 : total 5s
+ 4 : total 1m
+ 5 : total 5m
+ 6 : total 5s (new)
+ 7 : total 1m (new)
+ 8 : total 5m (new)

+
+
+

Checkpoint

+

FW : 1.3.6.1.4.1.2620.1.1
+
+ .1.0 : Installed : policy state
+ .2.0 : <string> : filter name
+ .3.0 : <Mon Oct 4 11:34:08 2004> : date install
+ .4.0 : Packets Accept (counter)
+ .5.0 : Packets Rejected (counter)
+ .6.0 : Packets Dropped (counter)
+ .7.0 : Packets Logged (counter)
+ .25.3.0 : Connexions
+ .25.4.0 : Connexions peak

+

HA :
+ 1.3.6.1.4.1.2620.1.5.5.0 : yes : ha active
+ 1.3.6.1.4.1.2620.1.5.6.0 : active : ha state
+ 1.3.6.1.4.1.2620.1.5.7.0 : OK : ha blocking state
+ 1.3.6.1.4.1.2620.1.5.11.0 : "Sync only" (Nokia vrp) : + ha Working mode
+ 1.3.6.1.4.1.2620.1.5.102.0 : OK : ha status

+

1.3.6.1.4.1.2620.1.5.13.1 + : table status
+ .1.X.0 : index
+ .2.X.0 : Nom :
+ Synchronization
+ Filter
+ cphad
+ fwd
+ .3.X.0 : State : "OK" / ??
+ .4.X.0 : haProblemPriority
+ .5.X.0 : haProblemVerified
+ .6.X.0 : haProblemDescr

+


+ SVN :
+ 1.3.6.1.4.1.2620.1.6.102.0 : OK : SVN status code

+


+ Management :
+

+

1.3.6.1.4.1.2620.1.7.5.0 + : "active" : mgmt state
+ 1.3.6.1.4.1.2620.1.7.6.0 : 1 : mgmt is alive
+ 1.3.6.1.4.1.2620.1.7.102.0 : status descr
+ 1.3.6.1.4.1.2620.1.7.103.0 : status long descr

+

1.3.6.1.4.1.2620.1.7.7.0 : mgmt table clients + :
+ .1.X.1.0 : index
+ .1.X.2.0 : client Name
+ .1.X.3.0 : client host
+ .1.X.4.0 : mgClientDbLock
+ .1.X.5.0 : mgApplicationType
+

+
+
+

Hewlett Packard

+


+ 1.3.6.1.4.1.11.2.14.11.5.1.1.2.1.1.1.6.1 : Free memory
+ 1.3.6.1.4.1.11.2.14.11.5.1.9.6.1.0 : CPU
+ 1.3.6.1.4.1.11.2.14.11.1.2.6.1.4.1 : FAN
+ 1.3.6.1.4.1.11.2.14.11.1.2.6.1.4.2 : Power
+ 1.3.6.1.4.1.11.2.14.11.1.2.6.1.4.4 : Temperature
+

+

HP Procurve switch memory check

+1.3.6.1.4.1.11.2.14.11.5.1.1.2.2.1.1 : HP memory pool
+mem pool.1 : memory slot index
+mem pool.2 : hpGlobalMemSlabCnt
+mem pool.3 : Free segments
+mem pool.4 : hpGlobalMemAllocSegCnt
+mem pool.5 : Total Bytes
+mem pool.6 : Free Bytes
+mem pool.7 : hpGlobalMemAllocBytes
+

+
+

This project is hosted on :
+ SourceForge.net Logo +

+

Nagios and the Nagios logo are registered + trademarks of Ethan Galstad.

+
+
+

 

+ + + diff --git a/doc/index.html b/doc/html/nagios.manubulon.com/index_snmp.html old mode 100755 new mode 100644 similarity index 74% rename from doc/index.html rename to doc/html/nagios.manubulon.com/index_snmp.html index e58666b..98faabf --- a/doc/index.html +++ b/doc/html/nagios.manubulon.com/index_snmp.html @@ -1,338 +1,451 @@ - - -Nagios plugins - - - - - - - - -
- - - - - - - - - - - - - - - - -
SNMP plugins for Nagios
-

Last update : April 19 2007

-

About

-

The general idea of these scripts is to check - as many things as possible with snmp (how do you install NRPE on - Cisco or AS/400 ?) : disks, memory, load, interface, running procsses, - etc...
-

-

The other idea is to select disks, interfaces, - process using regular expressions
-
- - it is possible to test more than one disk/int/process in one Nagios - check (ex : eth* instead of eth0,eth1,eth2,...)
-
- - you only have to provide a unique part of the name to select a - disk/int/process (ex : "C:" instead of "C:\ Label: - Serial Number xxxxxxx" makes it easy to use on multiple Windows - hosts).

-

Most of these scripts can make performance - outputs.

-

Enjoy and give me feedback !
-
- All code here is under GPL licence.
-

-

If you want to be informed when I release - new versions,
- or if you have some advices, feedback, questions, go to the project's - sourceforge page : nagios-snmp

-

Please send me your feedback :
- - Test with embeded Perl
- - Test on various systems
- - Bugs, advices, comments, RFE, etc...
- Thank you !

-

Run the scripts with '-h' to get help.

-
-

 

-

Requirements

-

- Perl in /usr/bin/perl - if not run 'perl - script' or change the path in the scripts first line
- - Net::SNMP
- - file 'utils.pm' in diretory /usr/local/nagios/libexec or change - the line "use libs /usr/local/nagios/libexec/" in the scripts
-

-

Configurations - examples

-

Plugins
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

check_snmp_storage
-
-

 

-
-

This scripts checks by snmp (1,2c,3) disks, memory, swap, - everthing in hrStorage table.
- Disk selection can be done by perl regexp on description, - index or type to select one or multiple storages.
-
- Vérifie par snmp v1 ou v3 (merci à V. Carpentier) - l'occupation des disques, mais aussi de la swap, de la mémoire, - etc.. tout ce qui est disponible en snmp par la table hrStorage.
- Les disques sont sélectionnables par expression régulière - compatible Perl

-

Details

-
-

check_snmp_int
-
-

-
-

Checks by snmp (1,2c,3) interface state and usage. Interfaces - can be selected by regexp.
- It is possible to check the input/output bandwidth and error - rate of the interface.
-
- Vérifie par snmp v1 ou v3 l'état des interfaces - d'un hôte.
- Ce script permet d'utiliser des expressions régulières - pour sélectionner les interfaces : ex 'eth' va vérifier - eth0, eth1, ...
- Il permet également de lister toutes les interfaces - disponibles sur la machine cible (option -v).

-

Details

-
-

check_snmp_process

-


-

-

 

-
-

Checks by snmp (1,2c,3) the number (can be 1) of processes - matching a perl regexp.
- The script can also check memory and cpu usage of processes.

-

Vérifie par snmp v1 ou v3 (idem) le nombre de process - sur un hôte.
- Ce script permet d'utiliser des expressions régulières - pour sélectionner les process.
- Il est également possible de vérifier l'utilisation - mémoire et CPU de la machine.
- Il permet également de lister touts les process disponibles - sur la machine cible (option -v).

-

Details

-
-

check_snmp_load

-

 

-
-

Checks by snmp (1,2c,3) cpu or average load.
- Works on Linux, Windows, Cisco, AS400, HP Procurve, LinkProof, - Blucoat, Nokia, Fortinet, Netscreen,HP-UX.

-

Vérifie par snmp (1,2c,3) la charge ou l'ocupation - CPU.
-

-

Details.

-
-

check_snmp_mem

-

 

-
-

Checks by snmp (1,2c,3) :
- - Memory and swap usage on Linux/Net-snmp
- - Memory usage on cisco routers or Pix
- - Memory usage on HP Procurve switchs
- For memory check on other OS (Windows, AS400) see the description - page

-

Vérifcation de
- - l'utilisation mémoire et swap sur Linux/Net-snmp
- - l'utilisation mémoire sur Cisco (routeurs et Pix).
- - l'utilisation mémoire sur Switch Hp Procurve.
- Pour d'autres SE (Windows, AS400), aller à la page - de description.

-

Détail

-
-

check_snmp_vrrp

-

 

-
-

Checks the vrrp state of all the interface of a host. You - can specify if they must be master or backup.
- Supported platforms : Nokia IP (vrrp & clustering), Linkproof, - Alteon.

-

Verifie l'état vrrp des interfaces d'un host.

-
-

check_snmp_cpfw

-

 

-
-

Checks the state of Checkpoint Firewall-1 modules (SVN, HA, - FW, MGMT) and active connexions (tested on NG).
- Snmp extensions must be activated

-

Vérifie l'état des modules Checkpoint Fw-1 - (HA, SVN, MGMT, FW) et les connexions actives. Testé - sur NG-AI R55.
- L'extension SNMP doit être activée sur les modules.

-

Détail

-
-

check_snmp_win

-

 

-
-

Checks windows services state with snmp.

-

Véifie l'état de services Windows par snmp.

-

Détail

-
-

check_snmp_css

-

 

-
Checks css services state
-

check_snmp_env

-

 

-
Checks environemental status (fan, temp, - power supply) on Cisco, Nokia, Bluecoat, IronPort, Foundry.
-
-

Compatibility matrix :

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Systemcheck_snmp_storagecheck_snmp_intcheck_snmp_processcheck_snmp_memcheck_snmp_load
Linux -

OK :
- - '/home', '/var'
- - 'Swap', 'Real Memory'
-

-
OK :
- - 'eth'
- - 'ppp'
OKOK (mem & swap) -

OK

-
Windows -

OK :
- - '^[CDE]:'

-
OKOK -

NO
- See check_snmp_storage for virtual mem

-
OK
Cisco/HP switchN/AOK :
- - 'Giga' : all gigabits
- - 'Fast.*0.1[1234]' : checks FastEternet0/11 to 0/14.
N/AOKOK
AS400OK :
- - '-m RAM -s' to get all RAM
- - 'System ASP' : Disk
-
OK OK -

NO
- See check_snmp_storage

-
OK
LinkProofN/AOKN/AN/AOK
-
-
-

This project is hosted on :
- SourceForge.net Logo -

-

Nagios and the Nagios logo are registered - trademarks of Ethan Galstad.

-
-
- - + + +Nagios plugins + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
This site :
Home
Nagios plugins
Info on snmp
Nagios config
FAQ
Project page on SourceForge
-----------
Links :
Nagios + + Home
Nagios + Plugins
Oreon project
NagiosExchange
Opsyx + forum
Forum 2037
-----------
Others :
+ + +
-----------
SourceForge.net Logo
+ +
+ + + + + + + + + + + + + + + + +
My plugins for Nagios +
+

Last update : Oct 10 2007

+

About

+

The general idea of these scripts is to check + as many things as possible with snmp (how do you install NRPE on + Cisco or AS/400 ?) : disks, memory, load, interface, running procsses, + etc...
+

+

The other idea is to select disks, interfaces, + process using regular expressions
+
+ - it is possible to test more than one disk/int/process in one Nagios + check (ex : eth* instead of eth0,eth1,eth2,...)
+
+ - you only have to provide a unique part of the name to select a + disk/int/process (ex : "C:" instead of "C:\ Label: + Serial Number xxxxxxx" makes it easy to use on multiple Windows + hosts).

+

Most of these scripts can make performance + outputs.

+

Enjoy and give me feedback !
+
+ All code here is under GPL licence.
+

+

If you want to be informed when I release + new versions,
+ or if you have some advices, feedback, questions, go to the project's + sourceforge page : nagios-snmp

+

Please send me your feedback :
+ - Test with embeded Perl
+ - Test on various systems
+ - Bugs, advices, comments, RFE, etc...
+ Thank you !

+

Run the scripts with '-h' to get help.

+
+

 

+

Requirements

+

- Perl in /usr/bin/perl - if not run 'perl + script' or change the path in the scripts first line
+ - Net::SNMP
+ - file 'utils.pm' in diretory /usr/local/nagios/libexec or change + the line "use libs /usr/local/nagios/libexec/" in the scripts
+

+

Configurations + examples

+

Plugins
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Bundle of all plugins +

Version 1.1.1 : nagios-snmp-plugins.1.1.1.tgz

+

This bundle contains all the plugins, including an install + script useful if you have special Nagios or perl paths.

+
+

check_snmp_storage
+
+

Download lasted version

+

 

+
+

This scripts checks by snmp (1,2c,3) disks, memory, swap, + everthing in hrStorage table.
+ Disk selection can be done by perl regexp on description, + index or type to select one or multiple storages.
+
+ Vérifie par snmp v1 ou v3 (merci à V. Carpentier) + l'occupation des disques, mais aussi de la swap, de la mémoire, + etc.. tout ce qui est disponible en snmp par la table hrStorage.
+ Les disques sont sélectionnables par expression régulière + compatible Perl

+

Details

+
+

check_snmp_int
+
+ Download latest version

+
+

Checks by snmp (1,2c,3) interface state and usage. Interfaces + can be selected by regexp.
+ It is possible to check the input/output bandwidth and error + rate of the interface.
+
+ Vérifie par snmp v1 ou v3 l'état des interfaces + d'un hôte.
+ Ce script permet d'utiliser des expressions régulières + pour sélectionner les interfaces : ex 'eth' va vérifier + eth0, eth1, ...
+ Il permet également de lister toutes les interfaces + disponibles sur la machine cible (option -v).

+

Details

+
+

check_snmp_process

+

Download latest version
+

+

 

+
+

Checks by snmp (1,2c,3) the number (can be 1) of processes + matching a perl regexp.
+ The script can also check memory and cpu usage of processes.

+

Vérifie par snmp v1 ou v3 (idem) le nombre de process + sur un hôte.
+ Ce script permet d'utiliser des expressions régulières + pour sélectionner les process.
+ Il est également possible de vérifier l'utilisation + mémoire et CPU de la machine.
+ Il permet également de lister touts les process disponibles + sur la machine cible (option -v).

+

Details

+
+

check_snmp_load

+

Download latest version

+
+

Checks by snmp (1,2c,3) cpu or average load.
+ Works on Linux, Windows, Cisco, AS400, HP Procurve, LinkProof, + Blucoat, Nokia, Fortinet, Netscreen,HP-UX.

+

Vérifie par snmp (1,2c,3) la charge ou l'ocupation + CPU.
+

+

Details.

+
+

check_snmp_mem

+

Download latest version

+
+

Checks by snmp (1,2c,3) :
+ - Memory and swap usage on Linux/Net-snmp
+ - Memory usage on cisco routers or Pix
+ - Memory usage on HP Procurve switchs
+ For memory check on other OS (Windows, AS400) see the description + page

+

Vérifcation de
+ - l'utilisation mémoire et swap sur Linux/Net-snmp
+ - l'utilisation mémoire sur Cisco (routeurs et Pix).
+ - l'utilisation mémoire sur Switch Hp Procurve.
+ Pour d'autres SE (Windows, AS400), aller à la page + de description.

+

Détail

+
+

check_snmp_vrrp

+

Download latest version

+
+

Checks the vrrp state of all the interface of a host. You + can specify if they must be master or backup.
+ Supported platforms : Nokia IP (vrrp & clustering), Linkproof, + Alteon.

+

Verifie l'état vrrp des interfaces d'un host.

+
+

check_snmp_cpfw

+

Download latest version

+
+

Checks the state of Checkpoint Firewall-1 modules (SVN, HA, + FW, MGMT) and active connexions (tested on NG).
+ Snmp extensions must be activated

+

Vérifie l'état des modules Checkpoint Fw-1 + (HA, SVN, MGMT, FW) et les connexions actives. Testé + sur NG-AI R55.
+ L'extension SNMP doit être activée sur les modules.

+

Détail

+
+

check_snmp_win

+

Download version : 0.6

+
+

Checks windows services state with snmp.

+

Véifie l'état de services Windows par snmp.

+

Détail

+
+

check_snmp_css

+

Download version : 1.0

+
Checks css services state
+

check_snmp_env

+

Download latest version

+
Checks environemental status (fan, temp, + power supply) on Cisco, Nokia, Bluecoat, IronPort.
+

check_snmp_nsbox

+

Download version : 1.0

+
Checks nsbox vhost & diode status.
+

check_snmp_boostedge

+

Download version : 1.0

+
Checks Boostedge services
+

check_snmp_linkproof_nhr

+

Download version : 1.0

+
Checks linkproof NHR
+
+

Compatibility matrix :

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Systemcheck_snmp_storagecheck_snmp_intcheck_snmp_processcheck_snmp_memcheck_snmp_load
Linux +

OK :
+ - '/home', '/var'
+ - 'Swap', 'Real Memory'
+

+
OK :
+ - 'eth'
+ - 'ppp'
OKOK (mem & swap) +

OK

+
Windows +

OK :
+ - '^[CDE]:'

+
OKOK +

NO
+ See check_snmp_storage for virtual mem

+
OK
Cisco/HP switchN/AOK :
+ - 'Giga' : all gigabits
+ - 'Fast.*0.1[1234]' : checks FastEternet0/11 to 0/14.
N/AOKOK
AS400OK :
+ - '-m RAM -s' to get all RAM
+ - 'System ASP' : Disk
+
OK OK +

NO
+ See check_snmp_storage

+
OK
LinkProofN/AOKN/AN/AOK
+
+
+

This project is hosted on :
+ SourceForge.net Logo +

+

Nagios and the Nagios logo are registered + trademarks of Ethan Galstad.

+
+
+ + diff --git a/doc/html/nagios.manubulon.com/nagios_cert.cer b/doc/html/nagios.manubulon.com/nagios_cert.cer new file mode 100644 index 0000000..0ca5cad --- /dev/null +++ b/doc/html/nagios.manubulon.com/nagios_cert.cer @@ -0,0 +1,22 @@ +-----BEGIN CERTIFICATE----- +MIIDuzCCAqOgAwIBAgIBCzANBgkqhkiG9w0BAQUFADBFMREwDwYDVQQKEwhwcm95 +Lm9yZzEPMA0GA1UEAxMGUHJveUNBMR8wHQYJKoZIhvcNAQkBFhBwYXRyaWNrQHBy +b3kub3JnMB4XDTA3MDExMTE4MTM0NFoXDTA4MDExMTE4MTM0NFowgYExCzAJBgNV +BAYTAkZSMQ4wDAYDVQQIEwVSaG9uZTENMAsGA1UEBxMETHlvbjERMA8GA1UEChMI +cHJveS5vcmcxDzANBgNVBAsTBk5hZ2lvczEPMA0GA1UEAxMGTmFnaW9zMR4wHAYJ +KoZIhvcNAQkBFg9uYWdpb3NAcHJveS5vcmcwgZ8wDQYJKoZIhvcNAQEBBQADgY0A +MIGJAoGBAKSakWwv5g4cpXu2bL6/Aq+29BmY5pmiqOp5mSifYOfCYJfAMOCyeGAI +03GmEYhWaYVvEC2x03u7WhlbR6WzFsIxnFETdarlEHGl94wicyz6PKnwa9X5vkWm +VKYgulvz6+jmrWFOyJ+Q60nIU0oAVE+0Erlk7MkFkWw1uthWl7VTAgMBAAGjgfww +gfkwHQYDVR0OBBYEFKLfzxeOiNsgM53DMDcpTx7rsIH/MG0GA1UdIwRmMGSAFEE6 +rbWSeijSQchCxUCknwDCivOfoUmkRzBFMREwDwYDVQQKEwhwcm95Lm9yZzEPMA0G +A1UEAxMGUHJveUNBMR8wHQYJKoZIhvcNAQkBFhBwYXRyaWNrQHByb3kub3JnggEA +MAkGA1UdEwQCMAAwLwYDVR0fBCgwJjAkoCKgIIYeaHR0cDovL3d3dy5wcm95Lm9y +Zy9wcm95Q0EuY3JsMC0GCWCGSAGG+EIBBAQgFh5odHRwOi8vd3d3LnByb3kub3Jn +L3Byb3lDQS5jcmwwDQYJKoZIhvcNAQEFBQADggEBADOEbkwCMCjNi6fkw1GR4cyO +wWpHHE2J5en5eh5KIZCsW90vYH2TttjfYk/gnoON3lBsAV+Cisvdx5/LpEuqfZFB +GMApyG58oXPzVipytppyOSxGlDkAnAXC9jNRIiZ4lBDXloziTaIPmjVpBM6wuEpY +7pGo1J7B+GOvKLYFYVX+tuOpMlHJtDJbhn2seTr50MaI0uncnqjKpXHO+J205p8b +psCEkaZSQZ2EXpX+caCFxy1rjqC49glq/DaaxopQlhkUCvDQRoRoHDXg3EBW0Svx +G9emvqbByaf31mUVlIesj8B+Xo8bqRMcEyWfwc7UE94Tzw6Iv2Xl2qFS2wmgMf8= +-----END CERTIFICATE----- diff --git a/doc/html/nagios.manubulon.com/p1-print.pl.patch b/doc/html/nagios.manubulon.com/p1-print.pl.patch new file mode 100644 index 0000000..dd73579 --- /dev/null +++ b/doc/html/nagios.manubulon.com/p1-print.pl.patch @@ -0,0 +1,38 @@ +--- p1.pl.dist 2006-03-21 11:42:30.000000000 +1100 ++++ p1.pl 2006-03-21 11:56:16.000000000 +1100 +@@ -69,27 +69,29 @@ + + sub TIEHANDLE { + my ($class) = @_; +- my $me ; ++ my $me = ''; + bless \$me, $class; + } + + sub PRINT { + my $self = shift; +- $$self = substr(join('',@_), 0, 256) ; +- # $$self .= substr(join('',@_), 0, 256) ; ++ # $$self = substr(join('',@_), 0, 256) ; ++ $$self .= substr(join('',@_), 0, 256) ; + } + + sub PRINTF { + my $self = shift; + my $fmt = shift; +- $$self = substr(sprintf($fmt,@_), 0, 256) ; +- # $$self .= substr(sprintf($fmt,@_), 0, 256) ; ++ # $$self = substr(sprintf($fmt,@_), 0, 256) ; ++ $$self .= substr(sprintf($fmt,@_), 0, 256) ; + } + + sub READLINE { + my $self = shift; ++ # Omit all lines after the first, per the nagios plugin guidelines ++ $$self = (split /\n/, $$self)[0]; + # Perl code other than plugins may print nothing; in this case return "(No output!)\n". +- return $$self ? $$self : "(No output!)\n" ; ++ return $$self ? substr($$self, 0, 256) : "(No output!)\n" ; + } + + sub CLOSE { diff --git a/doc/html/nagios.manubulon.com/package_c.html b/doc/html/nagios.manubulon.com/package_c.html new file mode 100644 index 0000000..a6a6e10 --- /dev/null +++ b/doc/html/nagios.manubulon.com/package_c.html @@ -0,0 +1,192 @@ + + + + +Nagios plugins + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Home

+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Plugins in C

Last update : Jun 9 2007

+ +
+ +

Description :

+ +

Three scripts have been rewriten in C : check_snmp_int, check_snmp_process, check_snmp_storage

+ +

New features in the C plugins :
+
+ - Cache management : the SNMP queries for index search, which are often the biggest ones, can now be cached on disk. Speed gain from this can be up to 10 times on big switches using snmp_int.
+ - Support for other languages (for now only french po file has been done)

+

Perl and C plugins have exactly the same options (except -K added in the C plugins), so you can use the same help pages.

+

download version 0.6.0

+

How to install :

+

Requirements to compile : net-snmp-devel

+

As a non-priviledge user, run ./configure scripts with following arguments :

+

--prefix=<DIR> [ default : /usr/local/nagios/ ] : Intallation directory. The plugins will go in <DIR>/libexec and the language files in <DIR>/share/locale/...
+ --with-basetmpdir=<DIR> [default=/tmp] : + Where the plugins will put temporary files if needed. + Not all the plugins will store temporary files.
+ --with-cachedir=<DIR> [default=[basetmpdir]/cache] + Where the plugins will put cache files with snmp index

+

Then run :
+ make

+

Then, as root :
+ make install

+

To create the basetmpdir and cachedir if they don't exist, you can run :
+ make install-tmp
+ or create the two directories by hand with nagios user as owner or 777 mode.

+

That's all !

+

Details on the caching option

+

With the new C plugins, you can cache SNMP index queries.

+

Each time you run a script, it gets all the index table of what you are looking for (interface, storage, etc...).

+

This can be really big requests for example if you have a core LAN switch with 80 interfaces. + As the interface index don't change very often, I added a caching of these queries so the only thing the script does to select an interface is read the cache file on disk.
+ Also, if you have more than one service on this host, every script (checking the same type of data) will be able to read this file.

+

All you have to do is put the '-K' option, with the default time validity of the cache file in minutes. The default time to live is 15 minutes, meaning that the index will be read every 15 minutes only.

+

If you have several services doing the same types of checks on the same host, the index will still be read once only within these 15 minutes.

+

 

+ +

This project is hosted on :
+ + SourceForge.net Logo + +

+ +

Nagios and the Nagios logo are registered + + trademarks of Ethan Galstad.

+ +
+ +
+ +

 

+ + + + + + + diff --git a/doc/html/nagios.manubulon.com/robots.txt b/doc/html/nagios.manubulon.com/robots.txt new file mode 100644 index 0000000..7d329b1 --- /dev/null +++ b/doc/html/nagios.manubulon.com/robots.txt @@ -0,0 +1 @@ +User-agent: * diff --git a/doc/snmp_cpfw.html b/doc/html/nagios.manubulon.com/snmp_cpfw.html old mode 100755 new mode 100644 similarity index 95% rename from doc/snmp_cpfw.html rename to doc/html/nagios.manubulon.com/snmp_cpfw.html index ac84d46..e46ddd2 --- a/doc/snmp_cpfw.html +++ b/doc/html/nagios.manubulon.com/snmp_cpfw.html @@ -1,471 +1,471 @@ - - - - - - -Nagios plugins - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Home

- -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Snmp Checkpoint FW-1 check
- -

Script : check_snmp_cpfw.pl

- -

Last update : April 19 2007

- -
- -

Description :

- -

Checks by snmp v1, v2c or v3 some modules of - Checkpoint FW-1 filtering or management module :

- -

You can choose to check 1, 2, 3 or all 4 modules. - - Each module will be checked independently and critical state will - - be returned if one of them is not OK.

- -

- Firewall (on filtering firewall) :

- -

Checks policy state : must be installed
- - Can check installed policy name : you mut provide the exact name - - of the policy (-p = <policy name>)
- - Can check connections : warning and maximum levels must be provided - - ( -c=<warn>,<crit>)

- -

- SVN

- -

Checks the svan status code (must be "OK") - - of SVN

- -

- Management

- -

Checks the management state ("active") - - and if management is alive.

- -

- High availability

- -

Checks the HA state :
- - "active" on IPSO & master on SPLAT (default)
- - "standby" on SPLAT
- Use check_snmp_vrrp.pl for checks on active/standby or IPSO clusters - on IPSO
- Check the blocking state ("OK")
- Checks the state of all HA softs, usually : Synchronization,Filter, - cphad and fwd.

-

SNMP Login
-

-

See snmp info page

- -

Requirements :

- -

- On the Checkpoint Firewall : SNMP extentions - - must be active

- -

- Perl in /usr/bin/perl - or just run 'perl - - script'
- - - Net::SNMP
- - - file 'utils.pm' in plugin diretory (/usr/local/nagios/libexec)

- -

Configurations - - examples
- -

- -

Dowload - lastest version : 1.2.1

- -

Changelog - : On CVS repository on sourceforge : http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/.

- -

Examples :

- -


- - All examples below are considering the script is local directory. - - Host to be checked is 127.0.0.1 with snmp community "public".

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -

Get help - -

- -

./check_snmp_cpfw.pl -h

- -
snmpv3 login./check_snmp_cpfw.pl -H 127.0.0.1 - - -l login -x passwd .....
- -

Check firewall / HA / SVN - for a HA filtering module - - -

- -

./check_snmp_cpfw.pl -H 127.0.0.1 -C public -swa

- -
- -

Result example : - -

- -

FW : OK / SVN : OK / HA : OK / CPFW Status : OK

- -
- -

Check SVN/Mgmt - for a management - - -

- -

./check_snmp_cpfw.pl -H 127.0.0.1 -C public -sm

- -
- -
Result example :
- -
SVN : OK / MGMT : OK / CPFW - - Status : OK
Check policy - - name ./check_snmp_cpfw.pl -H 127.0.0.1 - - -C public -w -p prod
- -

Result example :

- -
FW : OK / CPFW Status : OK
- -
Same with another policy installed :
- -
FW : Policy installed : Standard - - / CPFW Status : CRITICAL
Check number - - of active connection with performance data output./check_snmp_cpfw.pl -H 127.0.0.1 - - -C public -w -c 1000,5000 -f
- -
Result example :
- -
FW : OK / CPFW Status : OK - - | fw_connexions=340
- -

 

- -

Output of check_snmp_cpfw.pl -h

- - - - - - - - - -
-

SNMP Checkpoint FW-1 Monitor for Nagios - version 1.2.1
- GPL Licence, (c)2004-2007 - Patrick Proy -

Usage: ./check_snmp_cpfw.pl [-v] -H <host> -C <snmp_community> - [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>]) - [-s] [-w [-p=pol_name] [-c=warn,crit]] [-m] [-a [standby] - ] [-f] [-p <port>] [-t <timeout>] [-V]
- -v, --verbose
- print extra debugging information (including interface list - on the system)
- -h, --help
- print this help message
- -H, --hostname=HOST
- name or IP address of host to check
- -C, --community=COMMUNITY NAME
- community name for the host's SNMP agent (implies v1 protocol)
- 2, --v2c
- Use snmp v2c
- -l, --login=LOGIN ; -x, --passwd=PASSWD
- Login and auth password for snmpv3 authentication
- If no priv password exists, implies AuthNoPriv
- -X, --privpass=PASSWD
- Priv password for snmpv3 (AuthPriv protocol)
- -L, --protocols=<authproto>,<privproto>
- <authproto> : Authentication protocol (md5|sha : default - md5)
- <privproto> : Priv protocole (des|aes : default des) -
- -s, --svn
- check for svn status
- -w, --fw
- check for fw status
- -a, --ha[=standby]
- check for ha status and node in "active" state
- If using SecurePlatform and monitoring a standby unit, put - "standby" too
- -m, --mgmt
- check for management status
- -p, --policy=POLICY_NAME
- check if installed policy is POLICY_NAME (must have -w)
- -c, --connexions=WARN,CRIT
- check warn and critical number of connexions (must have -w)
- -f, --perfparse
- perfparse output (only works with -c)
- -P, --port=PORT
- SNMP port (Default 161)
- -t, --timeout=INTEGER
- timeout for SNMP (Default: Nagios default)
- -V, --version
- prints version number
-

-
- -
- -

This project is hosted on :
- - SourceForge.net Logo - -

- -

Nagios and the Nagios logo are registered - - trademarks of Ethan Galstad.

- -
- -
- - - - - - - - - - - + + + + + + +Nagios plugins + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Home

+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Snmp Checkpoint FW-1 check
+ +

Script : check_snmp_cpfw.pl

+ +

Last update : April 19 2007

+ +
+ +

Description :

+ +

Checks by snmp v1, v2c or v3 some modules of + Checkpoint FW-1 filtering or management module :

+ +

You can choose to check 1, 2, 3 or all 4 modules. + + Each module will be checked independently and critical state will + + be returned if one of them is not OK.

+ +

- Firewall (on filtering firewall) :

+ +

Checks policy state : must be installed
+ + Can check installed policy name : you mut provide the exact name + + of the policy (-p = <policy name>)
+ + Can check connections : warning and maximum levels must be provided + + ( -c=<warn>,<crit>)

+ +

- SVN

+ +

Checks the svan status code (must be "OK") + + of SVN

+ +

- Management

+ +

Checks the management state ("active") + + and if management is alive.

+ +

- High availability

+ +

Checks the HA state :
+ - "active" on IPSO & master on SPLAT (default)
+ - "standby" on SPLAT
+ Use check_snmp_vrrp.pl for checks on active/standby or IPSO clusters + on IPSO
+ Check the blocking state ("OK")
+ Checks the state of all HA softs, usually : Synchronization,Filter, + cphad and fwd.

+

SNMP Login
+

+

See snmp info page

+ +

Requirements :

+ +

- On the Checkpoint Firewall : SNMP extentions + + must be active

+ +

- Perl in /usr/bin/perl - or just run 'perl + + script'
+ + - Net::SNMP
+ + - file 'utils.pm' in plugin diretory (/usr/local/nagios/libexec)

+ +

Configurations + + examples
+ +

+ +

Dowload + lastest version : 1.2.1

+ +

Changelog + : On CVS repository on sourceforge : http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/.

+ +

Examples :

+ +


+ + All examples below are considering the script is local directory. + + Host to be checked is 127.0.0.1 with snmp community "public".

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

Get help + +

+ +

./check_snmp_cpfw.pl -h

+ +
snmpv3 login./check_snmp_cpfw.pl -H 127.0.0.1 + + -l login -x passwd .....
+ +

Check firewall / HA / SVN - for a HA filtering module - + +

+ +

./check_snmp_cpfw.pl -H 127.0.0.1 -C public -swa

+ +
+ +

Result example : + +

+ +

FW : OK / SVN : OK / HA : OK / CPFW Status : OK

+ +
+ +

Check SVN/Mgmt - for a management - + +

+ +

./check_snmp_cpfw.pl -H 127.0.0.1 -C public -sm

+ +
+ +
Result example :
+ +
SVN : OK / MGMT : OK / CPFW + + Status : OK
Check policy + + name ./check_snmp_cpfw.pl -H 127.0.0.1 + + -C public -w -p prod
+ +

Result example :

+ +
FW : OK / CPFW Status : OK
+ +
Same with another policy installed :
+ +
FW : Policy installed : Standard + + / CPFW Status : CRITICAL
Check number + + of active connection with performance data output./check_snmp_cpfw.pl -H 127.0.0.1 + + -C public -w -c 1000,5000 -f
+ +
Result example :
+ +
FW : OK / CPFW Status : OK + + | fw_connexions=340
+ +

 

+ +

Output of check_snmp_cpfw.pl -h

+ + + + + + + + + +
+

SNMP Checkpoint FW-1 Monitor for Nagios + version 1.2.1
+ GPL Licence, (c)2004-2007 - Patrick Proy +

Usage: ./check_snmp_cpfw.pl [-v] -H <host> -C <snmp_community> + [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>]) + [-s] [-w [-p=pol_name] [-c=warn,crit]] [-m] [-a [standby] + ] [-f] [-p <port>] [-t <timeout>] [-V]
+ -v, --verbose
+ print extra debugging information (including interface list + on the system)
+ -h, --help
+ print this help message
+ -H, --hostname=HOST
+ name or IP address of host to check
+ -C, --community=COMMUNITY NAME
+ community name for the host's SNMP agent (implies v1 protocol)
+ 2, --v2c
+ Use snmp v2c
+ -l, --login=LOGIN ; -x, --passwd=PASSWD
+ Login and auth password for snmpv3 authentication
+ If no priv password exists, implies AuthNoPriv
+ -X, --privpass=PASSWD
+ Priv password for snmpv3 (AuthPriv protocol)
+ -L, --protocols=<authproto>,<privproto>
+ <authproto> : Authentication protocol (md5|sha : default + md5)
+ <privproto> : Priv protocole (des|aes : default des) +
+ -s, --svn
+ check for svn status
+ -w, --fw
+ check for fw status
+ -a, --ha[=standby]
+ check for ha status and node in "active" state
+ If using SecurePlatform and monitoring a standby unit, put + "standby" too
+ -m, --mgmt
+ check for management status
+ -p, --policy=POLICY_NAME
+ check if installed policy is POLICY_NAME (must have -w)
+ -c, --connexions=WARN,CRIT
+ check warn and critical number of connexions (must have -w)
+ -f, --perfparse
+ perfparse output (only works with -c)
+ -P, --port=PORT
+ SNMP port (Default 161)
+ -t, --timeout=INTEGER
+ timeout for SNMP (Default: Nagios default)
+ -V, --version
+ prints version number
+

+
+ +
+ +

This project is hosted on :
+ + SourceForge.net Logo + +

+ +

Nagios and the Nagios logo are registered + + trademarks of Ethan Galstad.

+ +
+ +
+ + + + + + + + + + + diff --git a/doc/snmp_css.html b/doc/html/nagios.manubulon.com/snmp_css.html old mode 100755 new mode 100644 similarity index 96% rename from doc/snmp_css.html rename to doc/html/nagios.manubulon.com/snmp_css.html index 84fe3f4..61b341f --- a/doc/snmp_css.html +++ b/doc/html/nagios.manubulon.com/snmp_css.html @@ -1,381 +1,381 @@ - - - - -Nagios plugins - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Home

- -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Snmp CSS check
- -

Script : check_snmp_css.pl / check_snmp_css_main.pl

- -

Last update : Jan 22 2007

- -
- -

Description :

- -

Checks by snmp v1, v2c or v3 CSS services state

-

SNMP Login
- -

- -

See snmp info page

- -

Requirements :

- -

- Perl in /usr/bin/perl - or just run 'perl - script'
- - Net::SNMP
- - file 'utils.pm' in plugin diretory (/usr/local/nagios/libexec)
-

-

Checks

-

This scripts checks status of the CSS services.

-

Select service(s)
- You select services you wan't to check with -n using regular expressions

-

Put thresholds
- You select the warning and critical levels for : <num>,<resp>,<conn> -
- num : minimum number of active & alive service
- resp : average response time in ms
- conn : number of connexions

-

You can choose not to put 1, 2 or 3 numbers. -
- If you set "-w 3" only the number of active services will - be checked.
- If you set "-w 3,200" only the number of active services - and response time will be checked.
-
- For no warnings, put -1 (ex : -w5,-1,3).
- When using negative numbers, dont put space after "-w" - : "-w -1,100,6" will not work, "-w-1,100,6" - will work.

-

-d option and check_snmp_css_main.pl

-

This option is set to make the script read - the index from a file instead of on the CSS.

-

The reason of this option is :
- - when you have a lot (> 50) services on the CSS
- - you want to check 10 service group consisting of 5 services every - 2 minutes.

-

If you use check_snmp_css, then it will read - the index (50 oids) + checks 5 oids = 55 OID every 12 seconds in - average. This will heavily load the CSS.
- This is why I wrote check_snmp_css_main.pl. This script will get - the index of the CSS every 10 minutes for example (could be more) - as the index won't change often.
- Then the check_snmp_css will only have to check for the 5 oids every - 12 seconds, which will reduce by about 10 the amount of snmp queries - !

-

How to use it :

-

Create a service with long inter-delay check - executing :

-

check_snmp_css_main.pl -H <host> <snmp - logins> -2 -d /var/tmp
- -2 if for using snmpv2c (better to get a lot of data)
- -d /var/tmp is to put the temp file to a special directory - (default is /tmp).

-

A file named : Nagios_CSS_<IP Address> - will be created

-

Then you can use your check_snmp_css.pl script - just as before but adding the '-d' option with the temp directory - if not /tmp.

-

If the Nagios_CSS_<IP> file is not created - when the check_snmp_css script runs, it will then return unknown - status.
- If the check_snmp_css_main.pl cannot read index, a warning will - be returned but the old index file will remain.

-

A lockfile is created bye check_snmp_css_main.pl - when it writes it's file. The check_snmp_css script will wait until - the lock file is removed to read the index file.
- The lock file is named : Nagios_CSS_<IP Address>.lock
-
The lock file format is simple: every line is in format -
- <OID>:<Service name>

-

 

-

Dowload - lastest version of check_snmp_css.pl : 1.0

-

Dowload - lastest version of check_snmp_css_main.pl : 1.0

- -

Configurations - - examples

- -

Changelog - : On CVS repository on sourceforge : http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/.

- -

Examples :

- -


- - All examples below are considering the script is local directory. - - Host to be checked is 127.0.0.1 with snmp community "public".

- - - - - - - - - - - - - - -
-

Get help -

-

./check_snmp_css.pl -h

-
Verbose output./check_snmp_css.pl -H <IP> - -C <com> -v
snmpv3 login./check_snmp_css.pl -H 127.0.0.1 - -l login -x passwd
- -

Output of check_snmp_css.pl -h

- - - - - - - - -
-
- SNMP Cisco CSS monitor for Nagios version 1.0
-(c)2004-2006 Patrick Proy
-
-Usage: ./check_snmp_css.pl [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>]) 
-       -n <name> [-d directory] [-w <num>,<resp>,<conn> -c <num>,<resp>,<conn>]  [-p <port>] [-f] [-t <timeout>] [-V]
--v, --verbose
-   print extra debugging information 
--h, --help
-   print this help message
--H, --hostname=HOST
-   name or IP address of host to check
--n, --name=<name> 
-   regexp to select service
--w, --warning=<num>,<resp>,<conn> 
-   Optional. Warning level for
-   - minimum number of active & alive service 
-   - average response time
-   - number of connexions
-   For no warnings, put -1 (ex : -w5,-1,3).
-   When using negative numbers, dont put space after "-w"
--d, --dir=<directory to put file> 
-   Directory where the temp file with index, created by check_snmp_css_main.pl, can be found
-   If no directory is set, /tmp will be used
--c, --critical=<num>,resp>,<conn>
-   Optional. Critical levels (-1 for no critical levels)
-   See warning levels.
--C, --community=COMMUNITY NAME
-   community name for the host's SNMP agent (implies v1 protocol)
--2, --v2c
-   Use snmp v2c
--l, --login=LOGIN ; -x, --passwd=PASSWD
-   Login and auth password for snmpv3 authentication 
-   If no priv password exists, implies AuthNoPriv 
--X, --privpass=PASSWD
-   Priv password for snmpv3 (AuthPriv protocol)
--L, --protocols=<authproto>,<privproto>
-   <authproto> : Authentication protocol (md5|sha : default md5)
-   <privproto> : Priv protocole (des|aes : default des) 
--P, --port=PORT
-   SNMP port (Default 161)
--f, --perfparse
-   Perfparse compatible output
--t, --timeout=INTEGER
-   timeout for SNMP in seconds (Default: 5)
--V, --version
-   prints version number
-
-
- -
-

Output of check_snmp_css_main.pl -h

- - - - -
-
- SNMP Cisco CSS monitor MAIN script for Nagios version 1.0
-GPL Licence, (c)2004-2006 Patrick Proy
-
-Usage: ./check_snmp_css_main.pl [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>]) 
-       [-d directory] [-p <port>] [-t <timeout>] [-V]
--v, --verbose
-   print extra debugging information 
--h, --help
-   print this help message
--H, --hostname=HOST
-   name or IP address of host to check
--d, --dir=<directory to put file> 
-   Directory where temp file with index is written
--C, --community=COMMUNITY NAME
-   community name for the host's SNMP agent (implies v1 protocol)
--2, --v2c
-   Use snmp v2c
--l, --login=LOGIN ; -x, --passwd=PASSWD
-   Login and auth password for snmpv3 authentication 
-   If no priv password exists, implies AuthNoPriv 
--X, --privpass=PASSWD
-   Priv password for snmpv3 (AuthPriv protocol)
--L, --protocols=<authproto>,<privproto>
-   <authproto> : Authentication protocol (md5|sha : default md5)
-   <privproto> : Priv protocole (des|aes : default des) 
--P, --port=PORT
-   SNMP port (Default 161)
--t, --timeout=INTEGER
-   timeout for SNMP in seconds (Default: 5)
--V, --version
-   prints version number
-
-
-
- -

This project is hosted on :
- - SourceForge.net Logo - -

- -

Nagios and the Nagios logo are registered - - trademarks of Ethan Galstad.

- -
- -
- - - - - - - + + + + +Nagios plugins + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Home

+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Snmp CSS check
+ +

Script : check_snmp_css.pl / check_snmp_css_main.pl

+ +

Last update : Jan 22 2007

+ +
+ +

Description :

+ +

Checks by snmp v1, v2c or v3 CSS services state

+

SNMP Login
+ +

+ +

See snmp info page

+ +

Requirements :

+ +

- Perl in /usr/bin/perl - or just run 'perl + script'
+ - Net::SNMP
+ - file 'utils.pm' in plugin diretory (/usr/local/nagios/libexec)
+

+

Checks

+

This scripts checks status of the CSS services.

+

Select service(s)
+ You select services you wan't to check with -n using regular expressions

+

Put thresholds
+ You select the warning and critical levels for : <num>,<resp>,<conn> +
+ num : minimum number of active & alive service
+ resp : average response time in ms
+ conn : number of connexions

+

You can choose not to put 1, 2 or 3 numbers. +
+ If you set "-w 3" only the number of active services will + be checked.
+ If you set "-w 3,200" only the number of active services + and response time will be checked.
+
+ For no warnings, put -1 (ex : -w5,-1,3).
+ When using negative numbers, dont put space after "-w" + : "-w -1,100,6" will not work, "-w-1,100,6" + will work.

+

-d option and check_snmp_css_main.pl

+

This option is set to make the script read + the index from a file instead of on the CSS.

+

The reason of this option is :
+ - when you have a lot (> 50) services on the CSS
+ - you want to check 10 service group consisting of 5 services every + 2 minutes.

+

If you use check_snmp_css, then it will read + the index (50 oids) + checks 5 oids = 55 OID every 12 seconds in + average. This will heavily load the CSS.
+ This is why I wrote check_snmp_css_main.pl. This script will get + the index of the CSS every 10 minutes for example (could be more) + as the index won't change often.
+ Then the check_snmp_css will only have to check for the 5 oids every + 12 seconds, which will reduce by about 10 the amount of snmp queries + !

+

How to use it :

+

Create a service with long inter-delay check + executing :

+

check_snmp_css_main.pl -H <host> <snmp + logins> -2 -d /var/tmp
+ -2 if for using snmpv2c (better to get a lot of data)
+ -d /var/tmp is to put the temp file to a special directory + (default is /tmp).

+

A file named : Nagios_CSS_<IP Address> + will be created

+

Then you can use your check_snmp_css.pl script + just as before but adding the '-d' option with the temp directory + if not /tmp.

+

If the Nagios_CSS_<IP> file is not created + when the check_snmp_css script runs, it will then return unknown + status.
+ If the check_snmp_css_main.pl cannot read index, a warning will + be returned but the old index file will remain.

+

A lockfile is created bye check_snmp_css_main.pl + when it writes it's file. The check_snmp_css script will wait until + the lock file is removed to read the index file.
+ The lock file is named : Nagios_CSS_<IP Address>.lock
+
The lock file format is simple: every line is in format +
+ <OID>:<Service name>

+

 

+

Dowload + lastest version of check_snmp_css.pl : 1.0

+

Dowload + lastest version of check_snmp_css_main.pl : 1.0

+ +

Configurations + + examples

+ +

Changelog + : On CVS repository on sourceforge : http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/.

+ +

Examples :

+ +


+ + All examples below are considering the script is local directory. + + Host to be checked is 127.0.0.1 with snmp community "public".

+ + + + + + + + + + + + + + +
+

Get help +

+

./check_snmp_css.pl -h

+
Verbose output./check_snmp_css.pl -H <IP> + -C <com> -v
snmpv3 login./check_snmp_css.pl -H 127.0.0.1 + -l login -x passwd
+ +

Output of check_snmp_css.pl -h

+ + + + + + + + +
+
+ SNMP Cisco CSS monitor for Nagios version 1.0
+(c)2004-2006 Patrick Proy
+
+Usage: ./check_snmp_css.pl [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>]) 
+       -n <name> [-d directory] [-w <num>,<resp>,<conn> -c <num>,<resp>,<conn>]  [-p <port>] [-f] [-t <timeout>] [-V]
+-v, --verbose
+   print extra debugging information 
+-h, --help
+   print this help message
+-H, --hostname=HOST
+   name or IP address of host to check
+-n, --name=<name> 
+   regexp to select service
+-w, --warning=<num>,<resp>,<conn> 
+   Optional. Warning level for
+   - minimum number of active & alive service 
+   - average response time
+   - number of connexions
+   For no warnings, put -1 (ex : -w5,-1,3).
+   When using negative numbers, dont put space after "-w"
+-d, --dir=<directory to put file> 
+   Directory where the temp file with index, created by check_snmp_css_main.pl, can be found
+   If no directory is set, /tmp will be used
+-c, --critical=<num>,resp>,<conn>
+   Optional. Critical levels (-1 for no critical levels)
+   See warning levels.
+-C, --community=COMMUNITY NAME
+   community name for the host's SNMP agent (implies v1 protocol)
+-2, --v2c
+   Use snmp v2c
+-l, --login=LOGIN ; -x, --passwd=PASSWD
+   Login and auth password for snmpv3 authentication 
+   If no priv password exists, implies AuthNoPriv 
+-X, --privpass=PASSWD
+   Priv password for snmpv3 (AuthPriv protocol)
+-L, --protocols=<authproto>,<privproto>
+   <authproto> : Authentication protocol (md5|sha : default md5)
+   <privproto> : Priv protocole (des|aes : default des) 
+-P, --port=PORT
+   SNMP port (Default 161)
+-f, --perfparse
+   Perfparse compatible output
+-t, --timeout=INTEGER
+   timeout for SNMP in seconds (Default: 5)
+-V, --version
+   prints version number
+
+
+ +
+

Output of check_snmp_css_main.pl -h

+ + + + +
+
+ SNMP Cisco CSS monitor MAIN script for Nagios version 1.0
+GPL Licence, (c)2004-2006 Patrick Proy
+
+Usage: ./check_snmp_css_main.pl [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>]) 
+       [-d directory] [-p <port>] [-t <timeout>] [-V]
+-v, --verbose
+   print extra debugging information 
+-h, --help
+   print this help message
+-H, --hostname=HOST
+   name or IP address of host to check
+-d, --dir=<directory to put file> 
+   Directory where temp file with index is written
+-C, --community=COMMUNITY NAME
+   community name for the host's SNMP agent (implies v1 protocol)
+-2, --v2c
+   Use snmp v2c
+-l, --login=LOGIN ; -x, --passwd=PASSWD
+   Login and auth password for snmpv3 authentication 
+   If no priv password exists, implies AuthNoPriv 
+-X, --privpass=PASSWD
+   Priv password for snmpv3 (AuthPriv protocol)
+-L, --protocols=<authproto>,<privproto>
+   <authproto> : Authentication protocol (md5|sha : default md5)
+   <privproto> : Priv protocole (des|aes : default des) 
+-P, --port=PORT
+   SNMP port (Default 161)
+-t, --timeout=INTEGER
+   timeout for SNMP in seconds (Default: 5)
+-V, --version
+   prints version number
+
+
+
+ +

This project is hosted on :
+ + SourceForge.net Logo + +

+ +

Nagios and the Nagios logo are registered + + trademarks of Ethan Galstad.

+ +
+ +
+ + + + + + + diff --git a/doc/snmp_env.html b/doc/html/nagios.manubulon.com/snmp_env.html old mode 100755 new mode 100644 similarity index 96% rename from doc/snmp_env.html rename to doc/html/nagios.manubulon.com/snmp_env.html index f847bd9..fdd4e18 --- a/doc/snmp_env.html +++ b/doc/html/nagios.manubulon.com/snmp_env.html @@ -1,370 +1,370 @@ - - - - -Nagios plugins - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Home

- -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Snmp env check
- -

Script : check_snmp_env.pl

- -

Last update : April 19 2007

- -
- -

Description :

- -

Checks by snmp v1, v2c or v3 environemental - parameters such as fan, power supply, temperature

-

SNMP Login
- -

- -

See snmp info page

- -

Requirements :

- -

- Perl in /usr/bin/perl - or just run 'perl - script'
- - Net::SNMP
- - file 'utils.pm' in plugin diretory (/usr/local/nagios/libexec)
-

-

Checks

-

The script will make the following checks depending - on host type.
- Either the threshold is directly set by the hardware manufacturer, - or you must set them with an option.

-

This table shows what the script CAN check, - depending on hardware version the sensors might not be there.
- The script will return "UNKNOWN" if no sensors can be - found.

-

If no option is specified in this table, it - means the script uses the threshold of the snmp table.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Host typeOptionPower supplyFanVoltageTemperatureDisks
CiscociscoYesYesNo (working on it)No (working on it)No
Nokia IpsonokiaYesYesNo.YesNo
BluecoatbcYesYesYesYesYes
IronPortironYesYes, option '-F' in RPMNoYes, option '-c' in CelciusNo
FoundryFoundryYesNo (bug in snmp agent)NoYesNo
-

Note : Bluecoat provides an "other" - sensor which is tested also. But I never saw a Bluecoat reporting - it.

-

 

- -

Dowload - lastest version : 1.2

- -

Configurations - - examples

- -

Changelog - : On CVS repository on sourceforge : http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/.

- -

Examples :

- -


- - All examples below are considering the script is local directory. - - Host to be checked is 127.0.0.1 with snmp community "public".

- - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Get help -

-

./check_snmp_env.pl -h

-
Verbose output./check_snmp_env.pl -H <IP> - -C <com> -v
snmpv3 login./check_snmp_env.pl -H 127.0.0.1 - -l login -x passwd
-

Check Cisco for all sensors -

-

./check_snmp_env.pl -H 127.0.0.1 -C public - -T cisco

-
Check Nokia - for all sensors./check_snmp_env.pl -H 127.0.0.1 - -C public -T nokia
checks ironport - fans RPM > 1500 and temp < 70 deg celcius./check_snmp_env.pl -H 127.0.0.1 - -C public -T iron -F 1500 -c 70
- -

Output of check_snmp_env.pl -h

- - - - - - - - - -
-


- SNMP environmental Monitor for Nagios version 1.2
- GPL Licence, (c)2006-2007 Patrick Proy -

Usage: ./check_snmp_env.pl [-v] -H <host> -C <snmp_community> - [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>]) - [-p <port>] -T (cisco|nokia|bc|iron|foundry) [-F <rpm>] - [-c <celcius>] [-f] [-t <timeout>] [-V]
- -v, --verbose
- print extra debugging information
- -h, --help
- print this help message
- -H, --hostname=HOST
- name or IP address of host to check
- -C, --community=COMMUNITY NAME
- community name for the host's SNMP agent (implies v1 protocol)
- -2, --v2c
- Use snmp v2c
- -l, --login=LOGIN ; -x, --passwd=PASSWD
- Login and auth password for snmpv3 authentication
- If no priv password exists, implies AuthNoPriv
- -X, --privpass=PASSWD
- Priv password for snmpv3 (AuthPriv protocol)
- -L, --protocols=<authproto>,<privproto>
- <authproto> : Authentication protocol (md5|sha : default - md5)
- <privproto> : Priv protocole (des|aes : default des) -
- -P, --port=PORT
- SNMP port (Default 161)
- -T, --type=cisco|nokia|bc|iron|foundry
- Environemental check :
- cisco : voltage,temp,fan,power supply status
- will try to check everything present
- nokia : fan and power supply
- bc : fans, power supply, voltage, disks
- iron : fans, power supply, temp
- foundry : power supply, temp
- -F, --fan=<rpm>
- Minimum fan rpm value
- -c, --celcius=<celcius>
- Maximum temp in degree celcius
- -f, --perfparse
- Perfparse compatible output
- -t, --timeout=INTEGER
- timeout for SNMP in seconds (Default: 5)
- -V, --version
- prints version number
-

-
- -
- -

This project is hosted on :
- - SourceForge.net Logo - -

- -

Nagios and the Nagios logo are registered - - trademarks of Ethan Galstad.

- -
- -
- - - - - - - + + + + +Nagios plugins + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Home

+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Snmp env check
+ +

Script : check_snmp_env.pl

+ +

Last update : April 19 2007

+ +
+ +

Description :

+ +

Checks by snmp v1, v2c or v3 environemental + parameters such as fan, power supply, temperature

+

SNMP Login
+ +

+ +

See snmp info page

+ +

Requirements :

+ +

- Perl in /usr/bin/perl - or just run 'perl + script'
+ - Net::SNMP
+ - file 'utils.pm' in plugin diretory (/usr/local/nagios/libexec)
+

+

Checks

+

The script will make the following checks depending + on host type.
+ Either the threshold is directly set by the hardware manufacturer, + or you must set them with an option.

+

This table shows what the script CAN check, + depending on hardware version the sensors might not be there.
+ The script will return "UNKNOWN" if no sensors can be + found.

+

If no option is specified in this table, it + means the script uses the threshold of the snmp table.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Host typeOptionPower supplyFanVoltageTemperatureDisks
CiscociscoYesYesNo (working on it)No (working on it)No
Nokia IpsonokiaYesYesNo.YesNo
BluecoatbcYesYesYesYesYes
IronPortironYesYes, option '-F' in RPMNoYes, option '-c' in CelciusNo
FoundryFoundryYesNo (bug in snmp agent)NoYesNo
+

Note : Bluecoat provides an "other" + sensor which is tested also. But I never saw a Bluecoat reporting + it.

+

 

+ +

Dowload + lastest version : 1.2

+ +

Configurations + + examples

+ +

Changelog + : On CVS repository on sourceforge : http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/.

+ +

Examples :

+ +


+ + All examples below are considering the script is local directory. + + Host to be checked is 127.0.0.1 with snmp community "public".

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Get help +

+

./check_snmp_env.pl -h

+
Verbose output./check_snmp_env.pl -H <IP> + -C <com> -v
snmpv3 login./check_snmp_env.pl -H 127.0.0.1 + -l login -x passwd
+

Check Cisco for all sensors +

+

./check_snmp_env.pl -H 127.0.0.1 -C public + -T cisco

+
Check Nokia + for all sensors./check_snmp_env.pl -H 127.0.0.1 + -C public -T nokia
checks ironport + fans RPM > 1500 and temp < 70 deg celcius./check_snmp_env.pl -H 127.0.0.1 + -C public -T iron -F 1500 -c 70
+ +

Output of check_snmp_env.pl -h

+ + + + + + + + + +
+


+ SNMP environmental Monitor for Nagios version 1.2
+ GPL Licence, (c)2006-2007 Patrick Proy +

Usage: ./check_snmp_env.pl [-v] -H <host> -C <snmp_community> + [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>]) + [-p <port>] -T (cisco|nokia|bc|iron|foundry) [-F <rpm>] + [-c <celcius>] [-f] [-t <timeout>] [-V]
+ -v, --verbose
+ print extra debugging information
+ -h, --help
+ print this help message
+ -H, --hostname=HOST
+ name or IP address of host to check
+ -C, --community=COMMUNITY NAME
+ community name for the host's SNMP agent (implies v1 protocol)
+ -2, --v2c
+ Use snmp v2c
+ -l, --login=LOGIN ; -x, --passwd=PASSWD
+ Login and auth password for snmpv3 authentication
+ If no priv password exists, implies AuthNoPriv
+ -X, --privpass=PASSWD
+ Priv password for snmpv3 (AuthPriv protocol)
+ -L, --protocols=<authproto>,<privproto>
+ <authproto> : Authentication protocol (md5|sha : default + md5)
+ <privproto> : Priv protocole (des|aes : default des) +
+ -P, --port=PORT
+ SNMP port (Default 161)
+ -T, --type=cisco|nokia|bc|iron|foundry
+ Environemental check :
+ cisco : voltage,temp,fan,power supply status
+ will try to check everything present
+ nokia : fan and power supply
+ bc : fans, power supply, voltage, disks
+ iron : fans, power supply, temp
+ foundry : power supply, temp
+ -F, --fan=<rpm>
+ Minimum fan rpm value
+ -c, --celcius=<celcius>
+ Maximum temp in degree celcius
+ -f, --perfparse
+ Perfparse compatible output
+ -t, --timeout=INTEGER
+ timeout for SNMP in seconds (Default: 5)
+ -V, --version
+ prints version number
+

+
+ +
+ +

This project is hosted on :
+ + SourceForge.net Logo + +

+ +

Nagios and the Nagios logo are registered + + trademarks of Ethan Galstad.

+ +
+ +
+ + + + + + + diff --git a/doc/html/nagios.manubulon.com/snmp_int.html b/doc/html/nagios.manubulon.com/snmp_int.html new file mode 100644 index 0000000..7ed8579 --- /dev/null +++ b/doc/html/nagios.manubulon.com/snmp_int.html @@ -0,0 +1,717 @@ + + + + +Nagios plugins + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
This site :
Home
Nagios plugins
Info on snmp
Nagios config
FAQ
Project page on SourceForge
-----------
Links :
Nagios + + Home
Nagios + Plugins
Oreon project
NagiosExchange
Opsyx + forum
Forum 2037
-----------
Others :
+ + +
-----------
SourceForge.net Logo
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Snmp interface check
+ +

Script : check_snmp_int.pl

+ +

Last update : May 24 2007

+ +
+ +

Description :

+ +

Checks by snmp (v1, v2c or v3) host interface + + state and usage.
+ +
+ + Interfaces can be selected by regexp ( 'eth' will check eth0, eth1, + + eth2, ...).
+ + If multiple interfaces are selected, all must be up to get an OK + + result
+ +
+ +
Vérifie par snmp v1, v2c ou v3 l'état des interfaces + + d'un hôte, leur utilisation (bande passante, erreurs, pertes) + + et sortir des informations de performances.
+ + Ce script permet d'utiliser des expressions régulières + + pour sélectionner les interfaces : ex 'eth' va vérifier + + eth0, eth1, ...
+ + Il permet également de lister toutes les interfaces disponibles + + sur la machine cible (option -v) pour voir leur nom en SNMP.
+ + Pour les francophones, je ferais un manuel en Français + + quand j'aurais le temps... (et toute aide est bienvenue).
+ +

+ + Standard checks
+ +

+ +

The script will check interface operationnal + + status using the MIB-II table. The interface is (are) selected by + + the -n option.
+ + This option will be treated as a regular expression (eth will match + + eth0, eth1, eth2...). You can disable this with the -r option + + : the interface will be selected if it's description exactly matches + + the name given by -n

+ +

The interfaces are selected by their description + + in the MIB-II table.
+ To see how interface looks like by snmp, you can list all of + them with the '-v' switch.
+ +

+ +

The script will return OK if ALL interfaces + + selected are UP, or CRITICAL if at least one interface is down.
+ +
+ + You can make the script return a OK value when all interfaces are + + down (and CRITICAL when at least one is up) with the -i option.

+ +

You can make the same tests on administrative + + status instead with the -a option.

+

If you have ISDN interface, and want that DORMANT state returns ok, put -D.

+

To make output shorter, specially when you + + have multiple interface, you can put the -s option.
+ + It will get only the first <n> caracters of the interface + + descrition. If the number is negative then get the last <n> + + caracters.

+ +

Ex : EL20005 3Com Gigabit NIC (3C2000 Family)
+ + -s 4 will output : "EL20".
+ + -s -4 will output : "ily)".

+ +

Performance output

+ +

-f option : activate performance output + (default the In/out octet as a counter).
+ -e option : in/out errors and discarded packets. -f must + also be set.
+ -S option : Include speed in performance output in bits/s + as '<interface_name>_speed_bps'
+ -y option : output performance data in % of interface speed
+ -Y
option : output performance data in bits/s or Bytes/s (depending + on -B)

+

Note : -y and -Y options need the usage + check to ba active (-k)

+

Warning : the counters needed by -e + + are not always available on all machines (ex Nokia IP)
+ +

+ +

Usage check (-k) +
+
+
+ A temporary file will be created in "/tmp" by default + : this can be changed at the beginning of the script.
+ The file name will be : tmp_Nagios_int.<host IP>.<Interface + name>. One file will be created by interface.
+
+ The status UNKNOWN is returned when the script doesn't have enough + information (see -d option).
+
+ You will have to tell the warning and critical levels, separated + with "," and you can use decimal (ex : 10.3).
+ For standard checks (no "-q" option) :
+ -w <In warn>,<Out warn> -c <In warn>,<Out + warn>
+
In warn : warning level for incomming traffic
+ Out warn : warning level for outgoing traffic
+ In crit : critical level for incomming traffic
+ Out crit : critical level for outgoing traffic
+

+

The unit for the check depends on the -B, -M + and -G option :

+ + + + + + + + + + + + + + + + + + + + + +
  -B set-B not set
-M & -G not set +
Kbps
+
+
KBps
+
-M set +
Mbps
+
+
MBps
+
-G set +
Gbps
+
+
GBps
+
+

It is possible to put warning and critical + + levels with -b option.
+ + 0 means no warning or critical level checks

+ +

When the extended checks are activated (-q + option), the warning levels are
+ -w <In bytes>,<Out bytes>,<In error>,<Out + error>,<In disc>,<Out disc> -c + <In warn>,<Out warn>, .....
+ In error : warn/crit level in inboud error/minute
+
Out error : warn/crit level in outbound error/minute
+ In disc : warn/crit level in inboud discarded packets/minute
+
Out disc : warn/crit level in outbound discarded packets/minute +
+

+

-k : activates the standard usage feature
+ -q : activates the extended usage
+ -d : delta in seconds (default is 300s)
+ -w : warning levels
+ -c : critical levels
+

+

-d: delta time
+ + You can put the delta time as an option : the "delta" + + is the prefered time between two values that the script will use + + to calculate the average Kbytes/s or error/min. The delta time should + + (not must) be bigger than the check interval.
+ + Here is an example : Check interval of 2 minutes and delta of 4min

+ +

T0 : value 1 : can't calculate usage
+ + T0+2 : value 2 : can't calculate usage
+ + T0+4 : value 3 : usage=(value3-value1)/((T0+4)-T0)
+ + T0+6 : value 4 : usage=(value4-value2)/((T0+6)-T0+2)
+ + (Yes I know TO+4-T0=4, it's just to explain..)
+ + .........

+ +

The script will allow 10% less of the delta + + and 300% more than delta as a correct interval.
+ + For example, with a delta of 5 minutes, the acceptable interval + + will be between 4'30" and 15 minutes.

+ +

Msg size option (-o option)

+

In case you get a "ERROR: running table + : Message size exceeded maxMsgSize" error, you may need to + adjust the maxMsgSize, i.e. the maximum size of snmp message with + the -o option. Try a value with the -o AND the -v option : the script + will output the actual value so you can add some octets to it with + the -o option.

+

--label option

+

This option just put label before the speed + output :
+ Without : eth1:UP (10.3Kbps/4.4Kbps), eth0:UP (10.9Kbps/16.4Kbps):2 + UP: OK
+ With : eth1:UP (in=14.4Kbps/out=6.2Kbps), eth0:UP (in=15.3Kbps/out=22.9Kbps):2 + UP: OK
+

+

SNMP Login
+ +

+ +

See snmp info page

+ +

Requirements :

+ +

- Perl in /usr/bin/perl - or just run 'perl + + script'
+ + - Net::SNMP
+ + - file 'utils.pm' in plugin diretory (/usr/local/nagios/libexec)
+ +

+ +

Dowload + latest version : 1.4.8

+ +

Configuration + + examples

+ +

Examples :

+ +


+ + All examples below are considering the script is local directory. + + Host to be checked is 127.0.0.1 with snmp community "public".

+ +

If multiple interfaces are selected, all must + + be up to get an OK result

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

Get help + +

+ +

./check_snmp_int.pl -h

+ +
List all interfaces./check_snmp_int.pl -H 127.0.0.1 + + -C public -n zzzz -v
snmpv3 login./check_snmp_int.pl -H 127.0.0.1 + + -l login -w passwd
+ +

Check eth0 interface is up + +

+ +

./check_snmp_int.pl -H 127.0.0.1 -C public -n eth0 -r

+ +
+ +

Check that all eth interface are up + +

+ +

./check_snmp_int.pl -H 127.0.0.1 -C public -n eth

+ +
+ +

Check that all ppp interface are down + +

+ +

./check_snmp_int.pl -H 127.0.0.1 -C public -n ppp -i

+ +
+ +

Check that all eth interface are administratively up + +

+ +

./check_snmp_int.pl -H 127.0.0.1 -C public -n eth -a

+ +
+ +

Check that FastEternet0/11 to 0/14 are up (Cisco) + +

+ +

./check_snmp_int.pl -H 127.0.0.1 -C public -n "Fast.*0.1[1234]"

+ +
Check the eth0 + + usage
+ + Note : no critical inbound (0)
./check_snmp_int.pl -H 127.0.0.1 + + -C public -n eth0 -k -w 200,400 -c 0,600
+ +

Changelog + : On CVS repository on sourceforge : http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/.

+ +

Output of check_snmp_int.pl -h

+ + + + + + + + + +
+

SNMP Network Interface Monitor for Nagios version 1.4.8
+ GPL licence, (c)2004-2007 Patrick Proy

+

Usage: ./check_snmp_int.pl [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>) [-p <port>] -n <name in desc_oid> [-i -a -D] [-r] [-f[eSyY]] [-k[qBMGu] -g -w<warn levels> -c<crit levels> -d<delta>] [-o <octet_length>] [-t <timeout>] [-s] --label [-V]
+ -v, --verbose
+ print extra debugging information (including interface list on the system)
+ -h, --help
+ print this help message
+ -H, --hostname=HOST
+ name or IP address of host to check
+ -C, --community=COMMUNITY NAME
+ community name for the host's SNMP agent (implies v1 protocol)
+ -l, --login=LOGIN ; -x, --passwd=PASSWD, -2, --v2c
+ Login and auth password for snmpv3 authentication
+ If no priv password exists, implies AuthNoPriv
+ -2 : use snmp v2c
+ -X, --privpass=PASSWD
+ Priv password for snmpv3 (AuthPriv protocol)
+ -L, --protocols=<authproto>,<privproto>
+ <authproto> : Authentication protocol (md5|sha : default md5)
+ <privproto> : Priv protocole (des|aes : default des)
+ -P, --port=PORT
+ SNMP port (Default 161)
+ -n, --name=NAME
+ Name in description OID (eth0, ppp0 ...).
+ This is treated as a regexp : -n eth will match eth0,eth1,...
+ Test it before, because there are known bugs (ex : trailling /)
+ -r, --noregexp
+ Do not use regexp to match NAME in description OID
+ -i, --inverse
+ Make critical when up
+ -a, --admin
+ Use administrative status instead of operational
+ -D, --dormant
+ Dormant state is an OK state
+ -o, --octetlength=INTEGER
+ max-size of the SNMP message, usefull in case of Too Long responses.
+ Be carefull with network filters. Range 484 - 65535, default are
+ usually 1472,1452,1460 or 1440.
+ -f, --perfparse
+ Perfparse compatible output (no output when interface is down).
+ -e, --error
+ Add error & discard to Perfparse output
+ -S, --intspeed
+ Include speed in performance output in bits/s
+ -y, --perfprct ; -Y, --perfspeed
+ -y : output performance data in % of max speed
+ -Y : output performance data in bits/s or Bytes/s (depending on -B)
+ -k, --perfcheck ; -q, --extperfcheck
+ -k check the input/ouput bandwidth of the interface
+ -q also check the error and discard input/output
+ --label
+ Add label before speed in output : in=, out=, errors-out=, etc...
+ -g, --64bits
+ Use 64 bits counters instead of the standard counters when checking
+ bandwidth & performance data for interface >= 1Gbps.
+ You must use snmp v2c or v3 to get 64 bits counters.
+ -d, --delta=seconds
+ make an average of <delta> seconds (default 300=5min)
+ -B, --kbits
+ Make the warning and critical levels in K|M|G Bits/s instead of K|M|G Bytes/s
+ -G, --giga ; -M, --mega ; -u, --prct
+ -G : Make the warning and critical levels in Gbps (with -B) or GBps
+ -M : Make the warning and critical levels in Mbps (with -B) or MBps
+ -u : Make the warning and critical levels in % of reported interface speed.
+ -w, --warning=input,output[,error in,error out,discard in,discard out]
+ warning level for input / output bandwidth (0 for no warning)
+ unit depends on B,M,G,u options
+ warning for error & discard input / output in error/min (need -q)
+ -c, --critical=input,output[,error in,error out,discard in,discard out]
+ critical level for input / output bandwidth (0 for no critical)
+ unit depends on B,M,G,u options
+ critical for error & discard input / output in error/min (need -q)
+ -s, --short=int
+ Make the output shorter : only the first <n> chars of the interface(s)
+ If the number is negative, then get the <n> LAST caracters.
+ -t, --timeout=INTEGER
+ timeout for SNMP in seconds (Default: 5)
+ -V, --version
+ prints version number
+ Note : when multiple interface are selected with regexp,
+ all be must be up (or down with -i) to get an OK result.

+
+ +
+ +

This project is hosted on :
+ + SourceForge.net Logo + +

+ +

Nagios and the Nagios logo are registered + + trademarks of Ethan Galstad.

+ +
+ +
+ +

 

+ + + + + + + diff --git a/doc/html/nagios.manubulon.com/snmp_load.html b/doc/html/nagios.manubulon.com/snmp_load.html new file mode 100644 index 0000000..ce146aa --- /dev/null +++ b/doc/html/nagios.manubulon.com/snmp_load.html @@ -0,0 +1,409 @@ + + + + +Nagios plugins + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Home

+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Snmp load check
+ +

Script : check_snmp_load.pl

+ +

Last update : Sept 5 2006

+ +
+ +

Description :

+ +

Checks by snmp v1, v2c or v3 cpu or average + + load.
+ + Works on Windows, Linux/Unix, AS400, Cisco, Cisco catalyst, HP Procurve, LinkProof, + + Blucoat, Nokia, Fortinet, Netscreen.

+ +

Check types are selected by the -T option : + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
-T value
+
+
System
+
+
-w & -c values
+
netslLinux : load provided by Net SNMP3 values : load average on 1 min, 5 min, + 15 min (absolute)
netscLinux : CPU usage given by net-snmp1 value in %
as400as400 CPU usage1 value in %
ciscocisco CPU usage3 values : CPU average on 5sec, 1 min + & 5 min (%)
catacisco catalyst CPU usage3 values : CPU average on 5sec, 1 min + & 5 min (%)
nscNetscreen CPU usage3 values : CPU average on 5sec, 1 min + & 5 min (%)
fgFortigate CPU usage1 value in %
bcbluecoat CPU usage1 value in %
nokianokia CPU usage1 value in %
hpHP procurve switch CPU usage1 value in %
lpLinkproof CPU usage1 value in %
hpuxHP-UX load3 values : load average on 1 min, 5 min, + 15 min
+ +

Vérifie par snmp v1,v2c ou v3 la charge + + ou l'ocupation CPU.

+ +

SNMP Login
+ +

+ +

See snmp info page

+ +

Requirements :

+ +

- Perl in /usr/bin/perl - or just run 'perl + + script'
+ + - Net::SNMP
+ + - file 'utils.pm' in plugin diretory
+ +

+ +

Dowload + lastest version : 1.3.2

+ +

Configurations + + examples

+ +

Changelog + : On CVS repository on sourceforge : http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/.

+

Examples :

+ +


+ + All examples below are considering the script is local directory. + + Host to be checked is 127.0.0.1 with snmp community "public".

+ +

If multiple interfaces are selected, all must + + be up to get an OK result

+ + + + + + + + + + + + + + + + + + +
+

Get help +

+

./check_snmp_load.pl -h

+
+

Check loads on linux with Net-SNMP : checks the 1, 5 and + 15 minutes load average. +

+

./check_snmp_load.pl -H 127.0.0.1 -C public -w 3,3,2 -c + 4,4,3 -T netsl

+
+

Check cpu load (generic) : checks the %used CPU for the last + minute +

+

./check_snmp_load.pl -H 127.0.0.1 -C public -w 98% -c + 99%

+
+

Check cpu load on AS/400 +

+

./check_snmp_load.pl -H 127.0.0.1 -C public -w 98% -c + 99% -T as400

+
+ +

Output of check_snmp_load.pl -h

+ + + + + + + + + +
+SNMP Load & CPU Monitor for Nagios version 1.3
+ (c)2004-2006 Patrick Proy +

Usage: ./check_snmp_load.pl [-v] -H <host> -C <snmp_community> + [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>]) + [-p <port>] -w <warn level> -c <crit level> + -T=[stand|netsl|netsc|as400|cisco|cata|nsc|fg|bc|nokia|hp|lp] + [-f] [-t <timeout>] [-V]
+ -v, --verbose
+ print extra debugging information
+ -h, --help
+ print this help message
+ -H, --hostname=HOST
+ name or IP address of host to check
+ -C, --community=COMMUNITY NAME
+ community name for the host's SNMP agent (implies v1 protocol)
+ -2, --v2c
+ Use snmp v2c
+ -l, --login=LOGIN ; -x, --passwd=PASSWD
+ Login and auth password for snmpv3 authentication
+ If no priv password exists, implies AuthNoPriv
+ -X, --privpass=PASSWD
+ Priv password for snmpv3 (AuthPriv protocol)
+ -L, --protocols=<authproto>,<privproto>
+ <authproto> : Authentication protocol (md5|sha : default + md5)
+ <privproto> : Priv protocole (des|aes : default des) +
+ -P, --port=PORT
+ SNMP port (Default 161)
+ -w, --warn=INTEGER | INT,INT,INT
+ 1 value check : warning level for cpu in percent (on one minute)
+ 3 value check : comma separated level for load or cpu for + 1min, 5min, 15min
+ -c, --crit=INTEGER | INT,INT,INT
+ critical level for cpu in percent (on one minute)
+ 1 value check : critical level for cpu in percent (on one + minute)
+ 3 value check : comma separated level for load or cpu for + 1min, 5min, 15min
+ -T, --type=stand|netsl|netsc|as400|cisco|bc|nokia|hp|lp
+ CPU check :
+ stand : standard MIBII (works with Windows),
+ can handle multiple CPU.
+ netsl : linux load provided by Net SNMP
+ netsc : cpu usage given by net-snmp (100-idle)
+ as400 : as400 CPU usage
+ cisco : Cisco CPU usage
+ cata : Cisco catalyst CPU usage
+ nsc : NetScreen CPU usage
+ fg : Fortigate CPU usage
+ bc : Bluecoat CPU usage
+ nokia : Nokia CPU usage
+ hp : HP procurve switch CPU usage
+ lp : Linkproof CPU usage
+ -f, --perfparse
+ Perfparse compatible output
+ -t, --timeout=INTEGER
+ timeout for SNMP in seconds (Default: 5)
+ -V, --version
+ prints version number

+
+ +
+ +

This project is hosted on :
+ + SourceForge.net Logo + +

+ +

Nagios and the Nagios logo are registered + + trademarks of Ethan Galstad.

+ +
+ +
+ +

 

+ + + + + + + diff --git a/doc/html/nagios.manubulon.com/snmp_mem.html b/doc/html/nagios.manubulon.com/snmp_mem.html new file mode 100644 index 0000000..b8aa389 --- /dev/null +++ b/doc/html/nagios.manubulon.com/snmp_mem.html @@ -0,0 +1,485 @@ + + + + +Nagios plugins + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Home

+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Snmp memory check
+ +

Script : check_snmp_mem.pl

+ +

Last update : Sept 4 2006

+ +
+ +

Description :

+ +

Checks by snmp v1, v2c or v3 :

+ +

- Memory and swap usage on Linux given by Net-snmp. + +
+ + It checks memory and swap usage independantly : one warning and + + critical level for each of them.
+ +

+ +

- Memory usage on cisco routers or Pix : the + + plugin will add all of the memory pool and then checks the warning + + and critical levels.
+ + On cisco routeurs, it will add 'IO' and 'Processor' memory
+ + On Pix, it will check the memory used (one memory pool only on Pix).
+ +

+ +

- Memory usage on HP Procurve switch.
+ + Memory segments will be added then the free memory will be checked.
+ +

+ +

Vérification de :
+ + - l'utilisation mémoire et swap sur Linux/Net-snmp
+ + - l'utilisation mémoire sur Cisco (routeurs et Pix).
+ + Pour d'autres SE (Windows, AS400), lire la suite.

+ +

Checking memory for other os :

+ +

AS/400 : use the check_snmp_storage + + command to check the RAM

+ +

./check_snmp_storage.pl -H <IP> + + -C <community> -m RAM -s -w <warn%> -c + + <crit%>

+ +

Windows : use the check_snmp_storage + + command to check the virtual memory (RAM+Swap)

+ +

./check_snmp_storage.pl -H <IP> + + -C <community> -m "^Virtual Memory$" -w <warn%> + + -c <crit%>

+ +

SNMP Login
+ +

+ +

See snmp info page

+ +

Requirements :

+ +

- Perl in /usr/bin/perl - or just run 'perl + + script'
+ + - Net::SNMP
+ + - file 'utils.pm' in plugin diretory (/usr/local/nagios/libexec)
+ +

+ +

Dowload + + lastest version : 1.1

+ +

Configurations + + examples

+ +

Changelog + : On CVS repository on sourceforge : http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/.

+ +

Examples :

+ +


+ + All examples below are considering the script is local directory. + + Host to be checked is 127.0.0.1 with snmp community "public".

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

Get help + +

+ +

./check_snmp_mem.pl -h

+ +
Verbose output./check_snmp_mem.pl -H <IP> + + -C <com> -w 80 -c 81 -v
snmpv3 login./check_snmp_mem.pl -H 127.0.0.1 + + -l login -x passwd
+ +

  + +

+ +

Unix/Linux

+ +
+ +

%used of
+ + - RAM < 99% and 100%
+ + - Swap : < 20% and 30% + +

+ +

./check_snmp_mem.pl -H <IP> -C <com> -w 99,20 + + -c 100,30

+ +
+ +

Same with no warning levels for memory + +

+ +

./check_snmp_mem.pl -H <IP> -C <com> -w 0,20 + + -c 100,30

+ +
+ +

Check memory on Cisco + +

+ +

./check_snmp_mem.pl -H <IP> -C <com> -I -w + + 90% -c 98%

+ +
+ +

Output of check_snmp_mem.pl -h <

+ + + + + + + + + +
+ +

+ +

+
+SNMP Memory Monitor for Nagios version 1.1
+
+(c)2004-2006 - Patrick Proy
+
+
+
+Usage: ./check_snmp_mem.pl [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>])  [-p <port>] -w <warn level> -c <crit level> [-I|-N|-E] [-f] [-m] [-t <timeout>] [-V]
+
+-v, --verbose
+
+   print extra debugging information (including interface list on the system)
+
+-h, --help
+
+   print this help message
+
+-H, --hostname=HOST
+
+   name or IP address of host to check
+
+-C, --community=COMMUNITY NAME
+
+   community name for the host's SNMP agent (implies SNMP v1 or v2c with option)
+
+-2, --v2c
+
+   Use snmp v2c
+
+-l, --login=LOGIN ; -x, --passwd=PASSWD
+
+   Login and auth password for snmpv3 authentication 
+
+   If no priv password exists, implies AuthNoPriv 
+
+-X, --privpass=PASSWD
+
+   Priv password for snmpv3 (AuthPriv protocol)
+
+-L, --protocols=<authproto>,<privproto>
+
+   <authproto> : Authentication protocol (md5|sha : default md5)
+
+   <privproto> : Priv protocole (des|aes : default des) 
+
+-P, --port=PORT
+
+   SNMP port (Default 161)
+
+-w, --warn=INTEGER | INT,INT
+
+   warning level for memory in percent (0 for no checks) 
+
+     Default (-N switch) : comma separated level for Real Memory and Swap 
+
+     -I switch : warning level
+
+-c, --crit=INTEGER | INT,INT
+
+   critical level for memory in percent (0 for no checks)
+
+     Default (-N switch) : comma separated level for Real Memory and Swap 
+
+     -I switch : critical level
+
+-N, --netsnmp (default)
+
+   check linux memory & swap provided by Net SNMP 
+
+-m, --memcache
+
+   include cached memory in used memory (only with Net-SNMP)
+
+-I, --cisco
+
+   check cisco memory (sum of all memory pools)
+
+-E, --hp
+
+   check HP proccurve memory
+
+-f, --perfdata
+
+   Performance data output
+
+-t, --timeout=INTEGER
+
+   timeout for SNMP in seconds (Default: 5)
+
+-V, --version
+
+   prints version number
+
+
+ +
+ +
+ +

This project is hosted on :
+ + SourceForge.net Logo + +

+ +

Nagios and the Nagios logo are registered + + trademarks of Ethan Galstad.

+ +
+ +
+ + + + + + + diff --git a/doc/snmp_process.html b/doc/html/nagios.manubulon.com/snmp_process.html old mode 100755 new mode 100644 similarity index 84% rename from doc/snmp_process.html rename to doc/html/nagios.manubulon.com/snmp_process.html index 50c3735..12f2bef --- a/doc/snmp_process.html +++ b/doc/html/nagios.manubulon.com/snmp_process.html @@ -1,354 +1,377 @@ - - -Nagios plugins - - - - - - - - - -
- - - - - - - - - - - - - - -
Home

-
- -
- - - - - - - - - - - - - -
Snmp process check
-

Script : check_snmp_process.pl

-

Last update : March 12 2007

-
-

Description :

-

Checks by snmp v1 or v3 if a process is running - and how many instances are running (minimum & maximum).
- It is also possible to check memory and cpu used by one or a group - of process
-
- Works on Windows, Linux/Unix, AS400.

-

Vérifie par snmp v1 ou v3 si un process tourne - et combien d'instances de ce process tournent (minimum et maximum).
- Il est également possible de vérifier la mémoire - et le cpu utilisé.
-
- Standard checks
-

-

The plugin checks if there is at least one - process matching the filter (-n option) when no warning or - critical levels are set.
- The filter is treated as a regular expression by default, but you - can deactivate this (-r)

-

You can use -w and -c options to set the warning - and critical levels :
- -w <minW>,<maxW> : with minW and maxW the minimum - and maximum number of processes.
-
- -c <minC>,<maxC> : same thing
- Of course : minC <= minW < maxW <=maxC
-
- You can omit <maxW> and <maxC>

-
- Saying N is the current number of processes
- - N < minC : critical
- - minC < N <=minW : warning
- - minW< N <= maxW : OK
- - maxW< N <= maxC : warning
- - maxC < N : critical
-

-

Memory checks

-

The -m option can check the memory used - by the selected processes.
- By default, this will select the process wich use the maximum memory. - The -a switch will make an average
-
- Ex : -m 7,20 will send a warning if a process uses more than - 7 Mb, and critical for more than 20Mb.

-

CPU checks

-

When you use the -u option, a temporary - file will be created in "/tmp" by default : this can be - changed at the beginning of the script.
- The file name will be : tmp_Nagios_proc.<host IP>.<process - filter>.

-

The -u option will add all the cpu used by - all selected process and the make the check
-

-

-u 91,95 : will send a warning if more - than 91% of cpu is used, and critical if more than 95% is used.

-

On multiprocessor hosts, the % of cpu use can - be > 100% : on a 4 CPU host, cpu usage can go up to 400% (the - script doesn't check if a host is multiprocessor or not).

-

The script curently wants a minimum of 5 minutes - between values taken from host (can be changed at the beginning - of the scripts). You can check more than once every 5 minutes but - don't put check-interval to more than 15 minutes.
- When the script doesn't have enough data to compute the CPU use - (for example, the first time it is run), then it will return a UNKNOWN - status.

-

Msg size option (-o option)

-

In case you get a "ERROR: running table - : Message size exceeded maxMsgSize" error, you may need to - adjust the maxMsgSize, i.e. the maximum size of snmp message with - the -o option. Try a value with the -o AND the -v option : the script - will output the actual value so you can add some octets to it with - the -o option.

-

SNMP Login
-

-

See snmp info page

-

Requirements :

-

- Perl in /usr/bin/perl - or just run 'perl - script'
- - Net::SNMP
- - file 'utils.pm' in plugin diretory
-

-

Dowload - latest version : 1.4

-

Configurations - examples

-

Changelog - : On CVS repository on sourceforge : http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/.

-

Examples :

-


- All examples below are considering the script is local directory. - Host to be checked is 127.0.0.1 with snmp community "public".

-

If multiple interfaces are selected, all must - be up to get an OK result

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Get help -

-

./check_snmp_process.pl -h

-
snmpv3 login./check_snmp_process.pl -H - 127.0.0.1 -l login -x passwd
-

Check if at least one process matching http is running -

-

./check_snmp_process.pl -H 127.0.0.1 -C public -n http

-
-

Result example : -

-

3 process matching http : > 0 : OK

-
-

Check if at least 3 process matching http are running -

-

./check_snmp_process.pl -H 127.0.0.1 -C public -n http - -w 2 -c 0

-
-
Result example :
- (<=2 will return warning, 0 critical)
-
3 process matching httpd : - > 2 : OK
Check if at - least one process named "httpd" exists (no regexp)./check_snmp_process.pl -H - 127.0.0.1 -C public -n http -r
-

Result example :

-
3 process named httpd - : > 0 : OK
Check process - by their full path : check process of /opt/soft/bin/ (at least - one) ./check_snmp_process.pl -H - 127.0.0.1 -C public -n /opt/soft/bin/ -f
Check that at - least 3 process but not more than 8 are running./check_snmp_process.pl -H - 127.0.0.1 -C public -n http -w 3,8 -c 0,15
Same checks - + checks maximum memory used by process (in Mb) : warning and - critical levels./check_snmp_process.pl -H - 127.0.0.1 -C public -n http -w 3,8 -c 0,15 -m 9,25
Same check but - sum all CPU used by all selected process./check_snmp_process.pl -H - 127.0.0.1 -C public -n http -w 3,8 -c 0,15 -m 9,25 -u 70,99
-

Output of check_snmp_process.pl -h

- - - - -
-

SNMP Process Monitor for Nagios version 1.4
- GPL licence, (c)2004-2006 Patrick Proy

-

Usage: ./check_snmp_process.pl [-v] -H <host> -C <snmp_community> - [-2] | (-l login -x passwd) [-p <port>] -n <name> - [-w <min_proc>[,<max_proc>] -c <min_proc>[,max_proc] - ] [-m<warn Mb>,<crit Mb> -a -u<warn %>,<crit%> - ] [-t <timeout>] [-o <octet_length>] [-f ] [-r] - [-V] [-g]
- -v, --verbose
- print extra debugging information (and lists all storages)
- -h, --help
- print this help message
- -H, --hostname=HOST
- name or IP address of host to check
- -C, --community=COMMUNITY NAME
- community name for the host's SNMP agent (implies SNMP v1 - or v2c with option)
- -l, --login=LOGIN ; -x, --passwd=PASSWD, -2, --v2c
- Login and auth password for snmpv3 authentication
- If no priv password exists, implies AuthNoPriv
- -2 : use snmp v2c
- -X, --privpass=PASSWD
- Priv password for snmpv3 (AuthPriv protocol)
- -L, --protocols=<authproto>,<privproto>
- <authproto> : Authentication protocol (md5|sha : default - md5)
- <privproto> : Priv protocole (des|aes : default des) -
- -p, --port=PORT
- SNMP port (Default 161)
- -n, --name=NAME
- Name of the process (regexp)
- No trailing slash !
- -r, --noregexp
- Do not use regexp to match NAME in description OID
- -f, --fullpath
- Use full path name instead of process name
- (Windows doesn't provide full path name)
- -w, --warn=MIN[,MAX]
- Number of process that will cause a warning
- -1 for no warning, MAX must be >0. Ex : -w-1,50
- -c, --critical=MIN[,MAX]
- number of process that will cause an error (
- -1 for no critical, MAX must be >0. Ex : -c-1,50
- Notes on warning and critical :
- with the following options : -w m1,x1 -c m2,x2
- you must have : m2 <= m1 < x1 <= x2
- you can omit x1 or x2 or both
- -m, --memory=WARN,CRIT
- checks memory usage (default max of all process)
- values are warning and critical values in Mb
- -a, --average
- makes an average of memory used by process instead of max
- -u, --cpu=WARN,CRIT
- checks cpu usage of all process
- values are warning and critical values in % of CPU usage
- if more than one CPU, value can be > 100% : 100%=1 CPU
- -g, --getall
- In some cases, it is necessary to get all data at once because
- process die very frequently.
- This option eats bandwidth an cpu (for remote host) at breakfast.
- -o, --octetlength=INTEGER
- max-size of the SNMP message, usefull in case of Too Long - responses.
- Be carefull with network filters. Range 484 - 65535, default - are
- usually 1472,1452,1460 or 1440.
- -t, --timeout=INTEGER
- timeout for SNMP in seconds (Default: 5)
- -V, --version
- prints version number
- Note :
- CPU usage is in % of one cpu, so maximum can be 100% * number - of CPU
- example :
- Browse process list : <script> -C <community> - -H <host> -n <anything> -v
- the -n option allows regexp in perl format :
- All process of /opt/soft/bin : -n /opt/soft/bin/ -f
- All 'named' process : -n named
-

-
-
-

This project is hosted on :
- SourceForge.net Logo -

-

Nagios and the Nagios logo are registered - trademarks of Ethan Galstad.

-
-
-

 

- - - - - - - - - + + +Nagios plugins + + + + + + + + + +
+ + + + + + + + + + + + + + +
Home

+
+ +
+ + + + + + + + + + + + + +
Snmp process check
+

Script : check_snmp_process.pl

+

Last update : Jun 09 2007

+
+

Description :

+

Checks by snmp v1 or v3 if a process is running + and how many instances are running (minimum & maximum).
+ It is also possible to check memory and cpu used by one or a group + of process
+
+ Works on Windows, Linux/Unix, AS400.

+

Vérifie par snmp v1 ou v3 si un process tourne + et combien d'instances de ce process tournent (minimum et maximum).
+ Il est également possible de vérifier la mémoire + et le cpu utilisé.
+
+ Standard checks
+

+

The plugin checks if there is at least one + process matching the filter (-n option) when no warning or + critical levels are set.
+ The filter is treated as a regular expression by default, but you + can deactivate this (-r)

+

With the following options, you can add to your process selection :

+

-f : get full path of the script instead of only it's name

+

-A : add parameters with the script name

+ + + + + + + + + + + + + + + + + + + + + +
Optionhow the script will see the process
Nonenamed
-f/usr/sbin/named
-Anamed -u named -t /var/named/chroot
-f -A /usr/sbin/named -u named -t /var/named/chroot
+

Warning : the -f & -A option will not function properly for Windows hosts (the snmp agent don't give this information)

+

You can use -w and -c options to set the warning + and critical levels :
+ -w <minW>,<maxW> : with minW and maxW the minimum + and maximum number of processes.
+
+ -c <minC>,<maxC> : same thing
+ Of course : minC <= minW < maxW <=maxC
+
+ You can omit <maxW> and <maxC>

+
+ Saying N is the current number of processes
+ - N < minC : critical
+ - minC < N <=minW : warning
+ - minW< N <= maxW : OK
+ - maxW< N <= maxC : warning
+ - maxC < N : critical
+

+

Memory checks

+

The -m option can check the memory used + by the selected processes.
+ By default, this will select the process wich use the maximum memory. + The -a switch will make an average
+
+ Ex : -m 7,20 will send a warning if a process uses more than + 7 Mb, and critical for more than 20Mb.

+

CPU checks

+

When you use the -u option, a temporary + file will be created in "/tmp" by default : this can be + changed at the beginning of the script.
+ The file name will be : tmp_Nagios_proc.<host IP>.<process + filter>.

+

The -u option will add all the cpu used by + all selected process and the make the check
+

+

-u 91,95 : will send a warning if more + than 91% of cpu is used, and critical if more than 95% is used.

+

On multiprocessor hosts, the % of cpu use can + be > 100% : on a 4 CPU host, cpu usage can go up to 400% (the + script doesn't check if a host is multiprocessor or not).

+

The script curently wants a minimum of 5 minutes + between values taken from host (can be changed at the beginning + of the scripts). You can check more than once every 5 minutes but + don't put check-interval to more than 15 minutes.
+ When the script doesn't have enough data to compute the CPU use + (for example, the first time it is run), then it will return a UNKNOWN + status.

+

Msg size option (-o option)

+

In case you get a "ERROR: running table + : Message size exceeded maxMsgSize" error, you may need to + adjust the maxMsgSize, i.e. the maximum size of snmp message with + the -o option. Try a value with the -o AND the -v option : the script + will output the actual value so you can add some octets to it with + the -o option.

+

SNMP Login
+

+

See snmp info page

+

Requirements :

+

- Perl in /usr/bin/perl - or just run 'perl + script'
+ - Net::SNMP
+ - file 'utils.pm' in plugin diretory
+

+

Dowload + latest version : 1.5

+

Configurations + examples

+

Changelog + : On CVS repository on sourceforge : http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/.

+

Examples :

+


+ All examples below are considering the script is local directory. + Host to be checked is 127.0.0.1 with snmp community "public".

+

If multiple interfaces are selected, all must + be up to get an OK result

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Get help +

+

./check_snmp_process.pl -h

+
snmpv3 login./check_snmp_process.pl -H + 127.0.0.1 -l login -x passwd
+

Check if at least one process matching http is running +

+

./check_snmp_process.pl -H 127.0.0.1 -C public -n http

+
+

Result example : +

+

3 process matching http : > 0 : OK

+
+

Check if at least 3 process matching http are running +

+

./check_snmp_process.pl -H 127.0.0.1 -C public -n http + -w 2 -c 0

+
+
Result example :
+ (<=2 will return warning, 0 critical)
+
3 process matching httpd : + > 2 : OK
Check if at + least one process named "httpd" exists (no regexp)./check_snmp_process.pl -H + 127.0.0.1 -C public -n http -r
+

Result example :

+
3 process named httpd + : > 0 : OK
Check process + by their full path : check process of /opt/soft/bin/ (at least + one) ./check_snmp_process.pl -H + 127.0.0.1 -C public -n /opt/soft/bin/ -f
Check that at + least 3 process but not more than 8 are running./check_snmp_process.pl -H + 127.0.0.1 -C public -n http -w 3,8 -c 0,15
Same checks + + checks maximum memory used by process (in Mb) : warning and + critical levels./check_snmp_process.pl -H + 127.0.0.1 -C public -n http -w 3,8 -c 0,15 -m 9,25
Same check but + sum all CPU used by all selected process./check_snmp_process.pl -H + 127.0.0.1 -C public -n http -w 3,8 -c 0,15 -m 9,25 -u 70,99
+

Output of check_snmp_process.pl -h

+ + + + +
+

SNMP Process Monitor for Nagios version 1.5
+ GPL licence, (c)2004-2006 Patrick Proy

+

Usage: ./check_snmp_process.pl [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd) [-p <port>] -n <name> [-w <min_proc>[,<max_proc>] -c <min_proc>[,max_proc] ] [-m<warn Mb>,<crit Mb> -a -u<warn %>,<crit%> -d<delta> ] [-t <timeout>] [-o <octet_length>] [-f -A -F ] [-r] [-V] [-g]
+ -v, --verbose
+ print extra debugging information (and lists all storages)
+ -h, --help
+ print this help message
+ -H, --hostname=HOST
+ name or IP address of host to check
+ -C, --community=COMMUNITY NAME
+ community name for the host's SNMP agent (implies SNMP v1 or v2c with option)
+ -l, --login=LOGIN ; -x, --passwd=PASSWD, -2, --v2c
+ Login and auth password for snmpv3 authentication
+ If no priv password exists, implies AuthNoPriv
+ -2 : use snmp v2c
+ -X, --privpass=PASSWD
+ Priv password for snmpv3 (AuthPriv protocol)
+ -L, --protocols=<authproto>,<privproto>
+ <authproto> : Authentication protocol (md5|sha : default md5)
+ <privproto> : Priv protocole (des|aes : default des)
+ -p, --port=PORT
+ SNMP port (Default 161)
+ -n, --name=NAME
+ Name of the process (regexp)
+ No trailing slash !
+ -r, --noregexp
+ Do not use regexp to match NAME in description OID
+ -f, --fullpath
+ Use full path name instead of process name
+ (Windows doesn't provide full path name)
+ -A, --param
+ Add parameters to select processes.
+ ex : "named.*-t /var/named/chroot" will only select named process with this parameter
+ -F, --perfout
+ Add performance output
+ outputs : memory_usage, num_process, cpu_usage
+ -w, --warn=MIN[,MAX]
+ Number of process that will cause a warning
+ -1 for no warning, MAX must be >0. Ex : -w-1,50
+ -c, --critical=MIN[,MAX]
+ number of process that will cause an error (
+ -1 for no critical, MAX must be >0. Ex : -c-1,50
+ Notes on warning and critical :
+ with the following options : -w m1,x1 -c m2,x2
+ you must have : m2 <= m1 < x1 <= x2
+ you can omit x1 or x2 or both
+ -m, --memory=WARN,CRIT
+ checks memory usage (default max of all process)
+ values are warning and critical values in Mb
+ -a, --average
+ makes an average of memory used by process instead of max
+ -u, --cpu=WARN,CRIT
+ checks cpu usage of all process
+ values are warning and critical values in % of CPU usage
+ if more than one CPU, value can be > 100% : 100%=1 CPU
+ -d, --delta=seconds
+ make an average of <delta> seconds for CPU (default 300=5min)
+ -g, --getall
+ In some cases, it is necessary to get all data at once because
+ process die very frequently.
+ This option eats bandwidth an cpu (for remote host) at breakfast.
+ -o, --octetlength=INTEGER
+ max-size of the SNMP message, usefull in case of Too Long responses.
+ Be carefull with network filters. Range 484 - 65535, default are
+ usually 1472,1452,1460 or 1440.
+ -t, --timeout=INTEGER
+ timeout for SNMP in seconds (Default: 5)
+ -V, --version
+ prints version number
+ Note :
+ CPU usage is in % of one cpu, so maximum can be 100% * number of CPU
+ example :
+ Browse process list : <script> -C <community> -H <host> -n <anything> -v
+ the -n option allows regexp in perl format :
+ All process of /opt/soft/bin : -n /opt/soft/bin/ -f
+ All 'named' process : -n named
+
+

+
+
+

This project is hosted on :
+ SourceForge.net Logo +

+

Nagios and the Nagios logo are registered + trademarks of Ethan Galstad.

+
+
+

 

+ + + + + + + + + diff --git a/doc/html/nagios.manubulon.com/snmp_storage.html b/doc/html/nagios.manubulon.com/snmp_storage.html new file mode 100644 index 0000000..3737eb5 --- /dev/null +++ b/doc/html/nagios.manubulon.com/snmp_storage.html @@ -0,0 +1,1336 @@ + + + + + + + + +Nagios plugins + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
This site :
Home
Nagios plugins
Info on snmp
Nagios config
FAQ
Project page on SourceForge
-----------
Links :
Nagios + + Home
Nagios + Plugins
Oreon project
NagiosExchange
Opsyx + forum
Forum 2037
-----------
Others :
+ + +
-----------
SourceForge.net Logo
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Snmp storage check
+ + + +

Script : check_snmp_storage.pl

+ + + +

Last update : Jun 09 2007

+ + + +
+ + + +

Description :

+ + + +

This scripts checks by snmp (V1 and v3) disks, + + memory, swap, everthing in hrStorage table.
+ + Storages selection can be done :
+ + - by perl regexp on description or index (-m)
+ + - and (optional) by storage type (-q) : Other, Ram, VirtualMemory, + + FixedDisk, RemovableDisk, FloppyDisk, CompactDisk, RamDisk, FlashMemory, + + NetworkDisk
+ +
+ + One or multiple storages can be selected.
+ + It is also possible to sum all selected storages (-s)
+ +
+ + Warning and critical levels can be checked based on :
+ + - Percent of disk used
+ + - Percent of disk left
+ + - MB left
+ + - MB used

+ +

Output options (-S):

+ +

-S can have 3 options : <type>[,<where>,<cut>]
+ + <type> : Make the output shorter :
+ + 0 : only print the global result except the disk in warning or critical
+ + 1 : Don't print all info for every disk
+ + <where> : (optional) if = 1, put the OK/WARN/CRIT at + + the beginning
+ + <cut> : take the <n> first caracters or <n> + + last if n<0

+ +

With the following disks : /home : 51% used + + and / : 90% used

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Option usedWarningOutput
 99%/home: 51%used(1012MB/1969MB) + + /: 90%used(5781MB/6390MB) (<99%) : OK
 90%/home: 51%used(1012MB/1969MB) + + /: 90%used(5781MB/6390MB) (>90%) : WARNING
-S090%All selected storages (<99%) + + : OK
-S099%/: 90%used(5781MB/6390MB) + + (>90%) : WARNING
-S190%/home: 51% /: 90% (<99%) + + : OK
-S199%/home: 51% /: 90%used(5781MB/6390MB) + + (>90%) : WARNING
-S0,190%OK : (<99%) All + + selected storages
-S0,190%WARNING : (>90%) + + /: 90%used(5781MB/6390MB)
-S1,,299%/h: 51% /: 90% (<99%) + + : OK
-S1,,-299%me: 51% /: 90% (<99%) + + : OK
-S0,1,-230%WARNING : (>30%) me: 51%used(1012MB/1969MB) + + /: 90%used(5781MB/6390MB)
+ +

Performance output (-f + option)

+

The performance will remove any weird caracters + ( `~!$%^&*'"<>|?,(= ) ) from the drive name.

+

Msg size option (-o option)

+

In case you get a "ERROR: running table + : Message size exceeded maxMsgSize" error, you may need to + adjust the maxMsgSize, i.e. the maximum size of snmp message with + the -o option. Try a value with the -o AND the -v option : the script + will output the actual value so you can add some octets to it with + the -o option.

+

SNMP Login
+

+

See snmp info page

+ +

---
+ Vérifie par snmp v1 ou v3 l'occupation des disques, mais aussi de + la swap, de la mémoire, etc.. tout ce qui est disponible en snmp + par la table hrStorage.
+ + Les disques sont sélectionnables par expression régulière + + compatible Perl
+ +

+ +

Requirements :

+ + + +

- Perl in /usr/bin/perl - or just run 'perl + + + + script'
+ + + + - Net::SNMP
+ + + + - file 'utils.pm' in plugin diretory (/usr/local/nagios/libexec)
+ + + +

+ + + +

Dowload + lastest version : 1.3.3

+ + + +

Configurations + + + + examples

+ + + +

Changelog + : On CVS repository on sourceforge : http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/.
+

+ + + +

Examples :

+ + + +


+ + + + All examples below are considering the script is local directory. + + + + Host to be checked is 127.0.0.1 with snmp community "public".

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Get help + + + +

+ + + +

./check_snmp_storage.pl -h

+ + + +
List all storage./check_snmp_storage.pl -H + + + + 127.0.0.1 -C public -m zzzz -w 80 -c 81 -v
snmpv3 login./check_snmp_storage.pl -H + + + + 127.0.0.1 -l login -x passwd
+ + + +

+ + + +

+ + + +

Unix/Linux

+ + + +
+ + + +

%used of /home is less than 80% and 90% + + + +

+ + + +

./check_snmp_storage.pl -H 127.0.0.1 -C public -m /home + + + + -w 80% -c 90%

+ + + +
+ + + +

%free of /home is above 10% and 5% + + + +

+ + + +

./check_snmp_storage.pl -H 127.0.0.1 -C public -m /home -w + + + + 10% -c 5% -T pl

+ + + +
+ + + +

Mb used of /home is less than 800 Mb and 900 Mb + + + +

+ + + +

./check_snmp_storage.pl -H 127.0.0.1 -C public -m /home + + + + -w 800 -c 900 -T bu

+ + + +
+ + + +

Mb free of /home is above 100Mb and 30Mb + + + +

+ + + +

./check_snmp_storage.pl -H 127.0.0.1 -C public -m /home + + + + -w 100 -c 30 -T bl

+ + + +
+ + + +

All mountpoints have %used less than 80% and 90% + + + +

+ + + +

./check_snmp_storage.pl -H 127.0.0.1 -C public -m / -w + + + + 80% -c 90%

+ + + +
%used of / + + + + mountpoint only is less than 80% and 90% + + + +

./check_snmp_storage.pl -H 127.0.0.1 -C public -m / -r + + + + -w 80% -c 90%

+ + + +
%used of mountpoint + + + + index 1 only is less than 80% and 90% + + + +

./check_snmp_storage.pl -H 127.0.0.1 -C public -m 1 -p + + + + -w 80% -c 90%

+ + + +
Swap %used + + + + is less than 80% and 90% + + + +

./check_snmp_storage.pl -H 127.0.0.1 -C public -m Swap + + + + -w 80% -c 90%

+ + + +
Memory %used + + + + is less than 80% and 90% + + + +

./check_snmp_storage.pl -H 127.0.0.1 -C public -m "Real + + + + Memory" -w 80% -c 90%

+ + + +
  + + + +

Windows

+ + + +
%used of C + + + + is less than 80% and 90% + + + +

./check_snmp_storage.pl -H 127.0.0.1 -C public -m ^C: + + + + -w 80% -c 90%

+ + + +
%used of C, + + + + D and E is less than 80% and 90% + + + +

./check_snmp_storage.pl -H 127.0.0.1 -C public -m ^[CDE]: + + + + -w 80% -c 90%

+ + + +
%used of C+D+E + + + + is less than 80% and 90% + + + +

./check_snmp_storage.pl -H 127.0.0.1 -C public -m ^[CDE]: + + + + -s -w 80% -c 90%

+ + + +
  + + + +

AS/400 specific

+ + + +
Sum of all + + + + memory storages is less than 90% and 95% + + + +

./check_snmp_storage.pl -H 127.0.0.1 -C public -m RAM + + + + -s -w 80% -c 90%

+ + + +
+ + + +

Output of check_snmp_storage.pl -h

+ + + + + + + + + + + + + + + + + +
+

SNMP Disk Monitor for Nagios version 1.3.3
+ (c)2004-2007 Patrick Proy

+

Usage: check_snmp_storage [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>]) [-p <port>] -m <name in desc_oid> [-q storagetype] -w <warn_level> -c <crit_level> [-t <timeout>] [-T pl|pu|bl|bu ] [-r -s -i -G] [-e] [-S 0|1[,1,<car>]] [-o <octet_length>] [-R <% reserved>]
+ By default, plugin will monitor %used on drives :
+ warn if %used > warn and critical if %used > crit
+ -v, --verbose
+ print extra debugging information (and lists all storages)
+ -h, --help
+ print this help message
+ -H, --hostname=HOST
+ name or IP address of host to check
+ -C, --community=COMMUNITY NAME
+ community name for the host's SNMP agent (implies SNMP v1)
+ -2, --v2c
+ Use snmp v2c
+ -l, --login=LOGIN ; -x, --passwd=PASSWD
+ Login and auth password for snmpv3 authentication
+ If no priv password exists, implies AuthNoPriv
+ -X, --privpass=PASSWD
+ Priv password for snmpv3 (AuthPriv protocol)
+ -L, --protocols=<authproto>,<privproto>
+ <authproto> : Authentication protocol (md5|sha : default md5)
+ <privproto> : Priv protocole (des|aes : default des)
+ -x, --passwd=PASSWD
+ Password for snmpv3 authentication
+ -p, --port=PORT
+ SNMP port (Default 161)
+ -m, --name=NAME
+ Name in description OID (can be mounpoints '/home' or 'Swap Space'...)
+ This is treated as a regexp : -m /var will match /var , /var/log, /opt/var ...
+ Test it before, because there are known bugs (ex : trailling /)
+ No trailing slash for mountpoints !
+ -q, --storagetype=[Other|Ram|VirtualMemory|FixedDisk|RemovableDisk|FloppyDisk
+ CompactDisk|RamDisk|FlashMemory|NetworkDisk]
+ Also check the storage type in addition of the name
+ It is possible to use regular expressions ( "FixedDisk|FloppyDisk" )
+ -r, --noregexp
+ Do not use regexp to match NAME in description OID
+ -s, --sum
+ Add all storages that match NAME (used space and total space)
+ THEN make the tests.
+ -i, --index
+ Parse index table instead of description table to select storage
+ -e, --exclude
+ Select all storages except the one(s) selected by -m
+ No action on storage type selection
+ -T, --type=TYPE
+ pl : calculate percent left
+ pu : calculate percent used (Default)
+ bl : calculate MegaBytes left
+ bu : calculate MegaBytes used
+ -w, --warn=INTEGER
+ percent / MB of disk used to generate WARNING state
+ you can add the % sign
+ -c, --critical=INTEGER
+ percent / MB of disk used to generate CRITICAL state
+ you can add the % sign
+ -R, --reserved=INTEGER
+ % reserved blocks for superuser
+ For ext2/3 filesystems, it is 5% by default
+ -G, --gigabyte
+ output, warning & critical levels in gigabytes
+ -f, --perfparse
+ Perfparse compatible output
+ -S, --short=<type>[,<where>,<cut>]
+ <type>: Make the output shorter :
+ 0 : only print the global result except the disk in warning or critical
+ ex: "< 80% : OK"
+ 1 : Don't print all info for every disk
+ ex : "/ : 66 %used (< 80) : OK"
+ <where>: (optional) if = 1, put the OK/WARN/CRIT at the beginning
+ <cut>: take the <n> first caracters or <n> last if n<0
+ -o, --octetlength=INTEGER
+ max-size of the SNMP message, usefull in case of Too Long responses.
+ Be carefull with network filters. Range 484 - 65535, default are
+ usually 1472,1452,1460 or 1440.
+ -t, --timeout=INTEGER
+ timeout for SNMP in seconds (Default: 5)
+ -V, --version
+ prints version number
+ Note :
+ with T=pu or T=bu : OK < warn < crit
+ with T=pl ot T=bl : crit < warn < OK
+
+ If multiple storage are selected, the worse condition will be returned
+ i.e if one disk is critical, the return is critical
+
+ example :
+ Browse storage list : <script> -C <community> -H <host> -m <anything> -w 1 -c 2 -v
+ the -m option allows regexp in perl format :
+ Test drive C,F,G,H,I on Windows : -m ^[CFGHI]:
+ Test all mounts containing /var : -m /var
+ Test all mounts under /var : -m ^/var
+ Test only /var : -m /var -r
+ Test all swap spaces : -m ^Swap
+ Test all but swap spaces : -m ^Swap -e
+

+


+

+ + + +
+ + + +

This project is hosted on :
+ + + + SourceForge.net Logo + + + +

+ + + +

Nagios and the Nagios logo are registered + + + + trademarks of Ethan Galstad.

+ + + +
+ + + +
+ + + +

 

+ + + + + + + + + + + + + + + diff --git a/doc/html/nagios.manubulon.com/snmp_vrrp.html b/doc/html/nagios.manubulon.com/snmp_vrrp.html new file mode 100644 index 0000000..c1273b3 --- /dev/null +++ b/doc/html/nagios.manubulon.com/snmp_vrrp.html @@ -0,0 +1,382 @@ + + + + +Nagios plugins + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
This site :
Home
Nagios plugins
Info on snmp
Nagios config
FAQ
Project page on SourceForge
-----------
Links :
Nagios + + Home
Nagios + Plugins
Oreon project
NagiosExchange
Opsyx + forum
Forum 2037
-----------
Others :
+ + +
-----------
SourceForge.net Logo
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Snmp vrrp check
+ +

Script : check_snmp_vrrp.pl

+ +

Last update : Sept 4 2006

+ +
+ +

Description :

+ +

Checks by snmp v1, v2c or v3 the vrrp status + of all vrrp enabled interfaces.
+ Works on
+ - Nokia IP with ipso 3.X , 4.X in VRRP mode.
+ - Nokia IP with ipso 3.X , 4.X in clustering mode.
+ - Radware Linkproof
+ - Alteon AD4 Loadbalancers

+

Depending on the state you put as option ("master" + or "backup") the script will get all the vrrp enables + interface and check they are in this state.
+ If not, it will retrun a critical status
+ By default, it will check Nokia IP platforms using vrrp, you can + test other platforms with the '-T' option :
+
+ - Alteon
+ - Linkproof (VRRP)
+ - Nokia clustering.

+

Nokia clustering check

+

Nokia clustering check does not have a master + & backup state. Instead, the plugin will check :

+

- The number of cluster member
+ - The % load on each cluster.

+

For example -s 2,90 will issue
+ - A critical level if there is not 2 members.
+ - A warning level if more than 90% is assigned to one cluster member.

+

To have a long output, put the '-g' option.

+ +

SNMP Login
+

+

See snmp info page

+

French : + Vérifie par snmp v1 ou v3 l'état des interfaces vrrp : Nokia, + Linkproof, Altéon ou l'état d'un cluster Nokia.

+ +

Requirements :

+ +

- Perl in /usr/bin/perl - or just run 'perl + + script'
+ + - Net::SNMP
+ + - file 'utils.pm' in plugin diretory
+ +

+ +

Dowload + lastest version : 1.3

+ +

Configurations + + examples

+ +

Examples :

+ +


+ + All examples below are considering the script is local directory. + + Host to be checked is 127.0.0.1 with snmp community "public".

+ +

If multiple interfaces are selected, all must + + be up to get an OK result

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Get help +

+

./check_snmp_vrrp.pl -h

+
snmpv3 login./check_snmp_vrrp.pl -H 127.0.0.1 + -l login -x passwd
+

Check vrrp state of a node to be master. +

+

./check_snmp_vrrp.pl -H 127.0.0.1 -C public -s master

+
+
+

Output example :
+ The ouput is : <vrid>(<state>,<status>,<priority>) +

+
+
Vrid : 10(master/up/100), + 1(master/up/100), 3(master/up/100), 2(master/up/100), : All + master :OK
Check vrrp state + of a node to be backup. ./check_snmp_vrrp.pl -H 127.0.0.1 + -C public -s backup
+

Output example : +

+

Vrid : 1(backup/up/95), 3(backup/up/95), 10(backup/up/95), + 2(backup/up/95), : All backup :OK

+
Test a Linkproof./check_snmp_vrrp.pl -H 127.0.0.1 + -C public -s master -T lp
Test a Nokia + cluster : 2 cluster members and max 90% load assigned to one + cluster. ./check_snmp_vrrp.pl -H 127.0.0.1 + -C public -s 2,90%-T ipso
+ +

Changelog + : On CVS repository on sourceforge : http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/.

+ +

Output of check_snmp_vrrp.pl -h

+ + + + + + + + + +
+

SNMP VRRP Monitor for Nagios version + 1.3
+ (c)2004-2006 to my cat Ratoune - Author : Patrick Proy +

Usage: ./check_snmp_vrrp.pl [-v] -H <host> -C <snmp_community> + [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>]) + -s <master|backup|num,%> [-T <nokia|alteon|lp|nsc|ipsocluster>] + [-p <port>] [-t <timeout>] [-V]
+ -v, --verbose
+ print extra debugging information (including interface list + on the system)
+ -h, --help
+ print this help message
+ -H, --hostname=HOST
+ name or IP address of host to check
+ -C, --community=COMMUNITY NAME
+ community name for the host's SNMP agent (implies v1 protocol)
+ -2, --v2c
+ Use snmp v2c
+ -l, --login=LOGIN ; -x, --passwd=PASSWD
+ Login and auth password for snmpv3 authentication
+ If no priv password exists, implies AuthNoPriv
+ -X, --privpass=PASSWD
+ Priv password for snmpv3 (AuthPriv protocol)
+ -L, --protocols=<authproto>,<privproto>
+ <authproto> : Authentication protocol (md5|sha : default + md5)
+ <privproto> : Priv protocole (des|aes : default des) +
+ -P, --port=PORT
+ SNMP port (Default 161)
+ -T, --type=<nokia|alteon|lp|nsc|ipso>
+ Type of vrrp router to check
+ nokia (default) : Nokai vrrp. Should be working for most vrrp + routers
+ alteon : for Alteon AD4 Loadbalancers
+ lp : Radware Linkproof
+ nsc : Nescreen (ScreenOS 5.x NSRP)
+ ipso : Nokia IPSO clustering
+ -s, --state=master|backup|num,%
+ Nokia ipso clustering : number of members, max % assigned + to nodes.
+ Other : check vrrp interface to be master or backup
+ -g, --long
+ Make output long even is all is OK
+ -t, --timeout=INTEGER
+ timeout for SNMP in seconds (Default: 5)
+ -V, --version
+ prints version number

+
+ +
+ +

This project is hosted on :
+ + SourceForge.net Logo + +

+ +

Nagios and the Nagios logo are registered + + trademarks of Ethan Galstad.

+ +
+ +
+ +

 

+ + + + + + + + + + + diff --git a/doc/html/nagios.manubulon.com/snmp_windows.html b/doc/html/nagios.manubulon.com/snmp_windows.html new file mode 100644 index 0000000..e4b4889 --- /dev/null +++ b/doc/html/nagios.manubulon.com/snmp_windows.html @@ -0,0 +1,261 @@ + + +Nagios plugins + + + + + + + + + +
+ + + + + + + + + + + + + + +
Home

+
+ +
+ + + + + + + + + + + + + +
Snmp windows check
+

Script : check_snmp_win.pl

+

Last update : Jan 11 2007

+
+

Description :

+

Checks by snmp v1 or v3 windows specific health + monitoring (service state for now).
+
+ Works on Windows server (2000, 2003) maybe XP and NT.

+

Vérifie par snmp v1 ou v3 si un(des) service + Windows tournent.
+
+ Service checks
+

+

The plugin checks if there if the Windows service(s) + he gets as input are running.
+ You can provide multiple services, comma separated :
+ -n <service1>,<service2>

+

The script will return :
+ OK : if <service1> is found (and active) and <service2> + is found (and active).
+ WARNING : if <service1> and <service2> match more + than 2 active services.
+ CRITICAL : if <service1> OR <service2> don't match any + active service.

+

-N <number> : will return OK if + <number> of active services matches the filter

+

-s : will show all active services instead + of the non active ones only

+

Requirements :

+

- Perl in /usr/bin/perl - or just run 'perl + script'
+ - Net::SNMP
+ - file 'utils.pm' in plugin diretory
+

+

Dowload + latest version : 0.6

+

Configurations + examples

+

Examples :

+


+ All examples below are considering the script is local directory. + Host to be checked is 127.0.0.1 with snmp community "public".

+

If multiple interfaces are selected, all must + be up to get an OK result

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Get help +

+

./check_snmp_win.pl -h

+
snmpv3 login./check_snmp_win.pl -H 127.0.0.1 + -l login -x passwd
+

Check if at least one process matching dns is running +

+

./check_snmp_win.pl -H 127.0.0.1 -C public -n dns

+
+

Result example : +

+

1 services active (matching "dns") : OK

+
+

Check if at least 3 process matching dns are running +

+

./check_snmp_win.pl -H 127.0.0.1 -C public -n http -N + 2

+
+
Result example :
+ (<=2 will return warning, 0 critical)
+
1 services active (matching + "dns") : CRITICAL
Check if dns + and ssh services are running./check_snmp_win.pl -H 127.0.0.1 + -C public -n dns,ssh
+

Result example :

+
"dns" active, "ssh" + active : OK
Check if dns + and toto services are running./check_snmp_win.pl -H 127.0.0.1 + -C public -n dns,toto
+
Result example :
+
"toto" not active + : CRITICAL
+

 

+

Changelog + : On CVS repository on sourceforge : http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/.
+

+

Output of check_snmp_win.pl -h

+ + + + +
+

SNMP Windows Monitor for Nagios version 0.6
+ GPL licence, (c)2004-2005 Patrick Proy

+

Usage: check_snmp_win [-v] -H <host> -C <snmp_community> + [-2] | (-l login -x passwd) [-p <port>] -n <name>[,<name2] + [-T=service] [-r] [-s] [-N=<n>] [-t <timeout>] + [-V]
+ -v, --verbose
+ print extra debugging information (and lists all services)
+ -h, --help
+ print this help message
+ -H, --hostname=HOST
+ name or IP address of host to check
+ -C, --community=COMMUNITY NAME
+ community name for the host's SNMP agent (implies SNMP v1 + or v2c with option)
+ -2, --v2c
+ Use snmp v2c
+ -l, --login=LOGIN
+ Login for snmpv3 authentication (implies v3 protocol with + MD5)
+ -x, --passwd=PASSWD
+ Password for snmpv3 authentication
+ -p, --port=PORT
+ SNMP port (Default 161)
+ -T, --type=service
+ Check type :
+ - service (default) checks service
+ -n, --name=NAME[,NAME2...]
+ Comma separated names of services (perl regular expressions + can be used for every one).
+ By default, it is not case sensitive.
+ -N, --number=<n>
+ Compare matching services with <n> instead of the number + of names provided.
+ -s, --showall
+ Show all services in the output, instead of only the non-active + ones.
+ -r, --noregexp
+ Do not use regexp to match NAME in service description.
+ -t, --timeout=INTEGER
+ timeout for SNMP in seconds (Default: 5)
+ -V, --version
+ prints version number
+ Note :
+ The script will return
+ OK if ALL services are in active state,
+ WARNING if there is more than specified (ex 2 service specified, + 3 active services matching),
+ CRITICAL if at least one of them is non active.
+ The -n option will allows regexp in perl format
+ -n "service" will match 'service WINS' 'sevice DNS' + etc...
+ It is not case sensitive by default : WINS = wins

+
+
+

This project is hosted on :
+ SourceForge.net Logo +

+

Nagios and the Nagios logo are registered + trademarks of Ethan Galstad.

+
+
+

 

+ + + + + diff --git a/icingaexchange.yml b/icingaexchange.yml new file mode 100644 index 0000000..7996055 --- /dev/null +++ b/icingaexchange.yml @@ -0,0 +1,8 @@ +name: manubulon-snmp +description: "file:///README.md" +url: "https://github.com/dnsmichi/manubulon-snmp" +tags: SNMP,Storage,Network,Windows,NAS +vendor: Linux,Cisco,HP,Fortinet,Juniper +target: Operating System,Snmp,Storage,Network +type: Plugin +license: gpl diff --git a/Changelog b/plugins/Changelog similarity index 66% rename from Changelog rename to plugins/Changelog index f939bca..1dfeb15 100644 --- a/Changelog +++ b/plugins/Changelog @@ -1,3 +1,37 @@ +################################ +Release 1.1.2 / Jun 2007 : + +Scripts, actual CVS version and changelog : +check_snmp_mem.pl : 1.3 +check_snmp_vrrp.pl : 1.3 +check_snmp_linkproof_nhr.pl : 1.1 +check_snmp_process.pl : 1.7 + - Added option to select process with his parameter + - Added option for performance output + - Corrected negative CPU when process restarts + - Added delta option for cpu average (-d option) +check_snmp_boostedge.pl : 1.2 +check_snmp_nsbox.pl : 1.2 +check_snmp_css_main.pl : 1.1 +check_snmp_cpfw.pl : 1.7 +check_snmp_int.pl : 1.22 + - Correct speed query for interface > 4 Gbps + - Reduced snmp queries to 2 instead of 3 when perf data is on + - Bad maximum in perfdata when in Bps + - Added option to make dormant state OK +check_snmp_storage.pl : 1.10 + - Return an UNKNOWN status when size/used/alloc is not defined in snmp + - Patch from Alexander Greiner-B?r to remove the reserved disk space for superuser on ext2/3 FS. + New -R option for this + - Added -G (giga) option for output & levels in Gigabytes +check_snmp_win.pl : 0.6 +check_snmp_css.pl : 1.3 +check_snmp_env.pl : 1.8 + - Added test to check existence of some OIDs +check_snmp_load.pl : 1.11 + - Corrected bug in performance output + - Added SIG{ALRM} sub and % sign in output + ################################ Release 1.1.1 / April 2007 : diff --git a/plugins/INSTALL b/plugins/INSTALL new file mode 100644 index 0000000..48e220a --- /dev/null +++ b/plugins/INSTALL @@ -0,0 +1,15 @@ +Installation: +------------- + +You can simply copy the .pl files to the Nagios Plugin directory if +- Nagios plugins and utils.pm file are in /usr/local/nagios/libexec. +- You are sure Net::SNMP is installed. (Getopt::Long is standard). +- perl is in /usr/bin/perl +- Temp files can be written by Nagios in /tmp + +You can also use the "install.sh" script provided in this directory to install the plugins. +Type : "./install.sh" to install all the plugins or "./install.sh " for a specific one. + +The script will check for dependencies and ask for Nagios and temp directories. +It will modify the scripts depending on these answers and install the scripts. + diff --git a/LICENSE b/plugins/LICENSE similarity index 100% rename from LICENSE rename to plugins/LICENSE diff --git a/README b/plugins/README similarity index 94% rename from README rename to plugins/README index 48c81c8..7fe6df2 100644 --- a/README +++ b/plugins/README @@ -1,4 +1,4 @@ -Nagios SNMP plugins 1.1.1 README +Nagios SNMP plugins 1.1.2 README ------------------------------ @@ -32,7 +32,7 @@ Mailling list, forum : http://sourceforge.net/projects/nagios-snmp/ Legal stuff: ------------ - Nagios SNMP plugins version 1.1.1, Copyright (C) 2004-2007 Patrick Proy (nagios at proy.org) + Nagios SNMP plugins version 1.1.2, Copyright (C) 2004-2007 Patrick Proy (nagios at proy.org) 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 diff --git a/plugins/check_snmp_boostedge.pl b/plugins/check_snmp_boostedge.pl new file mode 100755 index 0000000..b46b00a --- /dev/null +++ b/plugins/check_snmp_boostedge.pl @@ -0,0 +1,371 @@ +#!/usr/bin/perl -w +############################## check_snmp_boostedge.pl ################# +# Version : 1.0 +# Date : Jan 16 2007 +# Author : Patrick Proy ( patrick at proy.org) +# Help : http://www.manubulon.com/nagios/ +# License : GPL - http://www.fsf.org/licenses/gpl.txt +# Changelog : +# Contributors : +################################################################# +# +# Help : ./check_snmp_boostedge.pl -h +# + +use strict; +use Net::SNMP; +use Getopt::Long; + +# Icinga specific + +my %ERRORS = ('OK' => 0, 'WARNING' => 1, 'CRITICAL' => 2, 'UNKNOWN' => 3, 'DEPENDENT' => 4); + +# SNMP Datas + +my $be_global_status = "1.3.6.1.4.1.4185.12.1.1.3.0"; # boostedge global status (stop(0), start(1)) + +my $be_service_number = "1.3.6.1.4.1.4185.12.1.5.1.0"; # beServiceNumber + +my $be_service_table = "1.3.6.1.4.1.4185.12.1.5"; # beServices +my $be_service_name = "1.3.6.1.4.1.4185.12.1.5.2.1.2"; # beServiceName +my $be_service_status = "1.3.6.1.4.1.4185.12.1.5.2.1.4"; # status ("RUNNING") +my $be_service_mode = "1.3.6.1.4.1.4185.12.1.5.2.1.5"; # beServiceMode (disabled(0), enabled(1)) +my $be_service_datain = "1.3.6.1.4.1.4185.12.1.5.2.1.6"; # beServiceDataIn (Not populated for now : HTTP/S - V5.2.16.0) +my $be_service_dataout + = "1.3.6.1.4.1.4185.12.1.5.2.1.7"; # beServiceDataOut (Not populated for now : HTTP/S - V5.2.16.0) +my $be_service_connect + = "1.3.6.1.4.1.4185.12.1.5.2.1.8"; # beServiceConnect (Not populated for now : HTTP/S - V5.2.16.0) + +# Globals + +my $VERSION = "2.0.0"; + +my $o_host = undef; # hostname +my $o_community = undef; # community +my $o_port = 161; # port +my $o_help = undef; # wan't some help ? +my $o_verb = undef; # verbose mode +my $o_version = undef; # print version +my $o_timeout = undef; # Timeout (Default 5) +my $o_perf = undef; # Output performance data +my $o_version2 = undef; # use snmp v2c + +# Specific +my $o_service = undef; # service regexp selection +my $o_nservice = undef; # service number expected + +# SNMPv3 specific +my $o_login = undef; # Login for snmpv3 +my $o_passwd = undef; # Pass for snmpv3 +my $v3protocols = undef; # V3 protocol list. +my $o_authproto = 'md5'; # Auth protocol +my $o_privproto = 'des'; # Priv protocol +my $o_privpass = undef; # priv password + +# functions + +sub p_version { print "check_snmp_boostedge version : $VERSION\n"; } + +sub print_usage { + print +"Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) -s -n [-p ] [-f] [-t ] [-V]\n"; +} + +sub isnnum { # Return true if arg is not a number + my $num = shift; + if ($num =~ /^(\d+\.?\d*)|(^\.\d+)$/) { return 0; } + return 1; +} + +sub set_status { # return worst status with this order : OK, unknwonw, warning, critical + my $new_status = shift; + my $cur_status = shift; + if (($cur_status == 0) || ($new_status == $cur_status)) { return $new_status; } + if ($new_status == 3) { return $cur_status; } + if ($new_status > $cur_status) { return $new_status; } + return $cur_status; +} + +sub is_pattern_valid { # Test for things like "" or "+5-i" + my $pat = shift; + if (!defined($pat)) { $pat = " "; } # Just to get rid of compilation time warnings + return eval { "" =~ /$pat/; 1 } || 0; +} + +sub help { + print "\nSNMP Boostedge service monitor for Icinga/Nagios/Naemon/Shinken, Version ", $VERSION, "\n"; + print "GPL License, (c)2006-2007 Patrick Proy\n\n"; + print_usage(); + print < + Regexp of service to select +-n, --number= + Number of services selected that must be in running & enabled state +-2, --v2c + Use snmp v2c +-l, --login=LOGIN ; -x, --passwd=PASSWD + Login and auth password for snmpv3 authentication + If no priv password exists, implies AuthNoPriv +-X, --privpass=PASSWD + Priv password for snmpv3 (AuthPriv protocol) +-L, --protocols=, + : Authentication protocol (md5|sha : default md5) + : Priv protocole (des|aes : default des) +-P, --port=PORT + SNMP port (Default 161) +-f, --perfparse, --perfdata + Performance data output +-t, --timeout=INTEGER + timeout for SNMP in seconds (Default: 5) +-V, --version + prints version number +EOT +} + +# For verbose output +sub verb { my $t = shift; print $t, "\n" if defined($o_verb); } + +sub check_options { + Getopt::Long::Configure("bundling"); + GetOptions( + 'v' => \$o_verb, + 'verbose' => \$o_verb, + 'h' => \$o_help, + 'help' => \$o_help, + 'H:s' => \$o_host, + 'hostname:s' => \$o_host, + 'p:i' => \$o_port, + 'port:i' => \$o_port, + 'C:s' => \$o_community, + 'community:s' => \$o_community, + 'l:s' => \$o_login, + 'login:s' => \$o_login, + 'x:s' => \$o_passwd, + 'passwd:s' => \$o_passwd, + 'X:s' => \$o_privpass, + 'privpass:s' => \$o_privpass, + 'L:s' => \$v3protocols, + 'protocols:s' => \$v3protocols, + 't:i' => \$o_timeout, + 'timeout:i' => \$o_timeout, + 'V' => \$o_version, + 'version' => \$o_version, + '2' => \$o_version2, + 'v2c' => \$o_version2, + 'f' => \$o_perf, + 'perfparse' => \$o_perf, + 'perfdata' => \$o_perf, + 's:s' => \$o_service, + 'service:s' => \$o_service, + 'n:i' => \$o_nservice, + 'number:i' => \$o_nservice + ); + + # Basic checks + if (defined($o_timeout) && (isnnum($o_timeout) || ($o_timeout < 2) || ($o_timeout > 60))) { + print "Timeout must be >1 and <60 !\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (!defined($o_timeout)) { $o_timeout = 5; } + if (defined($o_help)) { help(); exit $ERRORS{"UNKNOWN"} } + if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"} } + if (!defined($o_host)) # check host and filter + { + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + + # check snmp information + if (!defined($o_community) && (!defined($o_login) || !defined($o_passwd))) { + print "Put snmp login info!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if ((defined($o_login) || defined($o_passwd)) && (defined($o_community) || defined($o_version2))) { + print "Can't mix snmp v1,2c,3 protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (defined($v3protocols)) { + if (!defined($o_login)) { + print "Put snmp V3 login info with protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + my @v3proto = split(/,/, $v3protocols); + if ((defined($v3proto[0])) && ($v3proto[0] ne "")) { $o_authproto = $v3proto[0]; } # Auth protocol + if (defined($v3proto[1])) { $o_privproto = $v3proto[1]; } # Priv protocol + if ((defined($v3proto[1])) && (!defined($o_privpass))) { + print "Put snmp V3 priv login info with priv protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + } + if (!defined($o_service) || !(is_pattern_valid($o_service))) { + print "Service selection must be set and be a valid regexp\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (!defined($o_nservice) || isnnum($o_nservice)) { + print "Service number must be set and be an integer\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } +} + +########## MAIN ####### + +check_options(); + +# Check timeout if snmp screws up +if (defined($o_timeout)) { + verb("Alarm in $o_timeout seconds"); + alarm($o_timeout); +} + +$SIG{'ALRM'} = sub { + print "No answer from host $o_host:$o_port\n"; + exit $ERRORS{"UNKNOWN"}; +}; + +# Connect to host +my ($session, $error); +if (defined($o_login) && defined($o_passwd)) { + + # SNMPv3 login + verb("SNMPv3 login"); + if (!defined($o_privpass)) { + verb("SNMPv3 AuthNoPriv login : $o_login, $o_authproto"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => '3', + -username => $o_login, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, + -timeout => $o_timeout + ); + } else { + verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => '3', + -username => $o_login, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, + -privpassword => $o_privpass, + -privprotocol => $o_privproto, + -timeout => $o_timeout + ); + } +} else { + if (defined($o_version2)) { + + # SNMPv2 Login + verb("SNMP v2c login"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => 2, + -community => $o_community, + -port => $o_port, + -timeout => $o_timeout + ); + } else { + + # SNMPV1 login + verb("SNMP v1 login"); + ($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 $ERRORS{"UNKNOWN"}; +} + +# Get global status +my @oidlist = ($be_global_status); +my $resultat + = (version->parse(Net::SNMP->VERSION) < 4) + ? $session->get_request(@oidlist) + : $session->get_request(-varbindlist => \@oidlist); + +if (!defined($resultat)) { + printf("ERROR: Gloabal status table : %s.\n", $session->error); + $session->close; + exit $ERRORS{"UNKNOWN"}; +} + +if ($$resultat{$be_global_status} != 1) { + print "Global service is stopped (", $$resultat{$be_global_status}, ") : CRITICAL\n"; + exit $ERRORS{"CRITICAL"}; +} + +$resultat = undef; + +# Get service table +$resultat + = (version->parse(Net::SNMP->VERSION) < 4) + ? $session->get_table($be_service_table) + : $session->get_table(Baseoid => $be_service_table); + +if (!defined($resultat)) { + printf("ERROR: Description table : %s.\n", $session->error); + $session->close; + exit $ERRORS{"UNKNOWN"}; +} +$session->close; + +my $output = ""; +my $output_perf = ""; +my $global_status = 0; +my ($nservice, $nservice_ok) = (0, 0); +my (@found_service, @service_state) = undef; + +foreach my $key (keys %$resultat) { + verb("OID : $key, Desc : $$resultat{$key}"); + if (($key =~ /$be_service_name\./) && ($$resultat{$key} =~ /$o_service/)) { # Get index of service with name + $found_service[$nservice] = $$resultat{$key}; + $key =~ s/$be_service_name//; + $service_state[$nservice] = $$resultat{ $be_service_status . $key }; + if (($service_state[$nservice] ne "RUNNING") || ($$resultat{ $be_service_mode . $key } != 1)) { + $service_state[$nservice] .= "(" . $$resultat{ $be_service_mode . $key } . ")"; + $global_status = 2; + } else { + $nservice_ok++; + } + $nservice++; + verb("Found service $found_service[$nservice-1]"); + } +} + +if ($o_nservice > $nservice_ok) { + for (my $i = 0; $i < $nservice; $i++) { + if ($output ne "") { $output .= ", "; } + $output .= $found_service[$i] . ":" . $service_state[$i]; + } + if ($output ne "") { $output .= ", "; } + $output .= ":" . $nservice_ok . " services OK < " . $o_nservice; + print $output, " : CRITICAL\n"; + exit $ERRORS{"CRITICAL"}; +} + +$output = $nservice_ok . " services OK"; +if ($o_nservice < $nservice_ok) { + print $output, " > $o_nservice : WARNING\n"; + exit $ERRORS{"WARNING"}; +} +print $output, " : OK\n"; +exit $ERRORS{"OK"}; diff --git a/plugins/check_snmp_cpfw.pl b/plugins/check_snmp_cpfw.pl new file mode 100755 index 0000000..a14dc00 --- /dev/null +++ b/plugins/check_snmp_cpfw.pl @@ -0,0 +1,604 @@ +#!/usr/bin/perl -w +############################## check_snmp_cpfw ############## +my $VERSION = "2.0.0"; + +# Date : Oct 20 2007 +# Author : Patrick Proy (patrick at proy.org) +# Help : http://nagios.manubulon.com +# License : GPL - http://www.fsf.org/licenses/gpl.txt +# Contrib : StaGue +# TODO : +# - check sync method +################################################################# +# +# Help : ./check_snmp_cpfw.pl -h +# + +use strict; +use Net::SNMP; +use Getopt::Long; + +# Icinga specific +my %ERRORS = ('OK' => 0, 'WARNING' => 1, 'CRITICAL' => 2, 'UNKNOWN' => 3, 'DEPENDENT' => 4); + +########### SNMP Datas ########### + +###### FW data +my $policy_state = "1.3.6.1.4.1.2620.1.1.1.0"; # "Installed" +my $policy_name = "1.3.6.1.4.1.2620.1.1.2.0"; # Installed policy name +my $connections = "1.3.6.1.4.1.2620.1.1.25.3.0"; # number of connections + +#my $connections_peak = "1.3.6.1.4.1.2620.1.1.25.4.0"; # peak number of connections +my @fw_checks = ($policy_state, $policy_name, $connections); + +###### SVN data +my $svn_status = "1.3.6.1.4.1.2620.1.6.102.0"; # "OK" svn status +my %svn_checks = ($svn_status, "OK"); +my %svn_checks_n = ($svn_status, "SVN status"); +my @svn_checks_oid = ($svn_status); + +###### HA data + +my $ha_active = "1.3.6.1.4.1.2620.1.5.5.0"; # "yes" +my $ha_state = "1.3.6.1.4.1.2620.1.5.6.0"; # "active" / "standby" +my $ha_block_state = "1.3.6.1.4.1.2620.1.5.7.0"; #"OK" : ha blocking state +my $ha_status = "1.3.6.1.4.1.2620.1.5.102.0"; # "OK" : ha status + +my %ha_checks = ($ha_active, "yes", $ha_state, "active", $ha_block_state, "OK", $ha_status, "OK"); +my %ha_checks_stand = ($ha_active, "yes", $ha_state, "standby", $ha_block_state, "OK", $ha_status, "OK"); +my %ha_checks_n + = ($ha_active, "HA active", $ha_state, "HA state", $ha_block_state, "HA block state", $ha_status, "ha_status"); +my @ha_checks_oid = ($ha_active, $ha_state, $ha_block_state, $ha_status); + +my $ha_mode = "1.3.6.1.4.1.2620.1.5.11.0"; # "Sync only"/"High Availability (Active Up)" : ha Working mode + +my $ha_tables = "1.3.6.1.4.1.2620.1.5.13.1"; # ha status table +my $ha_tables_index = ".1"; +my $ha_tables_name = ".2"; +my $ha_tables_state = ".3"; # "OK" +my $ha_tables_prbdesc = ".6"; # Description if state is != "OK" + +#my @ha_table_check = ("Synchronization","Filter","cphad","fwd"); # process to check + +####### MGMT data + +my $mgmt_status = "1.3.6.1.4.1.2620.1.7.5.0"; # "active" : management status +my $mgmt_alive = "1.3.6.1.4.1.2620.1.7.6.0"; # 1 : management is alive if 1 +my $mgmt_stat_desc = "1.3.6.1.4.1.2620.1.7.102.0"; # Management status description +my $mgmt_stats_desc_l = "1.3.6.1.4.1.2620.1.7.103.0"; # Management status long description + +my %mgmt_checks = ($mgmt_status, "active", $mgmt_alive, "1"); +my %mgmt_checks_n = ($mgmt_status, "Mgmt status", $mgmt_alive, "Mgmt alive"); +my @mgmt_checks_oid = ($mgmt_status, $mgmt_alive); + +#################################### Globals ##############################"" + +my $o_host = undef; # hostname +my $o_community = undef; # community +my $o_version2 = undef; # Version 2 +my $o_port = 161; # port +my $o_help = undef; # wan't some help ? +my $o_verb = undef; # verbose mode +my $o_version = undef; # print version +my $o_timeout = 5; # Default 5s Timeout +my $o_warn = undef; # Warning for connections +my $o_crit = undef; # Crit for connections +my $o_svn = undef; # Check for SVN status +my $o_fw = undef; # Check for FW status +my $o_ha = undef; # Check for HA status +my $o_mgmt = undef; # Check for management status +my $o_policy = undef; # Check for policy name +my $o_conn = undef; # Check for connexions +my $o_perf = undef; # Performance data output + +# SNMPv3 specific +my $o_login = undef; # Login for snmpv3 +my $o_passwd = undef; # Pass for snmpv3 +my $v3protocols = undef; # V3 protocol list. +my $o_authproto = 'md5'; # Auth protocol +my $o_privproto = 'des'; # Priv protocol +my $o_privpass = undef; # priv password + +# functions + +sub p_version { print "check_snmp_cpfw version : $VERSION\n"; } + +sub print_usage { + print +"Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-s] [-w [-p=pol_name] [-c=warn,crit]] [-m] [-a [standby] ] [-f] [-p ] [-t ] [-V]\n"; +} + +sub isnnum { # Return true if arg is not a number + my $num = shift; + if ($num =~ /^(\d+\.?\d*)|(^\.\d+)$/) { return 0; } + return 1; +} + +sub help { + print "\nSNMP Checkpoint FW-1 Monitor for Icinga/Nagios/Naemon/Shinken, Version ", $VERSION, "\n"; + print "GPL License, (c)2004-2007 - Patrick Proy\n\n"; + print_usage(); + print <, + : Authentication protocol (md5|sha : default md5) + : Priv protocole (des|aes : default des) +-s, --svn + check for svn status +-w, --fw + check for fw status +-a, --ha[=standby] + check for ha status and node in "active" state + If using SecurePlatform and monitoring a standby unit, put "standby" too +-m, --mgmt + check for management status +-p, --policy=POLICY_NAME + check if installed policy is POLICY_NAME (must have -w) +-c, --connexions=WARN,CRIT + check warn and critical number of connexions (must have -w) +-f, --perfparse, --perfdata + performance data output (only works with -c) +-P, --port=PORT + SNMP port (Default 161) +-t, --timeout=INTEGER + timeout for SNMP (Default: Nagios default) +-V, --version + prints version number +EOT +} + +# For verbose output +sub verb { my $t = shift; print $t, "\n" if defined($o_verb); } + +sub check_options { + Getopt::Long::Configure("bundling"); + GetOptions( + 'v' => \$o_verb, + 'verbose' => \$o_verb, + 'h' => \$o_help, + 'help' => \$o_help, + 'H:s' => \$o_host, + 'hostname:s' => \$o_host, + 'P:i' => \$o_port, + 'port:i' => \$o_port, + 'C:s' => \$o_community, + 'community:s' => \$o_community, + '2' => \$o_version2, + 'v2c' => \$o_version2, + 'l:s' => \$o_login, + 'login:s' => \$o_login, + 'x:s' => \$o_passwd, + 'passwd:s' => \$o_passwd, + 'X:s' => \$o_privpass, + 'privpass:s' => \$o_privpass, + 'L:s' => \$v3protocols, + 'protocols:s' => \$v3protocols, + 't:i' => \$o_timeout, + 'timeout:i' => \$o_timeout, + 'V' => \$o_version, + 'version' => \$o_version, + 's' => \$o_svn, + 'svn' => \$o_svn, + 'w' => \$o_fw, + 'fw' => \$o_fw, + 'a:s' => \$o_ha, + 'ha:s' => \$o_ha, + 'm' => \$o_mgmt, + 'mgmt' => \$o_mgmt, + 'p:s' => \$o_policy, + 'policy:s' => \$o_policy, + 'c:s' => \$o_conn, + 'connexions:s' => \$o_conn, + 'f' => \$o_perf, + 'perfparse' => \$o_perf, + 'perfdata' => \$o_perf + ); + if (defined($o_help)) { help(); exit $ERRORS{"UNKNOWN"} } + if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"} } + if (!defined($o_host)) # check host and filter + { + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + + # check snmp information + if (!defined($o_community) && (!defined($o_login) || !defined($o_passwd))) { + print "Put snmp login info!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if ((defined($o_login) || defined($o_passwd)) && (defined($o_community) || defined($o_version2))) { + print "Can't mix snmp v1,2c,3 protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (defined($v3protocols)) { + if (!defined($o_login)) { + print "Put snmp V3 login info with protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + my @v3proto = split(/,/, $v3protocols); + if ((defined($v3proto[0])) && ($v3proto[0] ne "")) { $o_authproto = $v3proto[0]; } # Auth protocol + if (defined($v3proto[1])) { $o_privproto = $v3proto[1]; } # Priv protocol + if ((defined($v3proto[1])) && (!defined($o_privpass))) { + print "Put snmp V3 priv login info with priv protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + } + + # Check firewall options + if (defined($o_conn)) { + if (!defined($o_fw)) { + print "Cannot check connexions without checking fw\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + my @warncrit = split(/,/, $o_conn); + if ($#warncrit != 1) { print "Put warn,crit levels with -c option\n"; print_usage(); exit $ERRORS{"UNKNOWN"} } + ($o_warn, $o_crit) = @warncrit; + if (isnnum($o_warn) || isnnum($o_crit)) { + print "Numeric values for warning and critical in -c options\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if ($o_warn >= $o_crit) { print "warning <= critical ! \n"; print_usage(); exit $ERRORS{"UNKNOWN"} } + } + if (defined($o_policy)) { + if (!defined($o_fw)) { + print "Cannot check policy name without checking fw\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if ($o_policy eq "") { print "Put a policy name !\n"; print_usage(); exit $ERRORS{"UNKNOWN"} } + } + if (defined($o_perf) && !defined($o_conn)) { + print "Nothing selected for performance data output !\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (!defined($o_fw) && !defined($o_ha) && !defined($o_mgmt) && !defined($o_svn)) { + print "Must select a product to check !\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (defined($o_ha) && ($o_ha ne "") && ($o_ha ne "standby")) { + print "-a option comes with 'standby' or nothing !\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + +} + +########## MAIN ####### + +check_options(); + +# Check timeout if snmp screws up +if (defined($o_timeout)) { + verb("Alarm in $o_timeout seconds"); + alarm($o_timeout); +} + +$SIG{'ALRM'} = sub { + print "No answer from host $o_host:$o_port\n"; + exit $ERRORS{"UNKNOWN"}; +}; + +# Connect to host +my ($session, $error); +if (defined($o_login) && defined($o_passwd)) { + + # SNMPv3 login + verb("SNMPv3 login"); + if (!defined($o_privpass)) { + verb("SNMPv3 AuthNoPriv login : $o_login, $o_authproto"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => '3', + -username => $o_login, + -port => $o_port, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, + -timeout => $o_timeout + ); + } else { + verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => '3', + -username => $o_login, + -port => $o_port, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, + -privpassword => $o_privpass, + -privprotocol => $o_privproto, + -timeout => $o_timeout + ); + } +} else { + if (defined($o_version2)) { + + # SNMPv2 Login + verb("SNMP v2c login"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => 2, + -community => $o_community, + -port => $o_port, + -timeout => $o_timeout + ); + } else { + + # SNMPV1 login + verb("SNMP v1 login"); + ($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 $ERRORS{"UNKNOWN"}; +} + +########### Global checks ################# + +my $global_status = 0; # global status : 0=OK, 1=Warn, 2=Crit +my ($resultat, $key) = (undef, undef); + +########## Check SVN status ############# +my $svn_print = ""; +my $svn_state = 0; + +if (defined($o_svn)) { + + $resultat = $session->get_request(Varbindlist => \@svn_checks_oid); + + if (defined($resultat)) { + foreach $key (keys %svn_checks) { + verb("$svn_checks_n{$key} : $svn_checks{$key} / $$resultat{$key}"); + if ($$resultat{$key} ne $svn_checks{$key}) { + $svn_print .= $svn_checks_n{$key} . ":" . $$resultat{$key} . " "; + $svn_state = 2; + } + } + } else { + $svn_print .= "cannot find OIDs"; + + #Critical state if not found because it means soft is not activated + $svn_state = 2; + } + + if ($svn_state == 0) { + $svn_print = "SVN: OK"; + } else { + $svn_print = "SVN: " . $svn_print; + } + verb("$svn_print"); +} +########## Check mgmt status ############# +my $mgmt_state = 0; +my $mgmt_print = ""; + +if (defined($o_mgmt)) { + + # Check all states + $resultat = undef; + $resultat = $session->get_request(Varbindlist => \@mgmt_checks_oid); + if (defined($resultat)) { + foreach $key (keys %mgmt_checks) { + verb("$mgmt_checks_n{$key} : $mgmt_checks{$key} / $$resultat{$key}"); + if ($$resultat{$key} ne $mgmt_checks{$key}) { + $mgmt_print .= $mgmt_checks_n{$key} . ":" . $$resultat{$key} . " "; + $mgmt_state = 2; + } + } + } else { + $mgmt_print .= "cannot find OIDs"; + + #Critical state if not found because it means soft is not activated + $mgmt_state = 2; + } + if ($mgmt_state == 0) { + $mgmt_print = "MGMT: OK"; + } else { + $mgmt_print = "MGMT: " . $mgmt_print; + } + verb("$svn_print"); +} + +########### Check fw status ############## + +my $fw_state = 0; +my $fw_print = ""; +my $perf_conn = undef; + +if (defined($o_fw)) { + + # Check all states + + $resultat = $session->get_request(Varbindlist => \@fw_checks); + if (defined($resultat)) { + verb("State : $$resultat{$policy_state}"); + verb("Name : $$resultat{$policy_name}"); + verb("connections : $$resultat{$connections}"); + + if ($$resultat{$policy_state} ne "Installed") { + $fw_state = 2; + $fw_print .= "Policy:" . $$resultat{$policy_state} . " "; + verb("Policy state not installed"); + } + + if (defined($o_policy)) { + if ($$resultat{$policy_name} ne $o_policy) { + $fw_state = 2; + $fw_print .= "Policy installed: $$resultat{$policy_name}"; + } + } + + if (defined($o_conn)) { + if ($$resultat{$connections} > $o_crit) { + $fw_state = 2; + $fw_print .= "Connexions : " . $$resultat{$connections} . " > " . $o_crit . " "; + } else { + if ($$resultat{$connections} > $o_warn) { + if ($fw_state != 2) { $fw_state = 1; } + $fw_print .= "Connexions : " . $$resultat{$connections} . " > " . $o_warn . " "; + } + } + $perf_conn = $$resultat{$connections}; + } + } else { + $fw_print .= "cannot find OIDs"; + + #Critical state if not found because it means soft is not activated + $fw_state = 2; + } + + if ($fw_state == 0) { + $fw_print = "FW: OK"; + } else { + $fw_print = "FW: " . $fw_print; + } + +} +########### Check ha status ############## + +my $ha_state_n = 0; +my $ha_print = ""; + +if (defined($o_ha)) { + + # Check all states + + $resultat = $session->get_request(Varbindlist => \@ha_checks_oid); + + if (defined($resultat)) { + foreach $key (keys %ha_checks) { + verb("$ha_checks_n{$key} : $ha_checks{$key} / $$resultat{$key}"); + if ($o_ha eq "standby") { + if ($$resultat{$key} ne $ha_checks_stand{$key}) { + $ha_print .= $ha_checks_n{$key} . ":" . $$resultat{$key} . " "; + $ha_state_n = 2; + } + } else { + if ($$resultat{$key} ne $ha_checks{$key}) { + $ha_print .= $ha_checks_n{$key} . ":" . $$resultat{$key} . " "; + $ha_state_n = 2; + } + } + } + + #my $ha_mode = "1.3.6.1.4.1.2620.1.5.11.0"; # "Sync only" : ha Working mode + } else { + $ha_print .= "cannot find OIDs"; + + #Critical state if not found because it means soft is not activated + $ha_state_n = 2; + } + + # get ha status table + $resultat = $session->get_table(Baseoid => $ha_tables); + my %status; + my (@index, @oid) = (undef, undef); + my $nindex = 0; + my $index_search = $ha_tables . $ha_tables_index; + + if (defined($resultat)) { + foreach $key (keys %$resultat) { + if ($key =~ /$index_search/) { + @oid = split(/\./, $key); + pop(@oid); + $index[$nindex] = pop(@oid); + $nindex++; + } + } + } else { + $ha_print .= "cannot find OIDs" if ($ha_state_n == 0); + + #Critical state if not found because it means soft is not activated + $ha_state_n = 2; + } + verb("found $nindex ha softs"); + if ($nindex == 0) { + $ha_print .= " no ha soft found" if ($ha_state_n == 0); + $ha_state_n = 2; + } else { + my $ha_soft_name = undef; + + for (my $i = 0; $i < $nindex; $i++) { + + $key = $ha_tables . $ha_tables_name . "." . $index[$i] . ".0"; + $ha_soft_name = $$resultat{$key}; + + $key = $ha_tables . $ha_tables_state . "." . $index[$i] . ".0"; + if (($status{$ha_soft_name} = $$resultat{$key}) ne "OK") { + $key = $ha_tables . $ha_tables_prbdesc . "." . $index[$i] . ".0"; + $status{$ha_soft_name} = $$resultat{$key}; + $ha_print .= $ha_soft_name . ":" . $status{$ha_soft_name} . " "; + $ha_state_n = 2; + } + verb("$ha_soft_name : $status{$ha_soft_name}"); + } + } + + if ($ha_state_n == 0) { + $ha_print = "HA: OK"; + } else { + $ha_print = "HA: " . $ha_print; + } + +} + +$session->close; + +########## print results and exit + +my $f_print = undef; + +if (defined($o_fw)) { $f_print = $fw_print } +if (defined($o_svn)) { $f_print = (defined($f_print)) ? $f_print . " / " . $svn_print : $svn_print } +if (defined($o_ha)) { $f_print = (defined($f_print)) ? $f_print . " / " . $ha_print : $ha_print } +if (defined($o_mgmt)) { $f_print = (defined($f_print)) ? $f_print . " / " . $mgmt_print : $mgmt_print } + +my $exit_status = undef; +$f_print .= " / CPFW Status: "; +if (($ha_state_n + $svn_state + $fw_state + $mgmt_state) == 0) { + $f_print .= 'OK' . ($perf_conn ? ', ' . $perf_conn . ' conn.' : ''); + $exit_status = $ERRORS{"OK"}; +} else { + if (($fw_state == 1) || ($ha_state_n == 1) || ($svn_state == 1) || ($mgmt_state == 1)) { + $f_print .= "WARNING"; + $exit_status = $ERRORS{"WARNING"}; + } else { + $f_print .= "CRITICAL"; + $exit_status = $ERRORS{"CRITICAL"}; + } +} + +if (defined($o_perf) && defined($perf_conn)) { + $f_print .= " | fw_connexions=" . $perf_conn . ";" . $o_warn . ";" . $o_crit . ";0"; +} + +print "$f_print\n"; +exit $exit_status; + diff --git a/plugins/check_snmp_css.pl b/plugins/check_snmp_css.pl new file mode 100755 index 0000000..22b2f2d --- /dev/null +++ b/plugins/check_snmp_css.pl @@ -0,0 +1,551 @@ +#!/usr/bin/perl -w +############################## check_snmp_css.pl ################# +# Version : 1.0.1 +# Date : 27 Sept 2006 +# Author : Patrick Proy ( patrick at proy.org) +# Help : http://www.manubulon.com/nagios/ +# License : GPL - http://www.fsf.org/licenses/gpl.txt +# Changelog : +# Contributors : +################################################################# +# +# Help : ./check_snmp_css.pl -h +# + +use strict; +use Net::SNMP; +use Getopt::Long; + +# Icinga specific +my %ERRORS = ('OK' => 0, 'WARNING' => 1, 'CRITICAL' => 2, 'UNKNOWN' => 3, 'DEPENDENT' => 4); + +# SNMP Datas + +my $css_svc_table = "1.3.6.1.4.1.9.9.368.1.15.2.1"; # Svc table +my $css_svc_name = "1.3.6.1.4.1.9.9.368.1.15.2.1.1"; # Service Name / apSvcName +my $css_svc_index = "1.3.6.1.4.1.9.9.368.1.15.2.1.2"; # apSvcIndex +my $css_svc_enable = "1.3.6.1.4.1.9.9.368.1.15.2.1.12"; # apSvcEnable +my $css_svc_state = "1.3.6.1.4.1.9.9.368.1.15.2.1.17"; # apSvcState : suspended(1), down(2), alive(4), dying(5) +my $css_svc_maxconn = "1.3.6.1.4.1.9.9.368.1.15.2.1.19"; # Max connexions / apSvcMaxConnections +my $css_svc_conn = "1.3.6.1.4.1.9.9.368.1.15.2.1.20"; # apSvcConnections +my $css_svc_avgresp = "1.3.6.1.4.1.9.9.368.1.15.2.1.65"; # apSvcAvgResponseTime : average response time +my $css_svc_maxresp = "1.3.6.1.4.1.9.9.368.1.15.2.1.66"; # apSvcPeakAvgResponseTime : peak response time +my @css_svc_state_txt = ("", "suspended", "down", "", "alive", "dying"); +my @css_svc_state_nag = (3, 2, 2, 3, 0, 2); + +# Globals + +my $VERSION = "2.0.0"; + +my $o_host = undef; # hostname +my $o_community = undef; # community +my $o_port = 161; # port +my $o_help = undef; # wan't some help ? +my $o_verb = undef; # verbose mode +my $o_version = undef; # print version +my $o_timeout = undef; # Timeout (Default 5) +my $o_perf = undef; # Output performance data +my $o_version2 = undef; # use snmp v2c + +#Specific +my $o_dir = "/tmp/"; # Directory to store temp file in it. +my $o_dir_set = undef; # defined if names and index must be read form file. +my $o_name = undef; # service name (regexp) +my $o_warn_number = undef; # minimum number of service before warning +my $o_crit_number = undef; # minimum number of service before critical +my $o_warn_conn = undef; # % of max connexions for warning level +my $o_crit_conn = undef; # % of max connexions for critical level +my $o_warn_resp = undef; # average response time for warning level +my $o_crit_resp = undef; # average response time for critical level +my @o_levels = undef; + +# SNMPv3 specific +my $o_login = undef; # Login for snmpv3 +my $o_passwd = undef; # Pass for snmpv3 +my $v3protocols = undef; # V3 protocol list. +my $o_authproto = 'md5'; # Auth protocol +my $o_privproto = 'des'; # Priv protocol +my $o_privpass = undef; # priv password + +# functions + +sub p_version { print "check_snmp_css version : $VERSION\n"; } + +sub print_usage { + print +"Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) -n [-d directory] [-w ,, -c ,,] [-p ] [-f] [-t ] [-V]\n"; +} + +sub isnnum { # Return true if arg is not a number + my $num = shift; + if ($num =~ /^-?(\d+\.?\d*)|(^\.\d+)$/) { return 0; } + return 1; +} + +sub set_status { # return worst status with this order : OK, unknwonw, warning, critical + my $new_status = shift; + my $cur_status = shift; + if (($cur_status == 0) || ($new_status == $cur_status)) { return $new_status; } + if ($new_status == 3) { return $cur_status; } + if ($new_status > $cur_status) { return $new_status; } + return $cur_status; +} + +sub is_pattern_valid { # Test for things like "" or "+5-i" + my $pat = shift; + if (!defined($pat)) { $pat = " "; } # Just to get rid of compilation time warnings + return eval { "" =~ /$pat/; 1 } || 0; +} + +sub round ($$) { + sprintf "%.$_[1]f", $_[0]; +} + +sub help { + print "\nSNMP Cisco CSS monitor for Icinga/Nagios/Naemon/Shinken, Version ", $VERSION, "\n"; + print "(c)2004-2006 Patrick Proy\n\n"; + print_usage(); + print < + regexp to select service +-w, --warning=,, + Optional. Warning level for + - minimum number of active & alive service + - average response time + - number of connexions + For no warnings, put -1 (ex : -w5,-1,3). + When using negative numbers, dont put space after "-w" +-d, --dir= + Directory where the temp file with index, created by check_snmp_css_main.pl, can be found + If no directory is set, /tmp will be used +-c, --critical=,resp>, + Optional. Critical levels (-1 for no critical levels) + See warning levels. +-C, --community=COMMUNITY NAME + community name for the host's SNMP agent (implies v1 protocol) +-2, --v2c + Use snmp v2c +-l, --login=LOGIN ; -x, --passwd=PASSWD + Login and auth password for snmpv3 authentication + If no priv password exists, implies AuthNoPriv +-X, --privpass=PASSWD + Priv password for snmpv3 (AuthPriv protocol) +-L, --protocols=, + : Authentication protocol (md5|sha : default md5) + : Priv protocole (des|aes : default des) +-P, --port=PORT + SNMP port (Default 161) +-f, --perfparse + Perfparse compatible output +-t, --timeout=INTEGER + timeout for SNMP in seconds (Default: 5) +-V, --version + prints version number +EOT +} + +# For verbose output +sub verb { my $t = shift; print $t, "\n" if defined($o_verb); } + +sub check_options { + Getopt::Long::Configure("bundling"); + GetOptions( + 'v' => \$o_verb, + 'verbose' => \$o_verb, + 'h' => \$o_help, + 'help' => \$o_help, + 'H:s' => \$o_host, + 'hostname:s' => \$o_host, + 'p:i' => \$o_port, + 'port:i' => \$o_port, + 'C:s' => \$o_community, + 'community:s' => \$o_community, + 'l:s' => \$o_login, + 'login:s' => \$o_login, + 'x:s' => \$o_passwd, + 'passwd:s' => \$o_passwd, + 'X:s' => \$o_privpass, + 'privpass:s' => \$o_privpass, + 'L:s' => \$v3protocols, + 'protocols:s' => \$v3protocols, + 't:i' => \$o_timeout, + 'timeout:i' => \$o_timeout, + 'V' => \$o_version, + 'version' => \$o_version, + '2' => \$o_version2, + 'v2c' => \$o_version2, + 'f' => \$o_perf, + 'perfparse' => \$o_perf, + 'n:s' => \$o_name, + 'name:s' => \$o_name, + 'w:s' => \$o_warn_conn, + 'warning:s' => \$o_warn_conn, + 'c:s' => \$o_crit_conn, + 'critical:s' => \$o_crit_conn, + 'd:s' => \$o_dir_set, + 'dir:s' => \$o_dir_set + ); + + # Basic checks + if (defined($o_timeout) && (isnnum($o_timeout) || ($o_timeout < 2) || ($o_timeout > 60))) { + print "Timeout must be >1 and <60 !\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (!defined($o_timeout)) { $o_timeout = 5; } + if (defined($o_help)) { help(); exit $ERRORS{"UNKNOWN"} } + if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"} } + if (!defined($o_host)) # check host and filter + { + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + + # check snmp information + if (!defined($o_community) && (!defined($o_login) || !defined($o_passwd))) { + print "Put snmp login info!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if ((defined($o_login) || defined($o_passwd)) && (defined($o_community) || defined($o_version2))) { + print "Can't mix snmp v1,2c,3 protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (defined($v3protocols)) { + if (!defined($o_login)) { + print "Put snmp V3 login info with protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + my @v3proto = split(/,/, $v3protocols); + if ((defined($v3proto[0])) && ($v3proto[0] ne "")) { $o_authproto = $v3proto[0]; } # Auth protocol + if (defined($v3proto[1])) { $o_privproto = $v3proto[1]; } # Priv protocol + if ((defined($v3proto[1])) && (!defined($o_privpass))) { + print "Put snmp V3 priv login info with priv protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + } + if (!defined($o_name) || !(is_pattern_valid($o_name))) { + print "Need a service name!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (defined($o_warn_conn)) { + @o_levels = split(/,/, $o_warn_conn); + if (defined($o_levels[0])) { + if (isnnum($o_levels[0])) { print "Need number for warning!\n"; print_usage(); exit $ERRORS{"UNKNOWN"} } + if ($o_levels[0] != -1) { $o_warn_number = $o_levels[0]; } + } + if (defined($o_levels[1])) { + if (isnnum($o_levels[1])) { print "Need number for warning!\n"; print_usage(); exit $ERRORS{"UNKNOWN"} } + if ($o_levels[1] != -1) { $o_warn_conn = $o_levels[1]; } + else { $o_warn_conn = undef; } + } else { + $o_warn_conn = undef; + } + if (defined($o_levels[2])) { + if (isnnum($o_levels[2])) { print "Need number for warning!\n"; print_usage(); exit $ERRORS{"UNKNOWN"} } + if ($o_levels[2] != -1) { $o_warn_resp = $o_levels[2]; } + } + } + if (defined($o_crit_conn)) { + @o_levels = split(/,/, $o_crit_conn); + if (defined($o_levels[0])) { + if (isnnum($o_levels[0])) { print "Need number for critical!\n"; print_usage(); exit $ERRORS{"UNKNOWN"} } + if ($o_levels[0] != -1) { + $o_crit_number = $o_levels[0]; + if (defined($o_warn_number) && ($o_crit_number >= $o_warn_number)) { + print "critical must be < warning!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + } + } + if (defined($o_levels[1])) { + if (isnnum($o_levels[1])) { print "Need number for critical!\n"; print_usage(); exit $ERRORS{"UNKNOWN"} } + if ($o_levels[1] != -1) { + $o_crit_conn = $o_levels[1]; + if (defined($o_warn_conn) && ($o_warn_conn >= $o_crit_conn)) { + print "critical must be > warning!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + } else { + $o_crit_conn = undef; + } + } else { + $o_crit_conn = undef; + } + if (defined($o_levels[2])) { + if (isnnum($o_levels[2])) { print "Need number for critical!\n"; print_usage(); exit $ERRORS{"UNKNOWN"} } + if ($o_levels[2] != -1) { + $o_crit_resp = $o_levels[1]; + if (defined($o_warn_resp) && ($o_warn_resp >= $o_crit_resp)) { + print "critical must be > warning!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + } + } + } + if (defined($o_dir_set)) { + if ($o_dir_set ne "") { $o_dir = $o_dir_set; } + verb("Tmp directory : $o_dir"); + } +} + +########## MAIN ####### + +check_options(); + +if (defined($o_timeout)) { + verb("Alarm in $o_timeout seconds"); + alarm($o_timeout); +} + +$SIG{'ALRM'} = sub { + print "No answer from host $o_host:$o_port\n"; + exit $ERRORS{"UNKNOWN"}; +}; + +# Connect to host +my ($session, $error); +if (defined($o_login) && defined($o_passwd)) { + + # SNMPv3 login + verb("SNMPv3 login"); + if (!defined($o_privpass)) { + verb("SNMPv3 AuthNoPriv login : $o_login, $o_authproto"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => '3', + -username => $o_login, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, + -timeout => $o_timeout + ); + } else { + verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => '3', + -username => $o_login, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, + -privpassword => $o_privpass, + -privprotocol => $o_privproto, + -timeout => $o_timeout + ); + } +} else { + if (defined($o_version2)) { + + # SNMPv2 Login + verb("SNMP v2c login"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => 2, + -community => $o_community, + -port => $o_port, + -timeout => $o_timeout + ); + } else { + + # SNMPV1 login + verb("SNMP v1 login"); + ($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 $ERRORS{"UNKNOWN"}; +} +$session->max_msg_size(10000); + +########### Cisco CSS checks ############## + +my (@index, @svcname) = (undef, undef); +my ($numsvc, $numoid, $numoid2) = 0; +my (@oid, @oid_list, @oid_list2) = undef; +my $resultat = undef; + +# Get load table by snmp or file +if (defined($o_dir_set)) { + my $file_name = $o_dir . "/Nagios_css_" . $o_host; + my $file_lock = $file_name . ".lock"; + + # Check for lock file during 3 seconds max and quit if sill here. + my $file_timeout = 0; + while (-e $file_lock) { + sleep(1); + if ($file_timeout == 3) { + print "Lock file remaining for more than 3 sec : UNKNOWN\n"; + exit $ERRORS{"UNKNOWN"}; + } + $file_timeout++; + } + + # Open file for reading. + open(FILE, "< " . $file_name); + while () { + my @file_line = split(/:/, $_); + if ((defined($file_line[1])) && ($file_line[1] =~ /$o_name/)) { # select service by name + chomp($file_line[1]); + $svcname[$numsvc] = $file_line[1]; + my $key = $file_line[0]; + verb("Found : $svcname[$numsvc]"); + $index[$numsvc++] = $key; + + # Build oid for snmpget + $oid_list[$numoid++] = $css_svc_enable . $key; + $oid_list[$numoid++] = $css_svc_state . $key; + $oid_list2[$numoid2++] = $css_svc_maxconn . $key; + $oid_list2[$numoid2++] = $css_svc_conn . $key; + $oid_list2[$numoid2++] = $css_svc_avgresp . $key; + } + } + close(FILE); +} else { + $resultat + = (version->parse(Net::SNMP->VERSION) < 4) + ? $session->get_table($css_svc_name) + : $session->get_table(Baseoid => $css_svc_name); + + if (!defined($resultat)) { + printf("ERROR: Description table : %s.\n", $session->error); + $session->close; + exit $ERRORS{"UNKNOWN"}; + } + + # Get name data & index + + foreach my $key (keys %$resultat) { + verb("OID : $key, Desc : $$resultat{$key}"); + if ($$resultat{$key} =~ /$o_name/) { # select service by name + $svcname[$numsvc] = $$resultat{$key}; + $key =~ s/$css_svc_name//; + verb("Found : $svcname[$numsvc]"); + $index[$numsvc++] = $key; + + # Build oid for snmpget + $oid_list[$numoid++] = $css_svc_enable . $key; + $oid_list[$numoid++] = $css_svc_state . $key; + $oid_list2[$numoid2++] = $css_svc_maxconn . $key; + $oid_list2[$numoid2++] = $css_svc_conn . $key; + $oid_list2[$numoid2++] = $css_svc_avgresp . $key; + } + } +} + +# Check if a least one service found +if ($numsvc == 0) { + print "No service matching ", $o_name, " found : CRITICAL\n"; + exit $ERRORS{"CRITICAL"}; +} + +$resultat = undef; +$resultat + = (version->parse(Net::SNMP->VERSION) < 4) + ? $session->get_request(@oid_list) + : $session->get_request(-varbindlist => \@oid_list); + +if (!defined($resultat)) { + printf("ERROR: Status get : %s.\n", $session->error); + $session->close; + exit $ERRORS{"UNKNOWN"}; +} +my $resultat2 = undef; +$resultat2 + = (version->parse(Net::SNMP->VERSION) < 4) + ? $session->get_request(@oid_list2) + : $session->get_request(-varbindlist => \@oid_list2); + +if (!defined($resultat2)) { + printf("ERROR: Conn get : %s.\n", $session->error); + $session->close; + exit $ERRORS{"UNKNOWN"}; +} + +my $output = ""; +my $output_perf = ""; +my $numsvc_ok = 0; +my $output_done = 0; +my $global_status = 0; + +for (my $i = 0; $i < $numsvc; $i++) { + my $key = $index[$i]; + if ($$resultat{ $css_svc_enable . $key } == 0) { + + # service disabled + if ($output ne "") { $output .= ", "; } + $output .= $svcname[$i] . " : Disabled"; + } else { + if ($css_svc_state_nag[$$resultat{ $css_svc_state . $key }] != 0) { + + # state not OK + if ($output ne "") { $output .= ", "; } + $output .= $svcname[$i] . " : " . $css_svc_state_txt[$$resultat{ $css_svc_state . $key }]; + } else { + $numsvc_ok++; + $output_done = 0; + + # state OK + my $prctconn + = round(($$resultat2{ $css_svc_conn . $key } / $$resultat2{ $css_svc_maxconn . $key }) * 100, 0); + my $resptime = $$resultat2{ $css_svc_avgresp . $key }; + if (defined($o_warn_conn) && ($prctconn > $o_warn_conn)) { + if ($output ne "") { $output .= ", "; } + $output .= $svcname[$i] . ":" . $prctconn . "%, " . $resptime . "ms"; + set_status(1, $global_status); + $output_done = 1; + } + if (defined($o_crit_conn) && ($prctconn > $o_crit_conn)) { + if ($output_done == 0) { + $output .= $svcname[$i] . ":" . $prctconn . "%, " . $resptime . "ms"; + $output_done = 1; + } + set_status(2, $global_status); + } + if (defined($o_warn_resp) && ($prctconn > $o_warn_resp)) { + if ($output_done == 0) { + $output .= $svcname[$i] . ":" . $prctconn . "%, " . $resptime . "ms"; + $output_done = 1; + } + set_status(1, $global_status); + } + if (defined($o_crit_resp) && ($prctconn > $o_crit_resp)) { + if ($output_done == 0) { + $output .= $svcname[$i] . ":" . $prctconn . "%, " . $resptime . "ms"; + $output_done = 1; + } + set_status(2, $global_status); + } + } + } +} + +$output .= " " . $numsvc_ok . "/" . $numsvc . " services OK"; + +if (($global_status == 2) || ((defined($o_crit_number)) && ($numsvc_ok <= $o_crit_number)) || ($numsvc_ok == 0)) { + print $output, " : CRITICAL\n"; + exit $ERRORS{"CRITICAL"}; +} +if (($global_status == 1) || ((defined($o_warn_number)) && ($numsvc_ok <= $o_warn_number))) { + print $output, " : WARNING\n"; + exit $ERRORS{"WARNING"}; +} +print $output, " : OK\n"; +exit $ERRORS{"OK"}; diff --git a/plugins/check_snmp_css_main.pl b/plugins/check_snmp_css_main.pl new file mode 100755 index 0000000..3b64d67 --- /dev/null +++ b/plugins/check_snmp_css_main.pl @@ -0,0 +1,306 @@ +#!/usr/bin/perl -w +############################## check_snmp_css_main.pl ################# +# Version : 1.0 +# Date : 27 Sept 2006 +# Author : Patrick Proy ( patrick at proy.org) +# Help : http://www.manubulon.com/nagios/ +# License : GPL - http://www.fsf.org/licenses/gpl.txt +# Changelog : +# Contributors : +################################################################# +# +# Help : ./check_snmp_css.pl -h +# + +use strict; +use Net::SNMP; +use Getopt::Long; + +# Icinga specific +my %ERRORS = ('OK' => 0, 'WARNING' => 1, 'CRITICAL' => 2, 'UNKNOWN' => 3, 'DEPENDENT' => 4); + +# SNMP Datas + +my $css_svc_table = "1.3.6.1.4.1.9.9.368.1.15.2.1"; # Svc table +my $css_svc_name = "1.3.6.1.4.1.9.9.368.1.15.2.1.1"; # Service Name / apSvcName +my $css_svc_index = "1.3.6.1.4.1.9.9.368.1.15.2.1.2"; # apSvcIndex +my $css_svc_enable = "1.3.6.1.4.1.9.9.368.1.15.2.1.12"; # apSvcEnable +my $css_svc_state = "1.3.6.1.4.1.9.9.368.1.15.2.1.17"; # apSvcState : suspended(1), down(2), alive(4), dying(5) +my $css_svc_maxconn = "1.3.6.1.4.1.9.9.368.1.15.2.1.19"; # Max connexions / apSvcMaxConnections +my $css_svc_conn = "1.3.6.1.4.1.9.9.368.1.15.2.1.20"; # apSvcConnections +my $css_svc_avgresp = "1.3.6.1.4.1.9.9.368.1.15.2.1.65"; # apSvcAvgResponseTime : average response time +my $css_svc_maxresp = "1.3.6.1.4.1.9.9.368.1.15.2.1.66"; # apSvcPeakAvgResponseTime : peak response time +my @css_svc_state_txt = ("", "suspended", "down", "", "alive", "dying"); +my @css_svc_state_nag = (3, 2, 2, 3, 0, 2); + +# Globals + +my $VERSION = "2.0.0"; + +my $o_host = undef; # hostname +my $o_community = undef; # community +my $o_port = 161; # port +my $o_help = undef; # wan't some help ? +my $o_verb = undef; # verbose mode +my $o_version = undef; # print version +my $o_timeout = undef; # Timeout (Default 5) +my $o_version2 = undef; # use snmp v2c + +#Specific +my $o_dir = "/tmp/"; # Directory to store temp file in it. + +# SNMPv3 specific +my $o_login = undef; # Login for snmpv3 +my $o_passwd = undef; # Pass for snmpv3 +my $v3protocols = undef; # V3 protocol list. +my $o_authproto = 'md5'; # Auth protocol +my $o_privproto = 'des'; # Priv protocol +my $o_privpass = undef; # priv password + +# functions + +sub p_version { print "check_snmp_css_main version : $VERSION\n"; } + +sub print_usage { + print +"Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-d directory] [-p ] [-t ] [-V]\n"; +} + +sub help { + print "\nSNMP Cisco CSS monitor MAIN script for Icinga/Nagios/Naemon/Shinken, Version ", $VERSION, "\n"; + print "GPL License, (c)2004-2006 Patrick Proy\n\n"; + print_usage(); + print < + Directory where temp file with index is written +-C, --community=COMMUNITY NAME + community name for the host's SNMP agent (implies v1 protocol) +-2, --v2c + Use snmp v2c +-l, --login=LOGIN ; -x, --passwd=PASSWD + Login and auth password for snmpv3 authentication + If no priv password exists, implies AuthNoPriv +-X, --privpass=PASSWD + Priv password for snmpv3 (AuthPriv protocol) +-L, --protocols=, + : Authentication protocol (md5|sha : default md5) + : Priv protocole (des|aes : default des) +-P, --port=PORT + SNMP port (Default 161) +-t, --timeout=INTEGER + timeout for SNMP in seconds (Default: 5) +-V, --version + prints version number +EOT +} + +# For verbose output +sub verb { my $t = shift; print $t, "\n" if defined($o_verb); } + +sub check_options { + Getopt::Long::Configure("bundling"); + GetOptions( + 'v' => \$o_verb, + 'verbose' => \$o_verb, + 'h' => \$o_help, + 'help' => \$o_help, + 'H:s' => \$o_host, + 'hostname:s' => \$o_host, + 'p:i' => \$o_port, + 'port:i' => \$o_port, + 'C:s' => \$o_community, + 'community:s' => \$o_community, + 'l:s' => \$o_login, + 'login:s' => \$o_login, + 'x:s' => \$o_passwd, + 'passwd:s' => \$o_passwd, + 'X:s' => \$o_privpass, + 'privpass:s' => \$o_privpass, + 'L:s' => \$v3protocols, + 'protocols:s' => \$v3protocols, + 't:i' => \$o_timeout, + 'timeout:i' => \$o_timeout, + 'V' => \$o_version, + 'version' => \$o_version, + '2' => \$o_version2, + 'v2c' => \$o_version2, + 'd:s' => \$o_dir, + 'dir:s' => \$o_dir + ); + + # Basic checks + if (defined($o_timeout) && (isnnum($o_timeout) || ($o_timeout < 2) || ($o_timeout > 60))) { + print "Timeout must be >1 and <60 !\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (!defined($o_timeout)) { $o_timeout = 5; } + if (defined($o_help)) { help(); exit $ERRORS{"UNKNOWN"} } + if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"} } + if (!defined($o_host)) # check host and filter + { + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + + # check snmp information + if (!defined($o_community) && (!defined($o_login) || !defined($o_passwd))) { + print "Put snmp login info!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if ((defined($o_login) || defined($o_passwd)) && (defined($o_community) || defined($o_version2))) { + print "Can't mix snmp v1,2c,3 protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (defined($v3protocols)) { + if (!defined($o_login)) { + print "Put snmp V3 login info with protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + my @v3proto = split(/,/, $v3protocols); + if ((defined($v3proto[0])) && ($v3proto[0] ne "")) { $o_authproto = $v3proto[0]; } # Auth protocol + if (defined($v3proto[1])) { $o_privproto = $v3proto[1]; } # Priv protocol + if ((defined($v3proto[1])) && (!defined($o_privpass))) { + print "Put snmp V3 priv login info with priv protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + } + if (defined($o_dir)) { + verb("Tmp directory : $o_dir"); + } +} + +########## MAIN ####### + +check_options(); + +# Check timeout if snmp screws up +if (defined($o_timeout)) { + verb("Alarm in $o_timeout seconds"); + alarm($o_timeout); +} + +$SIG{'ALRM'} = sub { + print "No answer from host $o_host:$o_port\n"; + exit $ERRORS{"UNKNOWN"}; +}; + +# Connect to host +my ($session, $error); +if (defined($o_login) && defined($o_passwd)) { + + # SNMPv3 login + verb("SNMPv3 login"); + if (!defined($o_privpass)) { + verb("SNMPv3 AuthNoPriv login : $o_login, $o_authproto"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => '3', + -username => $o_login, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, + -timeout => $o_timeout + ); + } else { + verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => '3', + -username => $o_login, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, + -privpassword => $o_privpass, + -privprotocol => $o_privproto, + -timeout => $o_timeout + ); + } +} else { + if (defined($o_version2)) { + + # SNMPv2 Login + verb("SNMP v2c login"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => 2, + -community => $o_community, + -port => $o_port, + -timeout => $o_timeout + ); + } else { + + # SNMPV1 login + verb("SNMP v1 login"); + ($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 $ERRORS{"UNKNOWN"}; +} +$session->max_msg_size(10000); + +########### Cisco CSS checks ############## + +# Get load table +my $resultat + = (version->parse(Net::SNMP->VERSION) < 4) + ? $session->get_table($css_svc_name) + : $session->get_table(Baseoid => $css_svc_name); + +if (!defined($resultat)) { + printf("ERROR: Name table : %s.\n", $session->error); + $session->close; + exit $ERRORS{"UNKNOWN"}; +} + +# Get name data & index +my (@index, @svcname) = (undef, undef); +my $numsvc = 0; +foreach my $key (keys %$resultat) { + verb("OID : $key, Desc : $$resultat{$key}"); + $svcname[$numsvc] = $$resultat{$key}; + $key =~ s/$css_svc_name//; + verb("Found : $svcname[$numsvc]"); + $index[$numsvc++] = $key; +} + +# Write file + +my $file_name = $o_dir . "/Nagios_css_" . $o_host; +my $file_lock = $file_name . ".lock"; + +# First, make a lock file +system("touch $file_lock"); + +# allow scripts to finish reading file +sleep(0.5); + +# create the file +if (!open(FILE, "> " . $file_name)) { + print "Cannot write $file_name\n"; + unlink($file_lock); + exit $ERRORS{"UNKNOWN"}; +} +for (my $i = 0; $i < $numsvc; $i++) { + my $output = $index[$i] . ":" . $svcname[$i] . "\n"; + print FILE $output; +} +close(FILE); +unlink($file_lock); +print "Found $numsvc services : OK\n"; +exit $ERRORS{"OK"}; diff --git a/plugins/check_snmp_env.pl b/plugins/check_snmp_env.pl new file mode 100755 index 0000000..bf4d2ee --- /dev/null +++ b/plugins/check_snmp_env.pl @@ -0,0 +1,1111 @@ +#!/usr/bin/perl -w +############################## check_snmp_env ################# +# Version : 1.3 +# Date : May 24 2007 +# Author : Patrick Proy ( patrick at proy.org) +# Help : http://www.manubulon.com/nagios/ +# License : GPL - http://www.fsf.org/licenses/gpl.txt +# Changelog : +# Contributors : Fredrik Vocks +################################################################# +# +# Help : ./check_snmp_env.pl -h +# + +use strict; +use Net::SNMP; +use Getopt::Long; + +# Icinga specific +my $TIMEOUT = 15; +my %ERRORS = ('OK' => 0, 'WARNING' => 1, 'CRITICAL' => 2, 'UNKNOWN' => 3, 'DEPENDENT' => 4); + +my @Nagios_state = ("UNKNOWN", "OK", "WARNING", "CRITICAL"); # Nagios states coding + +# SNMP Datas + +# CISCO-ENVMON-MIB +my $ciscoEnvMonMIB = "1.3.6.1.4.1.9.9.13"; # Cisco env base table +my %CiscoEnvMonState + = (1, "normal", 2, "warning", 3, "critical", 4, "shutdown", 5, "notPresent", 6, "notFunctioning"); # Cisco states +my %CiscoEnvMonNagios + = (1, 1, 2, 2, 3, 3, 4, 3, 5, 0, 6, 3); # Nagios states returned for CIsco states (coded see @Nagios_state). +my $ciscoVoltageTable = $ciscoEnvMonMIB . ".1.2.1"; # Cisco voltage table +my $ciscoVoltageTableIndex = $ciscoVoltageTable . ".1"; #Index table +my $ciscoVoltageTableDesc = $ciscoVoltageTable . ".2"; #Description +my $ciscoVoltageTableValue = $ciscoVoltageTable . ".3"; #Value +my $ciscoVoltageTableState = $ciscoVoltageTable . ".7"; #Status + +# CiscoEnvMonVoltageStatusEntry ::= +# 1 ciscoEnvMonVoltageStatusIndex Integer32 (0..2147483647), +# 2 ciscoEnvMonVoltageStatusDescr DisplayString, +# 3 ciscoEnvMonVoltageStatusValue CiscoSignedGauge, +# 4 ciscoEnvMonVoltageThresholdLow Integer32, +# 5 ciscoEnvMonVoltageThresholdHigh Integer32, +# 6 ciscoEnvMonVoltageLastShutdown Integer32, +# 7 ciscoEnvMonVoltageState CiscoEnvMonState +my $ciscoTempTable = $ciscoEnvMonMIB . ".1.3.1"; # Cisco temprature table +my $ciscoTempTableIndex = $ciscoTempTable . ".1"; #Index table +my $ciscoTempTableDesc = $ciscoTempTable . ".2"; #Description +my $ciscoTempTableValue = $ciscoTempTable . ".3"; #Value +my $ciscoTempTableState = $ciscoTempTable . ".6"; #Status + +# CiscoEnvMonTemperatureStatusEntry ::= +# ciscoEnvMonTemperatureStatusIndex Integer32 (0..2147483647), +# ciscoEnvMonTemperatureStatusDescr DisplayString, +# ciscoEnvMonTemperatureStatusValue Gauge32, +# ciscoEnvMonTemperatureThreshold Integer32, +# ciscoEnvMonTemperatureLastShutdown Integer32, +# ciscoEnvMonTemperatureState CiscoEnvMonState +my $ciscoFanTable = $ciscoEnvMonMIB . ".1.4.1"; # Cisco fan table +my $ciscoFanTableIndex = $ciscoFanTable . ".1"; #Index table +my $ciscoFanTableDesc = $ciscoFanTable . ".2"; #Description +my $ciscoFanTableState = $ciscoFanTable . ".3"; #Status + +# CiscoEnvMonFanStatusEntry ::= +# ciscoEnvMonFanStatusIndex Integer32 (0..2147483647), +# ciscoEnvMonFanStatusDescr DisplayString, +# ciscoEnvMonFanState CiscoEnvMonState +my $ciscoPSTable = $ciscoEnvMonMIB . ".1.5.1"; # Cisco power supply table +my $ciscoPSTableIndex = $ciscoPSTable . ".1"; #Index table +my $ciscoPSTableDesc = $ciscoPSTable . ".2"; #Description +my $ciscoPSTableState = $ciscoPSTable . ".3"; #Status + +# CiscoEnvMonSupplyStatusEntry ::= +# ciscoEnvMonSupplyStatusIndex Integer32 (0..2147483647), +# ciscoEnvMonSupplyStatusDescr DisplayString, +# ciscoEnvMonSupplyState CiscoEnvMonState, +# ciscoEnvMonSupplySource INTEGER + +# Nokia env mib +my $nokia_temp_tbl = "1.3.6.1.4.1.94.1.21.1.1.5"; +my $nokia_temp = "1.3.6.1.4.1.94.1.21.1.1.5.0"; +my $nokia_fan_table = "1.3.6.1.4.1.94.1.21.1.2"; +my $nokia_fan_status = "1.3.6.1.4.1.94.1.21.1.2.1.1.2"; +my $nokia_ps_table = "1.3.6.1.4.1.94.1.21.1.3"; +my $nokia_ps_temp = "1.3.6.1.4.1.94.1.21.1.3.1.1.2"; +my $nokia_ps_status = "1.3.6.1.4.1.94.1.21.1.3.1.1.3"; + +# Bluecoat env mib +my @bc_SensorCode = ( + "", "ok", "unknown", "not-installed", + "voltage-low-warning", "voltage-low-critical", "no-power", "voltage-high-warning", + "voltage-high-critical", "voltage-high-severe", "temperature-high-warning", "temperature-high-critical", + "temperature-high-severe", "fan-slow-warning", "fan-slow-critical", "fan-stopped" +); # BC element status returned by MIB +my @bc_status_nagios = (3, 0, 3, 3, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2); # nagios status equivallent to BC status +my @bc_SensorStatus = ("", "ok", "unavailable", "nonoperational"); # ok(1),unavailable(2),nonoperational(3) +my @bc_mesure = ("", "", "", "Enum", "volts", "celsius", "rpm"); + +my @bc_DiskStatus + = ("", "present", "initializing", "inserted", "offline", "removed", "not-present", "empty", "bad", "unknown"); +my @bc_dsk_status_nagios = (3, 0, 0, 1, 1, 1, 2, 2, 2, 3); + +my $bc_sensor_table = "1.3.6.1.4.1.3417.2.1.1.1.1.1"; # sensor table +my $bc_sensor_units = "1.3.6.1.4.1.3417.2.1.1.1.1.1.3"; # cf bc_mesure +my $bc_sensor_Scale = "1.3.6.1.4.1.3417.2.1.1.1.1.1.4"; # * 10^value +my $bc_sensor_Value = "1.3.6.1.4.1.3417.2.1.1.1.1.1.5"; # value +my $bc_sensor_Code = "1.3.6.1.4.1.3417.2.1.1.1.1.1.6"; # bc_SensorCode +my $bc_sensor_Status = "1.3.6.1.4.1.3417.2.1.1.1.1.1.7"; # bc_SensorStatus +my $bc_sensor_Name = "1.3.6.1.4.1.3417.2.1.1.1.1.1.9"; # name + +my $bc_dsk_table = "1.3.6.1.4.1.3417.2.2.1.1.1.1"; #disk table +my $bc_dsk_status = "1.3.6.1.4.1.3417.2.2.1.1.1.1.3"; # cf bc_DiskStatus +my $bc_dsk_vendor = "1.3.6.1.4.1.3417.2.2.1.1.1.1.5"; # cf bc_DiskStatus +my $bc_dsk_serial = "1.3.6.1.4.1.3417.2.2.1.1.1.1.8"; # cf bc_DiskStatus + +# Ironport env mib + +my $iron_ps_table = "1.3.6.1.4.1.15497.1.1.1.8"; # ps table +my $iron_ps_status = "1.3.6.1.4.1.15497.1.1.1.8.1.2"; # ps status + +#powerSupplyNotInstalled(1), powerSupplyHealthy(2), powerSupplyNoAC(3), powerSupplyFaulty(4) +my @iron_ps_status_name = ("", "powerSupplyNotInstalled", "powerSupplyHealthy", "powerSupplyNoAC", "powerSupplyFaulty"); +my @iron_ps_status_nagios = (3, 3, 0, 2, 2); +my $iron_ps_ha = "1.3.6.1.4.1.15497.1.1.1.8.1.3"; # ps redundancy status + +#powerSupplyRedundancyOK(1), powerSupplyRedundancyLost(2) +my @iron_ps_ha_name = ("", "powerSupplyRedundancyOK", "powerSupplyRedundancyLost"); +my @iron_ps_ha_nagios = (3, 0, 1); +my $iron_ps_name = "1.3.6.1.4.1.15497.1.1.1.8.1.4"; # ps name + +my $iron_tmp_table = "1.3.6.1.4.1.15497.1.1.1.9"; # temp table +my $iron_tmp_celcius = "1.3.6.1.4.1.15497.1.1.1.9.1.2"; # temp in celcius +my $iron_tmp_name = "1.3.6.1.4.1.15497.1.1.1.9.1.3"; # name + +my $iron_fan_table = "1.3.6.1.4.1.15497.1.1.1.10"; # fan table +my $iron_fan_rpm = "1.3.6.1.4.1.15497.1.1.1.10.1.2"; # fan speed in RPM +my $iron_fan_name = "1.3.6.1.4.1.15497.1.1.1.10.1.3"; # fan name + +# Foundry BigIron Router Switch (FOUNDRY-SN-AGENT-MIB) + +my $foundry_temp = "1.3.6.1.4.1.1991.1.1.1.1.18.0"; # Chassis temperature in Deg C *2 +my $foundry_temp_warn = "1.3.6.1.4.1.1991.1.1.1.1.19.0"; # Chassis warn temperature in Deg C *2 +my $foundry_temp_crit = "1.3.6.1.4.1.1991.1.1.1.1.20.0"; # Chassis warn temperature in Deg C *2 +my $foundry_ps_table = "1.3.6.1.4.1.1991.1.1.1.2.1"; # PS table +my $foundry_ps_desc = "1.3.6.1.4.1.1991.1.1.1.2.1.1.2"; # PS desc +my $foundry_ps_status = "1.3.6.1.4.1.1991.1.1.1.2.1.1.3"; # PS status +my $foundry_fan_table = "1.3.6.1.4.1.1991.1.1.1.3.1"; # FAN table +my $foundry_fan_desc = "1.3.6.1.4.1.1991.1.1.1.3.1.1.2"; # FAN desc +my $foundry_fan_status = "1.3.6.1.4.1.1991.1.1.1.3.1.1.3"; # FAN status + +my @foundry_status = (3, 0, 2); # oper status : 1:other, 2: Normal, 3: Failure + +# Linux Net-SNMP with LM-SENSORS +my $linux_temp = "1.3.6.1.4.1.2021.13.16.2.1"; # temperature table +my $linux_temp_descr = "1.3.6.1.4.1.2021.13.16.2.1.2"; # temperature entry description +my $linux_temp_value = "1.3.6.1.4.1.2021.13.16.2.1.3"; # temperature entry value (mC) +my $linux_fan = "1.3.6.1.4.1.2021.13.16.3.1"; # fan table +my $linux_fan_descr = "1.3.6.1.4.1.2021.13.16.3.1.2"; # fan entry description +my $linux_fan_value = "1.3.6.1.4.1.2021.13.16.3.1.3"; # fan entry value (RPM) +my $linux_volt = "1.3.6.1.4.1.2021.13.16.4.1"; # voltage table +my $linux_volt_descr = "1.3.6.1.4.1.2021.13.16.4.1.2"; # voltage entry description +my $linux_volt_value = "1.3.6.1.4.1.2021.13.16.4.1.3"; # voltage entry value (mV) +my $linux_misc = "1.3.6.1.4.1.2021.13.16.4.1"; # misc table +my $linux_misc_descr = "1.3.6.1.4.1.2021.13.16.4.1.2"; # misc entry description +my $linux_misc_value = "1.3.6.1.4.1.2021.13.16.4.1.3"; # misc entry value + +# Globals + +my $VERSION = "2.0.0"; + +my $o_host = undef; # hostname +my $o_community = undef; # community +my $o_port = 161; # port +my $o_help = undef; # wan't some help ? +my $o_verb = undef; # verbose mode +my $o_version = undef; # print version +my $o_timeout = undef; # Timeout (Default 5) +my $o_perf = undef; # Output performance data +my $o_version2 = undef; # use snmp v2c + +# check type +my $o_check_type = "cisco"; # default Cisco +my @valid_types = ("cisco", "nokia", "bc", "iron", "foundry", "linux"); +my $o_temp = undef; # max temp +my $o_fan = undef; # min fan speed + +# SNMPv3 specific +my $o_login = undef; # Login for snmpv3 +my $o_passwd = undef; # Pass for snmpv3 +my $v3protocols = undef; # V3 protocol list. +my $o_authproto = 'md5'; # Auth protocol +my $o_privproto = 'des'; # Priv protocol +my $o_privpass = undef; # priv password + +# functions + +sub p_version { print "check_snmp_env version : $VERSION\n"; } + +sub print_usage { + print +"Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -T (cisco|nokia|bc|iron|foundry|linux) [-F ] [-c ] [-f] [-t ] [-V]\n"; +} + +sub isnnum { # Return true if arg is not a number + my $num = shift; + if ($num =~ /^(\d+\.?\d*)|(^\.\d+)$/) { return 0; } + return 1; +} + +sub set_status { # return worst status with this order : OK, unknwonw, warning, critical + my $new_status = shift; + my $cur_status = shift; + if (($cur_status == 0) || ($new_status == $cur_status)) { return $new_status; } + if ($new_status == 3) { return $cur_status; } + if ($new_status > $cur_status) { return $new_status; } + return $cur_status; +} + +sub help { + print "\nSNMP environmental Monitor for Icinga/Nagios/Naemon/Shinken, Version ", $VERSION, "\n"; + print "GPL License, (c)2006-2007 Patrick Proy\n\n"; + print_usage(); + print <, + : Authentication protocol (md5|sha : default md5) + : Priv protocole (des|aes : default des) +-P, --port=PORT + SNMP port (Default 161) +-T, --type=cisco|nokia|bc|iron|foundry + Environemental check : + cisco : All Cisco equipements : voltage,temp,fan,power supply + (will try to check everything in the env mib) + nokia : Nokia IP platforms : fan and power supply + bc : BlueCoat platforms : fans, power supply, voltage, disks + iron : IronPort platforms : fans, power supply, temp + foundry : Foundry Network platforms : power supply, temp + linux : Net-SNMP with LM-SENSORS : temp, fan, volt, misc +-F, --fan= + Minimum fan rpm value (only needed for 'iron' & 'linux') +-c, --celcius= + Maximum temp in degree celcius (only needed for 'iron' & 'linux') +-f, --perfparse + Perfparse compatible output +-t, --timeout=INTEGER + timeout for SNMP in seconds (Default: 5) +-V, --version + prints version number +EOT +} + +# For verbose output +sub verb { my $t = shift; print $t, "\n" if defined($o_verb); } + +sub check_options { + Getopt::Long::Configure("bundling"); + GetOptions( + 'v' => \$o_verb, + 'verbose' => \$o_verb, + 'h' => \$o_help, + 'help' => \$o_help, + 'H:s' => \$o_host, + 'hostname:s' => \$o_host, + 'p:i' => \$o_port, + 'port:i' => \$o_port, + 'C:s' => \$o_community, + 'community:s' => \$o_community, + 'l:s' => \$o_login, + 'login:s' => \$o_login, + 'x:s' => \$o_passwd, + 'passwd:s' => \$o_passwd, + 'X:s' => \$o_privpass, + 'privpass:s' => \$o_privpass, + 'L:s' => \$v3protocols, + 'protocols:s' => \$v3protocols, + 't:i' => \$o_timeout, + 'timeout:i' => \$o_timeout, + 'V' => \$o_version, + 'version' => \$o_version, + + '2' => \$o_version2, + 'v2c' => \$o_version2, + 'f' => \$o_perf, + 'perfparse' => \$o_perf, + 'T:s' => \$o_check_type, + 'type:s' => \$o_check_type, + 'F:i' => \$o_fan, + 'fan:i' => \$o_fan, + 'c:i' => \$o_temp, + 'celcius:i' => \$o_temp + ); + + # check the -T option + my $T_option_valid = 0; + foreach (@valid_types) { + if ($_ eq $o_check_type) { $T_option_valid = 1 } + } + if ($T_option_valid == 0) { print "Invalid check type (-T)!\n"; print_usage(); exit $ERRORS{"UNKNOWN"} } + + # Basic checks + if (defined($o_timeout) && (isnnum($o_timeout) || ($o_timeout < 2) || ($o_timeout > 60))) { + print "Timeout must be >1 and <60 !\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (!defined($o_timeout)) { $o_timeout = 5; } + if (defined($o_help)) { help(); exit $ERRORS{"UNKNOWN"} } + if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"} } + if (!defined($o_host)) # check host and filter + { + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + + # check snmp information + if (!defined($o_community) && (!defined($o_login) || !defined($o_passwd))) { + print "Put snmp login info!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if ((defined($o_login) || defined($o_passwd)) && (defined($o_community) || defined($o_version2))) { + print "Can't mix snmp v1,2c,3 protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (defined($v3protocols)) { + if (!defined($o_login)) { + print "Put snmp V3 login info with protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + my @v3proto = split(/,/, $v3protocols); + if ((defined($v3proto[0])) && ($v3proto[0] ne "")) { $o_authproto = $v3proto[0]; } # Auth protocol + if (defined($v3proto[1])) { $o_privproto = $v3proto[1]; } # Priv protocol + if ((defined($v3proto[1])) && (!defined($o_privpass))) { + print "Put snmp V3 priv login info with priv protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + } +} + +########## MAIN ####### + +check_options(); + +# Check gobal timeout if snmp screws up +if (defined($TIMEOUT)) { + verb("Alarm at $TIMEOUT + 5"); + alarm($TIMEOUT + 5); +} else { + verb("no global timeout defined : $o_timeout + 10"); + alarm($o_timeout + 10); +} + +$SIG{'ALRM'} = sub { + print "No answer from host\n"; + exit $ERRORS{"UNKNOWN"}; +}; + +# Connect to host +my ($session, $error); +if (defined($o_login) && defined($o_passwd)) { + + # SNMPv3 login + verb("SNMPv3 login"); + if (!defined($o_privpass)) { + verb("SNMPv3 AuthNoPriv login : $o_login, $o_authproto"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => '3', + -username => $o_login, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, + -timeout => $o_timeout + ); + } else { + verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => '3', + -username => $o_login, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, + -privpassword => $o_privpass, + -privprotocol => $o_privproto, + -timeout => $o_timeout + ); + } +} else { + if (defined($o_version2)) { + + # SNMPv2 Login + verb("SNMP v2c login"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => 2, + -community => $o_community, + -port => $o_port, + -timeout => $o_timeout + ); + } else { + + # SNMPV1 login + verb("SNMP v1 login"); + ($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 $ERRORS{"UNKNOWN"}; +} + +my $exit_val = undef; +########### Cisco env checks ############## + +if ($o_check_type eq "cisco") { + + verb("Checking cisco env"); + + # Get load table + my $resultat + = (version->parse(Net::SNMP->VERSION) < 4) + ? $session->get_table($ciscoEnvMonMIB) + : $session->get_table(Baseoid => $ciscoEnvMonMIB); + + if (!defined($resultat)) { + printf("ERROR: Description table : %s.\n", $session->error); + $session->close; + exit $ERRORS{"UNKNOWN"}; + } + $session->close; + + # Get env data index + my (@voltindex, @tempindex, @fanindex, @psindex) = (undef, undef, undef, undef); + my ($voltexist, $tempexist, $fanexist, $psexist) = (0, 0, 0, 0); + my @oid = undef; + foreach my $key (keys %$resultat) { + verb("OID : $key, Desc : $$resultat{$key}"); + if ($key =~ /$ciscoVoltageTableDesc/) { + @oid = split(/\./, $key); + $voltindex[$voltexist++] = pop(@oid); + } + if ($key =~ /$ciscoTempTableDesc/) { + @oid = split(/\./, $key); + $tempindex[$tempexist++] = pop(@oid); + } + if ($key =~ /$ciscoFanTableDesc/) { + @oid = split(/\./, $key); + $fanindex[$fanexist++] = pop(@oid); + } + if ($key =~ /$ciscoPSTableDesc/) { + @oid = split(/\./, $key); + $psindex[$psexist++] = pop(@oid); + } + } + + if (($voltexist == 0) && ($tempexist == 0) && ($fanexist == 0) && ($psexist == 0)) { + print "No Environemental data found : UNKNOWN"; + exit $ERRORS{"UNKNOWN"}; + } + + my $perf_output = ""; + + # Get the data + my ($i, $cur_status) = (undef, undef); + + my $volt_global = 0; + my %volt_status; + if ($fanexist != 0) { + for ($i = 0; $i < $voltexist; $i++) { + $cur_status = $$resultat{ $ciscoVoltageTableState . "." . $voltindex[$i] }; + verb($$resultat{ $ciscoVoltageTableDesc . "." . $voltindex[$i] }); + verb($cur_status); + if (!defined($cur_status)) { ### Error TODO + $volt_global = 1; + } + if (defined($$resultat{ $ciscoVoltageTableValue . "." . $voltindex[$i] })) { + $perf_output .= " '" . $$resultat{ $ciscoVoltageTableDesc . "." . $voltindex[$i] } . "'="; + $perf_output .= $$resultat{ $ciscoVoltageTableValue . "." . $voltindex[$i] }; + } + if ($Nagios_state[$CiscoEnvMonNagios{$cur_status}] ne "OK") { + $volt_global = 1; + $volt_status{ $$resultat{ $ciscoVoltageTableDesc . "." . $voltindex[$i] } } = $cur_status; + } + } + } + + my $temp_global = 0; + my %temp_status; + if ($tempexist != 0) { + for ($i = 0; $i < $tempexist; $i++) { + $cur_status = $$resultat{ $ciscoTempTableState . "." . $tempindex[$i] }; + verb($$resultat{ $ciscoTempTableDesc . "." . $tempindex[$i] }); + verb($cur_status); + if (!defined($cur_status)) { ### Error TODO + $temp_global = 1; + } + if (defined($$resultat{ $ciscoTempTableValue . "." . $tempindex[$i] })) { + $perf_output .= " '" . $$resultat{ $ciscoTempTableDesc . "." . $tempindex[$i] } . "'="; + $perf_output .= $$resultat{ $ciscoTempTableValue . "." . $tempindex[$i] }; + } + if ($Nagios_state[$CiscoEnvMonNagios{$cur_status}] ne "OK") { + $temp_global = 1; + $temp_status{ $$resultat{ $ciscoTempTableDesc . "." . $tempindex[$i] } } = $cur_status; + } + } + } + + my $fan_global = 0; + my %fan_status; + if ($fanexist != 0) { + for ($i = 0; $i < $fanexist; $i++) { + $cur_status = $$resultat{ $ciscoFanTableState . "." . $fanindex[$i] }; + verb($$resultat{ $ciscoFanTableDesc . "." . $fanindex[$i] }); + verb($cur_status); + if (!defined($cur_status)) { ### Error TODO + $fan_global = 1; + } + if ($Nagios_state[$CiscoEnvMonNagios{$cur_status}] ne "OK") { + $fan_global = 1; + $fan_status{ $$resultat{ $ciscoFanTableDesc . "." . $fanindex[$i] } } = $cur_status; + } + } + } + + my $ps_global = 0; + my %ps_status; + if ($psexist != 0) { + for ($i = 0; $i < $psexist; $i++) { + $cur_status = $$resultat{ $ciscoPSTableState . "." . $psindex[$i] }; + if (!defined($cur_status)) { ### Error TODO + $fan_global = 1; + } + if ($Nagios_state[$CiscoEnvMonNagios{$cur_status}] ne "OK") { + $ps_global = 1; + $ps_status{ $$resultat{ $ciscoPSTableDesc . "." . $psindex[$i] } } = $cur_status; + } + } + } + + my $global_state = 0; + my $output = ""; + + if ($fanexist != 0) { + if ($fan_global == 0) { + $output .= $fanexist . " Fan OK"; + $global_state = 1 if ($global_state == 0); + } else { + foreach (keys %fan_status) { + $output .= "Fan " . $_ . ":" . $CiscoEnvMonState{ $fan_status{$_} } . " "; + if ($global_state < $CiscoEnvMonNagios{ $fan_status{$_} }) { + $global_state = $CiscoEnvMonNagios{ $fan_status{$_} }; + } + } + } + } + + if ($psexist != 0) { + $output .= ", " if ($output ne ""); + if ($ps_global == 0) { + $output .= $psexist . " ps OK"; + $global_state = 1 if ($global_state == 0); + } else { + foreach (keys %ps_status) { + $output .= "ps " . $_ . ":" . $CiscoEnvMonState{ $ps_status{$_} } . " "; + if ($global_state < $CiscoEnvMonNagios{ $ps_status{$_} }) { + $global_state = $CiscoEnvMonNagios{ $ps_status{$_} }; + } + } + } + } + + if ($voltexist != 0) { + $output .= ", " if ($output ne ""); + if ($volt_global == 0) { + $output .= $voltexist . " volt OK"; + $global_state = 1 if ($global_state == 0); + } else { + foreach (keys %volt_status) { + $output .= "volt " . $_ . ":" . $CiscoEnvMonState{ $volt_status{$_} } . " "; + if ($global_state < $CiscoEnvMonNagios{ $volt_status{$_} }) { + $global_state = $CiscoEnvMonNagios{ $volt_status{$_} }; + } + } + } + } + + if ($tempexist != 0) { + $output .= ", " if ($output ne ""); + if ($temp_global == 0) { + $output .= $tempexist . " temp OK"; + $global_state = 1 if ($global_state == 0); + } else { + foreach (keys %temp_status) { + $output .= "temp " . $_ . ":" . $CiscoEnvMonState{ $temp_status{$_} } . " "; + if ($global_state < $CiscoEnvMonNagios{ $temp_status{$_} }) { + $global_state = $CiscoEnvMonNagios{ $temp_status{$_} }; + } + } + } + } + + #print $output," : ",$Nagios_state[$global_state]," | ",$perf_output,"\n"; + print $output, " : ", $Nagios_state[$global_state], "\n"; + $exit_val = $ERRORS{ $Nagios_state[$global_state] }; + + exit $exit_val; + +} + +############# Nokia checks +if ($o_check_type eq "nokia") { + + verb("Checking nokia env"); + + my $resultat; + + # status : 0=ok, 1=nok, 2=temp prb + my ($fan_status, $ps_status, $temp_status) = (0, 0, 0); + my ($fan_exist, $ps_exist, $temp_exist) = (0, 0, 0); + my ($num_fan, $num_ps) = (0, 0); + my ($num_fan_nok, $num_ps_nok) = (0, 0); + my $global_status = 0; + my $output = ""; + + # get temp + $resultat + = (version->parse(Net::SNMP->VERSION) < 4) + ? $session->get_table($nokia_temp_tbl) + : $session->get_table(Baseoid => $nokia_temp_tbl); + if (defined($resultat)) { + verb("temp found"); + $temp_exist = 1; + if ($$resultat{$nokia_temp} != 1) { + $temp_status = 2; + $global_status = 1; + $output = "Temp CRITICAL "; + } else { + $output = "Temp OK "; + } + } + + # Get fan table + $resultat + = (version->parse(Net::SNMP->VERSION) < 4) + ? $session->get_table($nokia_fan_table) + : $session->get_table(Baseoid => $nokia_fan_table); + + if (defined($resultat)) { + $fan_exist = 1; + foreach my $key (keys %$resultat) { + verb("OID : $key, Desc : $$resultat{$key}"); + if ($key =~ /$nokia_fan_status/) { + if ($$resultat{$key} != 1) { $fan_status = 1; $num_fan_nok++ } + $num_fan++; + } + } + if ($fan_status == 0) { + $output .= ", " . $num_fan . " fan OK"; + } else { + $output .= ", " . $num_fan_nok . "/" . $num_fan . " fan CRITICAL"; + $global_status = 2; + } + } + + # Get ps table + $resultat + = (version->parse(Net::SNMP->VERSION) < 4) + ? $session->get_table($nokia_ps_table) + : $session->get_table(Baseoid => $nokia_ps_table); + + if (defined($resultat)) { + $ps_exist = 1; + foreach my $key (keys %$resultat) { + verb("OID : $key, Desc : $$resultat{$key}"); + if ($key =~ /$nokia_ps_status/) { + if ($$resultat{$key} != 1) { $ps_status = 1; $num_ps_nok++; } + $num_ps++; + } + if ($key =~ /$nokia_ps_temp/) { + if ($$resultat{$key} != 1) { + if ($ps_status == 0) { $ps_status = 2; $num_ps_nok++; } + } + } + } + if ($ps_status == 0) { + $output .= ", " . $num_ps . " ps OK"; + } elsif ($ps_status == 2) { + $output .= ", " . $num_ps_nok . "/" . $num_ps . " ps WARNING (temp)"; + if ($global_status != 2) { $global_status = 1; } + } else { + $output .= ", " . $num_ps_nok . "/" . $num_ps . " ps CRITICAL"; + $global_status = 2; + } + } + + $session->close; + + verb("status : $global_status"); + + if (($fan_exist + $ps_exist + $temp_exist) == 0) { + print "No environemental informations found : UNKNOWN\n"; + exit $ERRORS{"UNKNOWN"}; + } + + if ($global_status == 0) { + print $output. " : all OK\n"; + exit $ERRORS{"OK"}; + } + + if ($global_status == 1) { + print $output. " : WARNING\n"; + exit $ERRORS{"WARNING"}; + } + + if ($global_status == 2) { + print $output. " : CRITICAL\n"; + exit $ERRORS{"CRITICAL"}; + } +} + +############# Bluecoat checks +if ($o_check_type eq "bc") { + + verb("Checking bluecoat env"); + + my $resultat; + my $global_status = 0; + my ($num_fan, $num_other, $num_volt, $num_temp, $num_disk) = (0, 0, 0, 0, 0); + my ($num_fan_ok, $num_other_ok, $num_volt_ok, $num_temp_ok, $num_disk_ok) = (0, 0, 0, 0, 0); + my $output = ""; + my $output_perf = ""; + + # get sensor table + $resultat + = (version->parse(Net::SNMP->VERSION) < 4) + ? $session->get_table($bc_sensor_table) + : $session->get_table(Baseoid => $bc_sensor_table); + if (defined($resultat)) { + verb("sensor table found"); + my ($sens_name, $sens_status, $sens_value, $sens_unit) = (undef, undef, undef, undef); + foreach my $key (keys %$resultat) { + if ($key =~ /$bc_sensor_Name/) { + $sens_name = $$resultat{$key}; + $key =~ s/$bc_sensor_Name//; + $sens_unit = $$resultat{ $bc_sensor_units . $key }; + if ($$resultat{ $bc_sensor_Status . $key } != 1) { # sensor not operating : output and status unknown + if ($output ne "") { $output .= ", "; } + $output .= $sens_name . " sensor " . $bc_SensorStatus[$$resultat{ $bc_sensor_Status . $key }]; + if ($global_status == 0) { $global_status = 3; } + } else { # Get status + $sens_status = $bc_status_nagios[$$resultat{ $bc_sensor_Code . $key }]; + if ($sens_status != 0) { # warn/critical/unknown : output + if ($output ne "") { $output .= ", "; } + $output .= $sens_name . ":" . $bc_SensorCode[$sens_status]; + set_status($sens_status, $global_status); + } + } + if (defined($o_perf)) { + if ($output_perf ne "") { $output_perf .= " "; } + $output_perf .= "'" . $sens_name . "'="; + my $perf_value = $$resultat{ $bc_sensor_Value . $key } * 10**$$resultat{ $bc_sensor_Scale . $key }; + $output_perf .= $perf_value; + } + ### FAN + if ($bc_mesure[$sens_unit] eq "rpm") { + $num_fan++; + if ($sens_status == 0) { $num_fan_ok++; } + } elsif ($bc_mesure[$sens_unit] eq "celsius") { + $num_fan++; + if ($sens_status == 0) { $num_temp_ok++; } + } elsif ($bc_mesure[$sens_unit] eq "volts") { + $num_volt++; + if ($sens_status == 0) { $num_volt_ok++; } + } else { + $num_other++; + if ($sens_status == 0) { $num_other_ok++; } + } + } + } + } + + # Get disk table + $resultat + = (version->parse(Net::SNMP->VERSION) < 4) + ? $session->get_table($bc_dsk_table) + : $session->get_table(Baseoid => $bc_dsk_table); + + if (defined($resultat)) { + foreach my $key (keys %$resultat) { + verb("OID : $key, Desc : $$resultat{$key}"); + my ($dsk_name, $dsk_status) = (undef, undef, undef); + if ($key =~ /$bc_dsk_status/) { + $num_disk++; + $dsk_status = $bc_dsk_status_nagios[$$resultat{$key}]; + if ($dsk_status != 0) { + $key =~ s/$bc_dsk_status//; + $dsk_name = $$resultat{ $bc_dsk_vendor . $key } . "(" . $$resultat{ $bc_dsk_serial . $key } . ")"; + if ($output ne "") { $output .= ", "; } + $output .= $dsk_name . ":" . $bc_DiskStatus[$$resultat{ $bc_dsk_status . $key }]; + set_status($dsk_status, $global_status); + } else { + $num_disk_ok++; + } + } + } + } + + if ($num_fan + $num_other + $num_volt + $num_temp + $num_disk == 0) { + print "No information found : UNKNOWN\n"; + exit $ERRORS{"UNKNOWN"}; + } + + if ($output ne "") { $output .= ", "; } + if ($num_fan_ok != 0) { $output .= $num_fan_ok . " fan OK "; } + if ($num_other_ok != 0) { $output .= $num_other_ok . " other OK "; } + if ($num_volt_ok != 0) { $output .= $num_volt_ok . " voltage OK "; } + if ($num_temp_ok != 0) { $output .= $num_temp_ok . " temp OK "; } + if ($num_disk_ok != 0) { $output .= $num_disk_ok . " disk OK "; } + + if (defined($o_perf)) { $output_perf = " | " . $output_perf; } + if ($global_status == 3) { + print $output, " : UNKNOWN", $output_perf, "\n"; + exit $ERRORS{"UNKNOWN"}; + } + if ($global_status == 2) { + print $output, " : CRITICAL", $output_perf, "\n"; + exit $ERRORS{"CRITICAL"}; + } + if ($global_status == 1) { + print $output, " : WARNING", $output_perf, "\n"; + exit $ERRORS{"WARNING"}; + } + print $output, " : OK", $output_perf, "\n"; + exit $ERRORS{"OK"}; + +} + +############# Ironport checks +if ($o_check_type eq "iron") { + + verb("Checking Ironport env"); + + my $resultat; + + # status : 0=ok, 1=warn, 2=crit + my ($fan_status, $ps_status, $temp_status) = (0, 0, 0); + my ($fan_exist, $ps_exist, $temp_exist) = (0, 0, 0); + my ($num_fan, $num_ps, $num_temp) = (0, 0, 0); + my ($num_fan_nok, $num_ps_nok, $num_temp_nok) = (0, 0, 0); + my $global_status = 0; + my $output = ""; + + # get temp if $o_temp is defined + if (defined($o_temp)) { + verb("Checking temp < $o_temp"); + $resultat + = (version->parse(Net::SNMP->VERSION) < 4) + ? $session->get_table($iron_tmp_table) + : $session->get_table(Baseoid => $iron_tmp_table); + if (defined($resultat)) { + verb("temp found"); + $temp_exist = 1; + foreach my $key (keys %$resultat) { + verb("OID : $key, Desc : $$resultat{$key}"); + if ($key =~ /$iron_tmp_celcius/) { + verb("Status : $$resultat{$key}"); + if ($$resultat{$key} > $o_temp) { + my @index_oid = split(/\./, $key); + my $index_oid_key = pop(@index_oid); + $output + .= ",Temp : " + . $$resultat{ $iron_tmp_name . "." . $index_oid_key } . " : " + . $$resultat{$key} . " C"; + $temp_status = 2; + $num_temp_nok++; + } + $num_temp++; + } + } + if ($temp_status == 0) { + $output .= ", " . $num_temp . " temp < " . $o_temp . " OK"; + } else { + $output .= ", " . $num_temp_nok . "/" . $num_temp . " temp probes CRITICAL"; + $global_status = 2; + } + } + } + + # Get fan status if $o_fan is defined + if (defined($o_fan)) { + verb("Checking fan > $o_fan"); + $resultat + = (version->parse(Net::SNMP->VERSION) < 4) + ? $session->get_table($iron_fan_table) + : $session->get_table(Baseoid => $iron_fan_table); + if (defined($resultat)) { + verb("fan found"); + $fan_exist = 1; + foreach my $key (keys %$resultat) { + verb("OID : $key, Desc : $$resultat{$key}"); + if ($key =~ /$iron_fan_rpm/) { + verb("Status : $$resultat{$key}"); + if ($$resultat{$key} < $o_fan) { + my @index_oid = split(/\./, $key); + my $index_oid_key = pop(@index_oid); + $output + .= ",Fan " + . $$resultat{ $iron_fan_name . "." . $index_oid_key } . " : " + . $$resultat{$key} . " RPM"; + $fan_status = 2; + $num_fan_nok++; + } + $num_fan++; + } + } + if ($fan_status == 0) { + $output .= ", " . $num_fan . " fan > " . $o_fan . " OK"; + } else { + $output .= ", " . $num_fan_nok . "/" . $num_fan . " fans CRITICAL"; + $global_status = 2; + } + } + } + + # Get power supply status + verb("Checking PS"); + $resultat + = (version->parse(Net::SNMP->VERSION) < 4) + ? $session->get_table($iron_ps_table) + : $session->get_table(Baseoid => $iron_ps_table); + if (defined($resultat)) { + verb("ps found"); + $ps_exist = 1; + foreach my $key (keys %$resultat) { + verb("OID : $key, Desc : $$resultat{$key}"); + if ($key =~ /$iron_ps_status/) { + verb("Status : $iron_ps_status_name[$$resultat{$key}]"); + if ($iron_ps_status_nagios[$$resultat{$key}] != 0) { + my @index_oid = split(/\./, $key); + my $index_oid_key = pop(@index_oid); + $output + .= ",PS " + . $$resultat{ $iron_ps_name . "." . $index_oid_key } . " : " + . $iron_ps_status_name[$$resultat{$key}]; + $ps_status = 2; + $num_ps_nok++; + } + $num_ps++; + } + } + if ($ps_status == 0) { + $output .= ", " . $num_ps . " ps OK"; + } else { + $output .= ", " . $num_ps_nok . "/" . $num_ps . " ps CRITICAL"; + $global_status = 2; + } + } + + $session->close; + + verb("status : $global_status"); + + if (($fan_exist + $ps_exist + $temp_exist) == 0) { + print "No environemental informations found : UNKNOWN\n"; + exit $ERRORS{"UNKNOWN"}; + } + + $output =~ s/^,//; + + if ($global_status == 0) { + print $output. " : all OK\n"; + exit $ERRORS{"OK"}; + } + + if ($global_status == 1) { + print $output. " : WARNING\n"; + exit $ERRORS{"WARNING"}; + } + + if ($global_status == 2) { + print $output. " : CRITICAL\n"; + exit $ERRORS{"CRITICAL"}; + } +} + +########### Foundry env checks ############## + +if ($o_check_type eq "foundry") { + + verb("Checking foundry env"); + + my $global_status = 0; # status to UNKNOWN + my $output = ""; + + # Get temperature + + my @foundry_temp_oid = ($foundry_temp, $foundry_temp_warn, $foundry_temp_crit); + + my $result_temp = $session->get_request(Varbindlist => \@foundry_temp_oid); + + my $temp_found = 0; + if (defined($result_temp)) { + $temp_found = 1; + + #Temp found + $output = "Temp : " . $$result_temp{$foundry_temp} / 2; + if ($$result_temp{$foundry_temp} > $$result_temp{$foundry_temp_crit}) { # Temp above critical + $output .= " > " . $$result_temp{$foundry_temp_crit} / 2 . " : CRITICAL"; + $global_status = 3; + } elsif ($$result_temp{$foundry_temp} > $$result_temp{$foundry_temp_warn}) { # Temp above warning + $output .= " > " . $$result_temp{$foundry_temp_warn} / 2 . " : WARNING"; + $global_status = 2; + } else { + $output .= " < " . $$result_temp{$foundry_temp_warn} / 2 . " : OK"; + $global_status = 1; + } + } + + # Get PS table (TODO : Bug in FAN table, see with Foundry). + + my $result_ps + = (version->parse(Net::SNMP->VERSION) < 4) + ? $session->get_table($foundry_ps_table) + : $session->get_table(Baseoid => $foundry_ps_table); + + my $ps_num = 0; + if (defined($result_ps)) { + $output .= ", " if defined($output); + foreach my $key (keys %$result_ps) { + verb("OID : $key, Desc : $$result_ps{$key}"); + if ($$result_ps{$key} =~ /$foundry_ps_desc/) { + $ps_num++; + my @oid_list = split(/\./, $key); + my $index_ps = pop(@oid_list); + $index_ps = $foundry_ps_status . "." . $index_ps; + if (defined($$result_ps{$index_ps})) { + if ($$result_ps{$index_ps} == 3) { + $output .= "PS " . $$result_ps{$key} . " : FAILURE"; + $global_status = 3; + } elsif ($$result_ps{$index_ps} == 2) { + $global_status = 1 if ($global_status == 0); + } else { + $output .= "ps " . $$result_ps{$key} . " : OTHER"; + } + } else { + $output .= "ps " . $$result_ps{$key} . " : UNDEFINED STATUS"; + } + } + } + } + + $session->close; + + if (($ps_num + $temp_found) == 0) { + print "No data found : UNKNOWN\n"; + exit $ERRORS{"UNKNOWN"}; + } + + if ($global_status == 1) { + print $output. " : all OK\n"; + exit $ERRORS{"OK"}; + } + + if ($global_status == 2) { + print $output. " : WARNING\n"; + exit $ERRORS{"WARNING"}; + } + + if ($global_status == 3) { + print $output. " : CRITICAL\n"; + exit $ERRORS{"CRITICAL"}; + } + + print $output. " : UNKNOWN\n"; + exit $ERRORS{"UNKNOWN"}; + +} + +########### Cisco env checks ############## +if ($o_check_type eq "linux") { + + verb("Checking linux env"); + + print "Not implemented yet : UNKNOWN\n"; + exit $ERRORS{"UNKNOWN"}; +} + +print "Unknown check type : UNKNOWN\n"; +exit $ERRORS{"UNKNOWN"}; diff --git a/plugins/check_snmp_int.pl b/plugins/check_snmp_int.pl new file mode 100755 index 0000000..7bebf10 --- /dev/null +++ b/plugins/check_snmp_int.pl @@ -0,0 +1,1005 @@ +#!/usr/bin/perl -w +############################## check_snmp_int ############## +my $VERSION = "2.0.0"; + +# Date : Oct 10 2007 +# Author : Patrick Proy ( patrick at proy.org ) +# Help : http://nagios.manubulon.com +# License : GPL - http://www.fsf.org/licenses/gpl.txt +# Contrib : J. Jungmann, S. Probst, R. Leroy, M. Berger +# TODO : +# Maybe put base directory for performance as an option +################################################################# +# +# Help : ./check_snmp_int.pl -h +# +use strict; +use Net::SNMP; +use Getopt::Long; + +############### BASE DIRECTORY FOR TEMP FILE ######## +my $o_base_dir = "/tmp/tmp_Icinga_int."; +my $file_history = 200; # number of data to keep in files. + +# Icinga specific +my %ERRORS = ('OK' => 0, 'WARNING' => 1, 'CRITICAL' => 2, 'UNKNOWN' => 3, 'DEPENDENT' => 4); + +# split big SNMP requests to smaller ones +my $snmp_splice_size = 50; + +# SNMP Datas + +my $inter_table = '.1.3.6.1.2.1.2.2.1'; +my $index_table = '1.3.6.1.2.1.2.2.1.1'; +my $descr_table = '1.3.6.1.2.1.2.2.1.2'; +my $name_table = '1.3.6.1.2.1.31.1.1.1.1'; +my $alias_table = '.1.3.6.1.2.1.31.1.1.1.18'; +my $oper_table = '1.3.6.1.2.1.2.2.1.8.'; +my $admin_table = '1.3.6.1.2.1.2.2.1.7.'; +my $speed_table = '1.3.6.1.2.1.2.2.1.5.'; +my $speed_table_64 = '1.3.6.1.2.1.31.1.1.1.15.'; +my $in_octet_table = '1.3.6.1.2.1.2.2.1.10.'; +my $in_octet_table_64 = '1.3.6.1.2.1.31.1.1.1.6.'; +my $in_error_table = '1.3.6.1.2.1.2.2.1.14.'; +my $in_discard_table = '1.3.6.1.2.1.2.2.1.13.'; +my $out_octet_table = '1.3.6.1.2.1.2.2.1.16.'; +my $out_octet_table_64 = '1.3.6.1.2.1.31.1.1.1.10.'; +my $out_error_table = '1.3.6.1.2.1.2.2.1.20.'; +my $out_discard_table = '1.3.6.1.2.1.2.2.1.19.'; + +my %status = ( + 1 => 'UP', + 2 => 'DOWN', + 3 => 'TESTING', + 4 => 'UNKNOWN', + 5 => 'DORMANT', + 6 => 'NotPresent', + 7 => 'lowerLayerDown' +); + +# Globals + +# Standard options +my $o_host = undef; # hostname +my $o_port = 161; # port +my $o_descr = undef; # description filter +my $o_help = undef; # wan't some help ? +my $o_admin = undef; # admin status instead of oper +my $o_inverse = undef; # Critical when up +my $o_dormant = undef; # Dormant state is OK +my $o_down = undef; # Down state is OK +my $o_verb = undef; # verbose mode +my $o_version = undef; # print version +my $o_noreg = undef; # Do not use Regexp for name +my $o_short = undef; # set maximum of n chars to be displayed +my $o_label = undef; # add label before speed (in, out, etc...). + +# Performance data options +my $o_perf = undef; # Output performance data +my $o_perfe = undef; # Output discard/error also in perf data +my $o_perfs = undef; # include speed in performance output (-S) +my $o_perfp = undef; # output performance data in % of max speed (-y) +my $o_perfr = undef; # output performance data in bits/s or Bytes/s (-Y) + +# Speed/error checks +my $o_checkperf = undef; # checks in/out/err/disc values +my $o_delta = 300; # delta of time of perfcheck (default 5min) +my $o_ext_checkperf = undef; # extended perf checks (+error+discard) +my $o_warn_opt = undef; # warning options +my $o_crit_opt = undef; # critical options +my $o_kbits = undef; # Warn and critical in Kbits instead of KBytes +my @o_warn = undef; # warning levels of perfcheck +my @o_crit = undef; # critical levels of perfcheck +my $o_highperf = undef; # Use 64 bits counters +my $o_meg = undef; # output in MBytes or Mbits (-M) +my $o_gig = undef; # output in GBytes or Gbits (-G) +my $o_prct = undef; # output in % of max speed (-u) +my $o_use_ifname = undef; # use IF-MIB::ifName instead of IF-MIB::ifDescr +my $o_use_ifalias = undef; # use IF-MIB::ifAlias instead of IF-MIB::ifDescr + +my $o_timeout = undef; # Timeout (Default 5) + +# SNMP Message size parameter (Makina Corpus contrib) +my $o_octetlength = undef; + +# Login options specific +my $o_community = undef; # community +my $o_version2 = undef; #use snmp v2c +my $o_login = undef; # Login for snmpv3 +my $o_passwd = undef; # Pass for snmpv3 +my $v3protocols = undef; # V3 protocol list. +my $o_authproto = 'md5'; # Auth protocol +my $o_privproto = 'des'; # Priv protocol +my $o_privpass = undef; # priv password + +# Readable names for counters (M. Berger contrib) +my @countername = ("in=", "out=", "errors-in=", "errors-out=", "discard-in=", "discard-out="); +my $checkperf_out_desc; + +# functions + +sub read_file { + + # Input : File, items_number + # Returns : array of value : [line][item] + my ($traffic_file, $items_number) = @_; + my ($ligne, $n_rows) = (undef, 0); + my (@last_values, @file_values, $i); + open(FILE, "<" . $traffic_file) || return (1, 0, 0); + + while ($ligne = ) { + chomp($ligne); + @file_values = split(":", $ligne); + + #verb("@file_values"); + if ($#file_values >= ($items_number - 1)) { + + # check if there is enough data, else ignore line + for ($i = 0; $i < $items_number; $i++) { $last_values[$n_rows][$i] = $file_values[$i]; } + $n_rows++; + } + } + close FILE; + if ($n_rows != 0) { + return (0, $n_rows, @last_values); + } else { + return (1, 0, 0); + } +} + +sub write_file { + + # Input : file , rows, items, array of value : [line][item] + # Returns : 0 / OK, 1 / error + my ($file_out, $rows, $item, @file_values) = @_; + my $start_line = ($rows > $file_history) ? $rows - $file_history : 0; + if (open(FILE2, ">" . $file_out)) { + for (my $i = $start_line; $i < $rows; $i++) { + for (my $j = 0; $j < $item; $j++) { + print FILE2 $file_values[$i][$j]; + if ($j != ($item - 1)) { print FILE2 ":" } + } + print FILE2 "\n"; + } + close FILE2; + return 0; + } else { + return 1; + } +} + +sub p_version { print "check_snmp_int version : $VERSION\n"; } + +sub print_usage { + print +"Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,) [-p ] -n [-N -A -i -a -D --down] [-r] [-f[eSyY]] [-k[qBMGu] -g -w -c -d] [-o ] [-t ] [-s] --label [-V]\n"; +} + +sub isnnum { # Return true if arg is not a number + my $num = shift; + if ($num =~ /^(\d+\.?\d*)|(^\.\d+)$/) { return 0; } + return 1; +} + +sub help { + print "\nSNMP Network Interface Monitor for Icinga/Nagios/Naemon/Shinken, Version ", $VERSION, "\n"; + print "GPL license, (c)2004-2007 Patrick Proy\n\n"; + print_usage(); + print <, + : Authentication protocol (md5|sha : default md5) + : Priv protocole (des|aes : default des) +-P, --port=PORT + SNMP port (Default 161) +-n, --name=NAME + Name in description OID (eth0, ppp0 ...). + This is treated as a regexp : -n eth will match eth0,eth1,... + Test it before, because there are known bugs (ex : trailling /) +-r, --noregexp + Do not use regexp to match NAME in description OID +-N, --use-ifname + Use IF-MIB::ifName as source for NIC name instead of IF-MIB::ifDescr +-A, --use-ifalias + Use IF-MIB::ifAlias as source for NIC name instead of IF-MIB::ifDescr +-i, --inverse + Make critical when up +-a, --admin + Use administrative status instead of operational +-D, --dormant + Dormant state is an OK state +--down + Down state is an OK state +-o, --octetlength=INTEGER + max-size of the SNMP message, usefull in case of Too Long responses. + Be carefull with network filters. Range 484 - 65535, default are + usually 1472,1452,1460 or 1440. +-f, --perfparse, --perfdata + Performance data output (no output when interface is down). +-e, --error + Add error & discard to Perfparse output +-S, --intspeed + Include speed in performance output in bits/s +-y, --perfprct ; -Y, --perfspeed + -y : output performance data in % of max speed + -Y : output performance data in bits/s or Bytes/s (depending on -B) +-k, --perfcheck ; -q, --extperfcheck + -k check the input/ouput bandwidth of the interface + -q also check the error and discard input/output +--label + Add label before speed in output : in=, out=, errors-out=, etc... +-g, --64bits + Use 64 bits counters instead of the standard counters when checking + bandwidth & performance data for interface >= 1Gbps. + You must use snmp v2c or v3 to get 64 bits counters. +-d, --delta=seconds + make an average of seconds (default 300=5min) +-B, --kbits + Make the warning and critical levels in K|M|G Bits/s instead of K|M|G Bytes/s +-G, --giga ; -M, --mega ; -u, --prct + -G : Make the warning and critical levels in Gbps (with -B) or GBps + -M : Make the warning and critical levels in Mbps (with -B) or MBps + -u : Make the warning and critical levels in % of reported interface speed. +-w, --warning=input,output[,error in,error out,discard in,discard out] + warning level for input / output bandwidth (0 for no warning) + unit depends on B,M,G,u options + warning for error & discard input / output in error/min (need -q) +-c, --critical=input,output[,error in,error out,discard in,discard out] + critical level for input / output bandwidth (0 for no critical) + unit depends on B,M,G,u options + critical for error & discard input / output in error/min (need -q) +-s, --short=int + Make the output shorter : only the first chars of the interface(s) + If the number is negative, then get the LAST caracters. +-t, --timeout=INTEGER + timeout for SNMP in seconds (Default: 5) +-V, --version + prints version number +Note : when multiple interface are selected with regexp, + all be must be up (or down with -i) to get an OK result. +EOT +} + +# For verbose output +sub verb { my $t = shift; print $t, "\n" if defined($o_verb); } + +sub check_options { + Getopt::Long::Configure("bundling"); + GetOptions( + 'v' => \$o_verb, + 'verbose' => \$o_verb, + 'h' => \$o_help, + 'help' => \$o_help, + 'H:s' => \$o_host, + 'hostname:s' => \$o_host, + 'p:i' => \$o_port, + 'port:i' => \$o_port, + 'n:s' => \$o_descr, + 'name:s' => \$o_descr, + 'N' => \$o_use_ifname, + 'use-ifname' => \$o_use_ifname, + 'A' => \$o_use_ifalias, + 'use-ifalias' => \$o_use_ifalias, + 'C:s' => \$o_community, + 'community:s' => \$o_community, + '2' => \$o_version2, + 'v2c' => \$o_version2, + 'l:s' => \$o_login, + 'login:s' => \$o_login, + 'x:s' => \$o_passwd, + 'passwd:s' => \$o_passwd, + 'X:s' => \$o_privpass, + 'privpass:s' => \$o_privpass, + 'L:s' => \$v3protocols, + 'protocols:s' => \$v3protocols, + 't:i' => \$o_timeout, + 'timeout:i' => \$o_timeout, + 'i' => \$o_inverse, + 'inverse' => \$o_inverse, + 'a' => \$o_admin, + 'admin' => \$o_admin, + 'r' => \$o_noreg, + 'noregexp' => \$o_noreg, + 'V' => \$o_version, + 'version' => \$o_version, + 'f' => \$o_perf, + 'perfparse' => \$o_perf, + 'perfdata' => \$o_perf, + 'e' => \$o_perfe, + 'error' => \$o_perfe, + 'k' => \$o_checkperf, + 'perfcheck' => \$o_checkperf, + 'q' => \$o_ext_checkperf, + 'extperfcheck' => \$o_ext_checkperf, + 'w:s' => \$o_warn_opt, + 'warning:s' => \$o_warn_opt, + 'c:s' => \$o_crit_opt, + 'critical:s' => \$o_crit_opt, + 'B' => \$o_kbits, + 'kbits' => \$o_kbits, + 's:i' => \$o_short, + 'short:i' => \$o_short, + 'g' => \$o_highperf, + '64bits' => \$o_highperf, + 'S' => \$o_perfs, + 'intspeed' => \$o_perfs, + 'y' => \$o_perfp, + 'perfprct' => \$o_perfp, + 'Y' => \$o_perfr, + 'perfspeed' => \$o_perfr, + 'M' => \$o_meg, + 'mega' => \$o_meg, + 'G' => \$o_gig, + 'giga' => \$o_gig, + 'u' => \$o_prct, + 'prct' => \$o_prct, + 'o:i' => \$o_octetlength, + 'octetlength:i' => \$o_octetlength, + 'label' => \$o_label, + 'd:i' => \$o_delta, + 'delta:i' => \$o_delta, + 'D' => \$o_dormant, + 'dormant' => \$o_dormant, + 'down' => \$o_down + ); + if (defined($o_help)) { help(); exit $ERRORS{"UNKNOWN"} } + if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"} } + if (!defined($o_descr) || !defined($o_host)) # check host and filter + { + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + + # check snmp information + if (!defined($o_community) && (!defined($o_login) || !defined($o_passwd))) { + print "Put snmp login info!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if ((defined($o_login) || defined($o_passwd)) && (defined($o_community) || defined($o_version2))) { + print "Can't mix snmp v1,2c,3 protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (defined($v3protocols)) { + if (!defined($o_login)) { + print "Put snmp V3 login info with protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + my @v3proto = split(/,/, $v3protocols); + if ((defined($v3proto[0])) && ($v3proto[0] ne "")) { $o_authproto = $v3proto[0]; } # Auth protocol + if (defined($v3proto[1])) { $o_privproto = $v3proto[1]; } # Priv protocol + if ((defined($v3proto[1])) && (!defined($o_privpass))) { + print "Put snmp V3 priv login info with priv protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + } + if (defined($o_timeout) && (isnnum($o_timeout) || ($o_timeout < 2) || ($o_timeout > 60))) { + print "Timeout must be >1 and <60 !\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (!defined($o_timeout)) { $o_timeout = 5; } + + # Check snmpv2c or v3 with 64 bit counters + if (defined($o_highperf) && (!defined($o_version2) && defined($o_community))) { + print "Can't get 64 bit counters with snmp version 1\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (defined($o_highperf)) { + if (eval "require bigint") { + use bigint; + } else { + print "Need bigint module for 64 bit counters\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + } + + # check if -e without -f + if (defined($o_perfe) && !defined($o_perf)) { + print "Cannot output error without -f option!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (defined($o_perfr) && defined($o_perfp)) { + print "-Y and -y options are exclusives\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if ((defined($o_perfr) || defined($o_perfp)) && !defined($o_checkperf)) { + print "Cannot put -Y or -y options without perf check option (-k) \n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (defined($o_short)) { + + #TODO maybe some basic tests ? caracters return empty string + } + if (defined($o_checkperf)) { + @o_warn = split(/,/, $o_warn_opt); + if (defined($o_ext_checkperf) && ($#o_warn != 5)) { + print "6 warning levels for extended checks \n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (!defined($o_ext_checkperf) && ($#o_warn != 1)) { + print "2 warning levels for bandwidth checks \n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + @o_crit = split(/,/, $o_crit_opt); + + #verb(" $o_crit_opt :: $#o_crit : @o_crit"); + if (defined($o_ext_checkperf) && ($#o_crit != 5)) { + print "6 critical levels for extended checks \n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (!defined($o_ext_checkperf) && ($#o_crit != 1)) { + print "2 critical levels for bandwidth checks \n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + for (my $i = 0; $i <= $#o_warn; $i++) { + if (($o_crit[$i] != 0) && ($o_warn[$i] > $o_crit[$i])) { + print "Warning must be < Critical level \n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + } + if ( (defined($o_meg) && defined($o_gig)) + || (defined($o_meg) && defined($o_prct)) + || (defined($o_gig) && defined($o_prct))) + { + print "-M -G and -u options are exclusives\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + } + #### octet length checks + if (defined($o_octetlength) && (isnnum($o_octetlength) || $o_octetlength > 65535 || $o_octetlength < 484)) { + print "octet lenght must be < 65535 and > 484\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } +} + +########## MAIN ####### + +check_options(); + +# Check timeout if snmp screws up +if (defined($o_timeout)) { + verb("Alarm in $o_timeout seconds"); + alarm($o_timeout); +} + +$SIG{'ALRM'} = sub { + print "No answer from host $o_host:$o_port\n"; + exit $ERRORS{"UNKNOWN"}; +}; + +# Connect to host +my ($session, $error); +if (defined($o_login) && defined($o_passwd)) { + + # SNMPv3 login + if (!defined($o_privpass)) { + verb("SNMPv3 AuthNoPriv login : $o_login, $o_authproto"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => '3', + -port => $o_port, + -username => $o_login, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, + -timeout => $o_timeout + ); + } else { + verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => '3', + -username => $o_login, + -port => $o_port, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, + -privpassword => $o_privpass, + -privprotocol => $o_privproto, + -timeout => $o_timeout + ); + } +} else { + if (defined($o_version2)) { + + # SNMPv2c Login + verb("SNMP v2c login"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => 2, + -community => $o_community, + -port => $o_port, + -timeout => $o_timeout + ); + } else { + + # SNMPV1 login + verb("SNMP v1 login"); + ($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 $ERRORS{"UNKNOWN"}; +} + +if (defined($o_octetlength)) { + my $oct_resultat = undef; + my $oct_test = $session->max_msg_size(); + verb(" actual max octets:: $oct_test"); + $oct_resultat = $session->max_msg_size($o_octetlength); + if (!defined($oct_resultat)) { + printf("ERROR: Session settings : %s.\n", $session->error); + $session->close; + exit $ERRORS{"UNKNOWN"}; + } + $oct_test = $session->max_msg_size(); + verb(" new max octets:: $oct_test"); +} + +# Get description table +my $query_table = $descr_table; +if (defined($o_use_ifalias) and defined($o_use_ifname)) { + printf("ERROR: Options -N and -A are exclusive. Please select only one.\n"); + $session->close; + exit $ERRORS{"UNKNOWN"}; +} +if (defined($o_use_ifname)) { + $query_table = $name_table; +} +if (defined($o_use_ifalias)) { + $query_table = $alias_table; +} +my $resultat = $session->get_table(Baseoid => $query_table); + +if (!defined($resultat)) { + printf("ERROR: Description table : %s.\n", $session->error); + $session->close; + exit $ERRORS{"UNKNOWN"}; +} +my @tindex = undef; +my @oids = undef; +my @descr = undef; +my ( + @oid_perf, @oid_perf_outoct, @oid_perf_inoct, @oid_perf_inerr, + @oid_perf_outerr, @oid_perf_indisc, @oid_perf_outdisc +) = (undef, undef, undef, undef, undef, undef, undef); +my @oid_speed = undef; +my @oid_speed_high = undef; +my $num_int = 0; + +# Change to 64 bit counters if option is set : +if (defined($o_highperf)) { + $out_octet_table = $out_octet_table_64; + $in_octet_table = $in_octet_table_64; +} + +# Select interface by regexp of exact match +# and put the oid to query in an array + +verb("Filter : $o_descr"); +foreach my $key (sort { $$resultat{$a} cmp $$resultat{$b} } keys %$resultat) { + verb("OID : $key, Desc : $$resultat{$key}"); + + # test by regexp or exact match + my $test + = defined($o_noreg) + ? $$resultat{$key} eq $o_descr + : $$resultat{$key} =~ /$o_descr/; + if ($test) { + + # get the index number of the interface + my @oid_list = split(/\./, $key); + $tindex[$num_int] = pop(@oid_list); + + # get the full description + $descr[$num_int] = $$resultat{$key}; + + # Get rid of special caracters (specially for Windows) + $descr[$num_int] =~ s/[[:cntrl:]]//g; + + # put the admin or oper oid in an array + $oids[$num_int] + = defined($o_admin) + ? $admin_table . $tindex[$num_int] + : $oper_table . $tindex[$num_int]; + + # Put the performance oid + if (defined($o_perf) || defined($o_checkperf)) { + $oid_perf_inoct[$num_int] = $in_octet_table . $tindex[$num_int]; + $oid_perf_outoct[$num_int] = $out_octet_table . $tindex[$num_int]; + $oid_speed[$num_int] = $speed_table . $tindex[$num_int]; + $oid_speed_high[$num_int] = $speed_table_64 . $tindex[$num_int]; + if (defined($o_ext_checkperf) || defined($o_perfe)) { + $oid_perf_indisc[$num_int] = $in_discard_table . $tindex[$num_int]; + $oid_perf_outdisc[$num_int] = $out_discard_table . $tindex[$num_int]; + $oid_perf_inerr[$num_int] = $in_error_table . $tindex[$num_int]; + $oid_perf_outerr[$num_int] = $out_error_table . $tindex[$num_int]; + } + } + verb("Name : $descr[$num_int], Index : $tindex[$num_int]"); + $num_int++; + } +} + +# No interface found -> error +if ($num_int == 0) { print "ERROR : Unknown interface $o_descr\n"; exit $ERRORS{"UNKNOWN"}; } + +my $result = undef; + +# Add performance oids if requested +if (defined($o_perf) || defined($o_checkperf)) { + @oids = (@oids, @oid_perf_outoct, @oid_perf_inoct, @oid_speed); + if (defined($o_highperf)) { + @oids = (@oids, @oid_speed_high); + } + if (defined($o_ext_checkperf) || defined($o_perfe)) { + @oids = (@oids, @oid_perf_inerr, @oid_perf_outerr, @oid_perf_indisc, @oid_perf_outdisc); + } +} + +# Get the requested oid values +while (my @oids_part = splice(@oids, 0, $snmp_splice_size)) { + my $result_part = $session->get_request(Varbindlist => \@oids_part); + if (!defined($result_part)) { + printf("ERROR: Status/statistics table : %s.\n ", $session->error); + $session->close; + exit $ERRORS{"UNKNOWN"}; + } + $result = defined($result) ? { %$result, %$result_part } : $result_part; +} +$session->close; + +my $num_ok = 0; +my @checkperf_out = undef; +my @checkperf_out_raw = undef; +### Bandwidth test variables +my $temp_file_name; +my ($return, @file_values) = (undef, undef); +my $n_rows = 0; +my $n_items_check = (defined($o_ext_checkperf)) ? 7 : 3; +my $timenow = time; +my $trigger = $timenow - ($o_delta - ($o_delta / 10)); +my $trigger_low = $timenow - 3 * $o_delta; +my ($old_value, $old_time) = undef; +my $speed_unit = undef; +my $speed_real = undef; # speed of interface using either standard or highperf mib. + +# define the OK value depending on -i option +my $ok_val = defined($o_inverse) ? 2 : 1; +my $final_status = 0; +my ($print_out, $perf_out) = (undef, undef); + +# make all checks and output for all interfaces +for (my $i = 0; $i < $num_int; $i++) { + $print_out .= ", " if (defined($print_out)); + $perf_out .= " " if (defined($perf_out)); + my $usable_data = 1; + + # Get the status of the current interface + my $int_status + = defined($o_admin) + ? $$result{ $admin_table . $tindex[$i] } + : $$result{ $oper_table . $tindex[$i] }; + + # Make the bandwith & error checks if necessary + if (defined($o_checkperf) && $int_status == 1) { + $temp_file_name = $descr[$i]; + $temp_file_name =~ s/[ ;\/]/_/g; + $temp_file_name = $o_base_dir . $o_host . "." . $temp_file_name; + + # First, read entire file + my @ret_array = read_file($temp_file_name, $n_items_check); + $return = shift(@ret_array); + $n_rows = shift(@ret_array); + if ($n_rows != 0) { @file_values = @ret_array } + verb("File read returns : $return with $n_rows rows"); + + # Get the speed in normal or highperf speed counters + if ($$result{ $oid_speed[$i] } == 4294967295) { # Too high for this counter (cf IF-MIB) + if (!defined($o_highperf) && (defined($o_prct) || defined($o_perfs) || defined($o_perfp))) { + print "Cannot get interface speed with standard MIB, use highperf mib (-g) : UNKNOWN\n"; + exit $ERRORS{"UNKNOWN"}; + } + if (defined($$result{ $oid_speed_high[$i] }) && $$result{ $oid_speed_high[$i] } != 0) { + $speed_real = $$result{ $oid_speed_high[$i] } * 1000000; + } else { + print "Cannot get interface speed using highperf mib : UNKNOWN\n"; + exit $ERRORS{"UNKNOWN"}; + } + } else { + $speed_real = $$result{ $oid_speed[$i] }; + } + verb("Interface speed : $speed_real"); + + #make the checks if the file is OK + if ($return == 0) { + my $j = $n_rows - 1; + @checkperf_out = undef; + @checkperf_out_raw = undef; + do { + if ($file_values[$j][0] < $trigger) { + if ($file_values[$j][0] > $trigger_low) { + + # Define the speed metric ( K | M | G ) (Bits|Bytes) or % + my $speed_metric = undef; + if (defined($o_prct)) { # in % of speed + # Speed is in bits/s, calculated speed is in Bytes/s + $speed_metric = $speed_real / 800; + $speed_unit = "%"; + } else { + if (defined($o_kbits)) { # metric in bits + if (defined($o_meg)) { # in Mbit/s = 1000000 bit/s + $speed_metric = 125000; # (1000/8) * 1000 + $speed_unit = "Mbps"; + } elsif (defined($o_gig)) { # in Gbit/s = 1000000000 bit/s + $speed_metric = 125000000; # (1000/8) * 1000 * 1000 + $speed_unit = "Gbps"; + } else { # in Kbits + $speed_metric = 125; # ( 1000/8 ) + $speed_unit = "Kbps"; + } + } else { # metric in byte + if (defined($o_meg)) { # in Mbits + $speed_metric = 1048576; # 1024^2 + $speed_unit = "MBps"; + } elsif (defined($o_gig)) { # in Mbits + $speed_metric = 1073741824; # 1024^3 + $speed_unit = "GBps"; + } else { + $speed_metric = 1024; # 1024^3 + $speed_unit = "KBps"; + } + } + } + + # check if the counter is back to 0 after 2^32 / 2^64. + # First set the modulus depending on highperf counters or not + my $overfl_mod = defined($o_highperf) ? 18446744073709551616 : 4294967296; + + # Check counter (s) + my $overfl = ($$result{ $oid_perf_inoct[$i] } >= $file_values[$j][1]) ? 0 : $overfl_mod; + $checkperf_out_raw[0] = (($overfl + $$result{ $oid_perf_inoct[$i] } - $file_values[$j][1]) + / ($timenow - $file_values[$j][0])); + $checkperf_out[0] = $checkperf_out_raw[0] / $speed_metric; + + $overfl = ($$result{ $oid_perf_outoct[$i] } >= $file_values[$j][2]) ? 0 : $overfl_mod; + $checkperf_out_raw[1] = (($overfl + $$result{ $oid_perf_outoct[$i] } - $file_values[$j][2]) + / ($timenow - $file_values[$j][0])); + $checkperf_out[1] = $checkperf_out_raw[1] / $speed_metric; + + if (defined($o_ext_checkperf)) { + $checkperf_out[2] + = (($$result{ $oid_perf_inerr[$i] } - $file_values[$j][3]) + / ($timenow - $file_values[$j][0])) * 60; + $checkperf_out[3] + = (($$result{ $oid_perf_outerr[$i] } - $file_values[$j][4]) + / ($timenow - $file_values[$j][0])) * 60; + $checkperf_out[4] + = (($$result{ $oid_perf_indisc[$i] } - $file_values[$j][5]) + / ($timenow - $file_values[$j][0])) * 60; + $checkperf_out[5] + = (($$result{ $oid_perf_outdisc[$i] } - $file_values[$j][6]) + / ($timenow - $file_values[$j][0])) * 60; + } + } + } + $j--; + } while (($j >= 0) && (!defined($checkperf_out[0]))); + } + + # Put the new values in the array and write the file + $file_values[$n_rows][0] = $timenow; + $file_values[$n_rows][1] = $$result{ $oid_perf_inoct[$i] }; + $file_values[$n_rows][2] = $$result{ $oid_perf_outoct[$i] }; + if (defined($o_ext_checkperf)) { # Add other values (error & disc) + $file_values[$n_rows][3] = $$result{ $oid_perf_inerr[$i] }; + $file_values[$n_rows][4] = $$result{ $oid_perf_outerr[$i] }; + $file_values[$n_rows][5] = $$result{ $oid_perf_indisc[$i] }; + $file_values[$n_rows][6] = $$result{ $oid_perf_outdisc[$i] }; + } + $n_rows++; + $return = write_file($temp_file_name, $n_rows, $n_items_check, @file_values); + verb("Write file returned : $return"); + + # Print the basic status + if (defined($o_short)) { + my $short_desc = undef; + if ($o_short < 0) { $short_desc = substr($descr[$i], $o_short); } + else { $short_desc = substr($descr[$i], 0, $o_short); } + $print_out .= sprintf("%s:%s", $short_desc, $status{$int_status}); + } else { + $print_out .= sprintf("%s:%s", $descr[$i], $status{$int_status}); + } + if ($return != 0) { # On error writing, return Unknown status + $final_status = 3; + $print_out .= " !!Unable to write file " . $temp_file_name . " !! "; + } + + # print the other checks if it was calculated + if (defined($checkperf_out[0])) { + $print_out .= " ("; + + # check 2 or 6 values depending on ext_check_perf + my $num_checkperf = (defined($o_ext_checkperf)) ? 6 : 2; + for (my $l = 0; $l < $num_checkperf; $l++) { + + # Set labels if needed + $checkperf_out_desc = (defined($o_label)) ? $countername[$l] : ""; + verb("Interface $i, check $l : $checkperf_out[$l]"); + if ($l != 0) { $print_out .= "/"; } + if (($o_crit[$l] != 0) && ($checkperf_out[$l] > $o_crit[$l])) { + $final_status = 2; + $print_out .= sprintf("CRIT %s%.1f", $checkperf_out_desc, $checkperf_out[$l]); + } elsif (($o_warn[$l] != 0) && ($checkperf_out[$l] > $o_warn[$l])) { + $final_status = ($final_status == 2) ? 2 : 1; + $print_out .= sprintf("WARN %s%.1f", $checkperf_out_desc, $checkperf_out[$l]); + } else { + $print_out .= sprintf("%s%.1f", $checkperf_out_desc, $checkperf_out[$l]); + } + if ($l == 0 || $l == 1) { $print_out .= $speed_unit; } + } + $print_out .= ")"; + } else { # Return unknown when no data + $print_out .= " No usable data on file (" . $n_rows . " rows) "; + $final_status = 3; + $usable_data = 0; + } + } else { + if (defined($o_short)) { + my $short_desc = undef; + if ($o_short < 0) { $short_desc = substr($descr[$i], $o_short); } + else { $short_desc = substr($descr[$i], 0, $o_short); } + $print_out .= sprintf("%s:%s", $short_desc, $status{$int_status}); + } else { + $print_out .= sprintf("%s:%s", $descr[$i], $status{$int_status}); + } + } + + # Get rid of special caracters for performance in description + $descr[$i] =~ s/'\/\(\)/_/g; + if (($int_status == $ok_val) || (defined($o_down) && $int_status == 2) || (defined($o_dormant) && $int_status == 5)) + { + $num_ok++; + } + if (($int_status == 1) && defined($o_perf)) { + if (defined($o_perfp)) { # output in % of speed + if ($usable_data == 1) { + my $warn_factor = 1; + if (!defined($o_prct)) { # warn&crit in K|M|G B|bps -> put warn_factor to make % + $warn_factor = (defined($o_meg)) ? 1000000 : (defined($o_gig)) ? 1000000000 : 1000; + if (!defined($o_kbits)) { $warn_factor *= 8; } + $warn_factor /= $speed_real; + $warn_factor *= 100; # now turn into displayed % : 0,1 = 10% + } + $perf_out .= "'" . $descr[$i] . "_in_prct'="; + $perf_out .= sprintf("%.0f", $checkperf_out_raw[0] * 800 / $speed_real) . "%;"; + $perf_out .= ($o_warn[0] != 0) ? sprintf("%.0f", $o_warn[0] * $warn_factor) . ";" : ";"; + $perf_out .= ($o_crit[0] != 0) ? sprintf("%.0f", $o_crit[0] * $warn_factor) . ";" : ";"; + $perf_out .= "0;100 "; + $perf_out .= "'" . $descr[$i] . "_out_prct'="; + $perf_out .= sprintf("%.0f", $checkperf_out_raw[1] * 800 / $speed_real) . "%;"; + $perf_out .= ($o_warn[1] != 0) ? sprintf("%.0f", $o_warn[1] * $warn_factor) . ";" : ";"; + $perf_out .= ($o_crit[1] != 0) ? sprintf("%.0f", $o_crit[1] * $warn_factor) . ";" : ";"; + $perf_out .= "0;100 "; + } + } elsif (defined($o_perfr)) { # output in bites or Bytes /s + if ($usable_data == 1) { + if (defined($o_kbits)) { # bps + # put warning and critical levels into bps or Bps + my $warn_factor; + if (defined($o_prct)) { # warn&crit in % -> put warn_factor to 1% of speed in bps + $warn_factor = $speed_real / 100; + } else { # just convert from K|M|G bps + $warn_factor = (defined($o_meg)) ? 1000000 : (defined($o_gig)) ? 1000000000 : 1000; + } + $perf_out .= "'" . $descr[$i] . "_in_bps'="; + $perf_out .= sprintf("%.0f", $checkperf_out_raw[0] * 8) . ";"; + $perf_out .= ($o_warn[0] != 0) ? $o_warn[0] * $warn_factor . ";" : ";"; + $perf_out .= ($o_crit[0] != 0) ? $o_crit[0] * $warn_factor . ";" : ";"; + $perf_out .= "0;" . $speed_real . " "; + $perf_out .= "'" . $descr[$i] . "_out_bps'="; + $perf_out .= sprintf("%.0f", $checkperf_out_raw[1] * 8) . ";"; + $perf_out .= ($o_warn[1] != 0) ? $o_warn[1] * $warn_factor . ";" : ";"; + $perf_out .= ($o_crit[1] != 0) ? $o_crit[1] * $warn_factor . ";" : ";"; + $perf_out .= "0;" . $speed_real . " "; + } else { # Bps + my $warn_factor; + if (defined($o_prct)) { # warn&crit in % -> put warn_factor to 1% of speed in Bps + $warn_factor = $speed_real / 800; + } else { # just convert from K|M|G bps + $warn_factor = (defined($o_meg)) ? 1048576 : (defined($o_gig)) ? 1073741824 : 1024; + } + $perf_out .= "'" . $descr[$i] . "_in_Bps'=" . sprintf("%.0f", $checkperf_out_raw[0]) . ";"; + $perf_out .= ($o_warn[0] != 0) ? $o_warn[0] * $warn_factor . ";" : ";"; + $perf_out .= ($o_crit[0] != 0) ? $o_crit[0] * $warn_factor . ";" : ";"; + $perf_out .= "0;" . $speed_real / 8 . " "; + $perf_out .= "'" . $descr[$i] . "_out_Bps'=" . sprintf("%.0f", $checkperf_out_raw[1]) . ";"; + $perf_out .= ($o_warn[1] != 0) ? $o_warn[1] * $warn_factor . ";" : ";"; + $perf_out .= ($o_crit[1] != 0) ? $o_crit[1] * $warn_factor . ";" : ";"; + $perf_out .= "0;" . $speed_real / 8 . " "; + } + } + } else { # output in octet counter + $perf_out .= "'" . $descr[$i] . "_in_octet'=" . $$result{ $oid_perf_inoct[$i] } . "c "; + $perf_out .= "'" . $descr[$i] . "_out_octet'=" . $$result{ $oid_perf_outoct[$i] } . "c "; + } + if (defined($o_perfe)) { + $perf_out .= "'" . $descr[$i] . "_in_error'=" . $$result{ $oid_perf_inerr[$i] } . "c "; + $perf_out .= "'" . $descr[$i] . "_in_discard'=" . $$result{ $oid_perf_indisc[$i] } . "c "; + $perf_out .= "'" . $descr[$i] . "_out_error'=" . $$result{ $oid_perf_outerr[$i] } . "c "; + $perf_out .= "'" . $descr[$i] . "_out_discard'=" . $$result{ $oid_perf_outdisc[$i] } . "c "; + } + if (defined($o_perfs)) { + $perf_out .= "'" . $descr[$i] . "_speed_bps'=" . $speed_real; + } + } +} + +# Only a few ms left... +alarm(0); + +# Check if all interface are OK +if ($num_ok == $num_int) { + if ($final_status == 0) { + print $print_out, ":", $num_ok, " UP: OK"; + if (defined($o_perf)) { print " | ", $perf_out; } + print "\n"; + exit $ERRORS{"OK"}; + } elsif ($final_status == 1) { + print $print_out, ":(", $num_ok, " UP): WARNING"; + if (defined($o_perf)) { print " | ", $perf_out; } + print "\n"; + exit $ERRORS{"WARNING"}; + } elsif ($final_status == 2) { + print $print_out, ":(", $num_ok, " UP): CRITICAL"; + if (defined($o_perf)) { print " | ", $perf_out; } + print "\n"; + exit $ERRORS{"CRITICAL"}; + } else { + print $print_out, ":(", $num_ok, " UP): UNKNOWN"; + if (defined($perf_out)) { print " | ", $perf_out; } + print "\n"; + exit $ERRORS{"UNKNOWN"}; + } +} + +# else print the not OK interface number and exit (return is always critical if at least one int is down). + +print $print_out, ": ", $num_int - $num_ok, " int NOK : CRITICAL"; +if (defined($perf_out)) { print " | ", $perf_out; } +print "\n"; +exit $ERRORS{"CRITICAL"}; + diff --git a/plugins/check_snmp_linkproof_nhr.pl b/plugins/check_snmp_linkproof_nhr.pl new file mode 100755 index 0000000..36433ee --- /dev/null +++ b/plugins/check_snmp_linkproof_nhr.pl @@ -0,0 +1,363 @@ +#!/usr/bin/perl -w +############################## check_snmp_linkproof_nhr ################# +# Version : 1.0 +# Date : Aug 24 2006 +# Author : Patrick Proy ( patrick at proy.org) +# Help : http://www.manubulon.com/nagios/ +# License : GPL - http://www.fsf.org/licenses/gpl.txt +# Changelog : +# Contributors : +################################################################# +# +# Help : ./check_snmp_linkproof_nhr.pl -h +# + +use strict; +use Net::SNMP; +use Getopt::Long; + +# Icinga specific +my %ERRORS = ('OK' => 0, 'WARNING' => 1, 'CRITICAL' => 2, 'UNKNOWN' => 3, 'DEPENDENT' => 4); + +# SNMP Datas + +my $lp_type = "1.3.6.1.4.1.89.35.1.38.1.1.13"; # node type (1=regular, 2=nhr). +my $lp_name = "1.3.6.1.4.1.89.35.1.38.1.1.2"; # nhr name +my $lp_users = "1.3.6.1.4.1.89.35.1.38.1.1.5"; # nhr users +my $lp_state = "1.3.6.1.4.1.89.35.1.38.1.1.3"; # state : 1=active, 2=Notinservice, 3= nonewsessions. +my $lp_port = "1.3.6.1.4.1.89.35.1.38.1.1.15"; # nhr users + +# Globals + +my $VERSION = "2.0.0"; + +my $o_host = undef; # hostname +my $o_community = undef; # community +my $o_port = 161; # port +my $o_help = undef; # wan't some help ? +my $o_verb = undef; # verbose mode +my $o_version = undef; # print version + +# specific +my $o_nhr_num = undef; # nhr number TODO +my $o_nhr_max = undef; # Maximum connexions TODO + +my $o_timeout = undef; # Timeout (Default 5) +my $o_perf = undef; # Output performance data +my $o_version2 = undef; # use snmp v2c + +# SNMPv3 specific +my $o_login = undef; # Login for snmpv3 +my $o_passwd = undef; # Pass for snmpv3 +my $v3protocols = undef; # V3 protocol list. +my $o_authproto = 'md5'; # Auth protocol +my $o_privproto = 'des'; # Priv protocol +my $o_privpass = undef; # priv password + +# functions + +sub p_version { print "check_snmp_linkproof_nhr version : $VERSION\n"; } + +sub print_usage { + print +"Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] [-f] [-t ] [-V]\n"; +} + +sub isnnum { # Return true if arg is not a number + my $num = shift; + if ($num =~ /^(\d+\.?\d*)|(^\.\d+)$/) { return 0; } + return 1; +} + +sub help { + print "\nSNMP Radware Linkproof NHR monitor for Icinga/Nagios/Naemon/Shinken, Version ", $VERSION, "\n"; + print "(c)2004-2006 Patrick Proy\n\n"; + print_usage(); + print <, + : Authentication protocol (md5|sha : default md5) + : Priv protocole (des|aes : default des) +-P, --port=PORT + SNMP port (Default 161) +-f, --perfparse, --perfdata + Performance data output +-t, --timeout=INTEGER + timeout for SNMP in seconds (Default: 5) +-V, --version + prints version number +EOT +} + +# For verbose output +sub verb { my $t = shift; print $t, "\n" if defined($o_verb); } + +sub check_options { + Getopt::Long::Configure("bundling"); + GetOptions( + 'v' => \$o_verb, + 'verbose' => \$o_verb, + 'h' => \$o_help, + 'help' => \$o_help, + 'H:s' => \$o_host, + 'hostname:s' => \$o_host, + 'p:i' => \$o_port, + 'port:i' => \$o_port, + 'C:s' => \$o_community, + 'community:s' => \$o_community, + 'l:s' => \$o_login, + 'login:s' => \$o_login, + 'x:s' => \$o_passwd, + 'passwd:s' => \$o_passwd, + 'X:s' => \$o_privpass, + 'privpass:s' => \$o_privpass, + 'L:s' => \$v3protocols, + 'protocols:s' => \$v3protocols, + 't:i' => \$o_timeout, + 'timeout:i' => \$o_timeout, + 'V' => \$o_version, + 'version' => \$o_version, + '2' => \$o_version2, + 'v2c' => \$o_version2, + 'f' => \$o_perf, + 'perfparse' => \$o_perf, + 'perfdata' => \$o_perf + ); + + # Basic checks + if (defined($o_timeout) && (isnnum($o_timeout) || ($o_timeout < 2) || ($o_timeout > 60))) { + print "Timeout must be >1 and <60 !\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (!defined($o_timeout)) { $o_timeout = 5; } + if (defined($o_help)) { help(); exit $ERRORS{"UNKNOWN"} } + if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"} } + if (!defined($o_host)) # check host and filter + { + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + + # check snmp information + if (!defined($o_community) && (!defined($o_login) || !defined($o_passwd))) { + print "Put snmp login info!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if ((defined($o_login) || defined($o_passwd)) && (defined($o_community) || defined($o_version2))) { + print "Can't mix snmp v1,2c,3 protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (defined($v3protocols)) { + if (!defined($o_login)) { + print "Put snmp V3 login info with protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + my @v3proto = split(/,/, $v3protocols); + if ((defined($v3proto[0])) && ($v3proto[0] ne "")) { $o_authproto = $v3proto[0]; } # Auth protocol + if (defined($v3proto[1])) { $o_privproto = $v3proto[1]; } # Priv protocol + if ((defined($v3proto[1])) && (!defined($o_privpass))) { + print "Put snmp V3 priv login info with priv protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + } +} + +########## MAIN ####### + +check_options(); + +# Check timeout if snmp screws up +if (defined($o_timeout)) { + verb("Alarm in $o_timeout seconds"); + alarm($o_timeout); +} + +$SIG{'ALRM'} = sub { + print "No answer from host $o_host:$o_port\n"; + exit $ERRORS{"UNKNOWN"}; +}; + +# Connect to host +my ($session, $error); +if (defined($o_login) && defined($o_passwd)) { + + # SNMPv3 login + verb("SNMPv3 login"); + if (!defined($o_privpass)) { + verb("SNMPv3 AuthNoPriv login : $o_login, $o_authproto"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => '3', + -username => $o_login, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, + -timeout => $o_timeout + ); + } else { + verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => '3', + -username => $o_login, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, + -privpassword => $o_privpass, + -privprotocol => $o_privproto, + -timeout => $o_timeout + ); + } +} else { + if (defined($o_version2)) { + + # SNMPv2 Login + verb("SNMP v2c login"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => 2, + -community => $o_community, + -port => $o_port, + -timeout => $o_timeout + ); + } else { + + # SNMPV1 login + verb("SNMP v1 login"); + ($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 $ERRORS{"UNKNOWN"}; +} + +my $exit_val = undef; +########### NHR checks ############## + +my $nhr_num = 0; # nujmber of NHR +my @nhr_table = undef; # index of NHR +my $output = undef; +my $perf_output = ""; +my @oids = undef; +my $inactive_nhr = 0; +my $global_status = 0; + +# Get load table +my $resultat + = (version->parse(Net::SNMP->VERSION) < 4) + ? $session->get_table($lp_type) + : $session->get_table(Baseoid => $lp_type); + +if (!defined($resultat)) { + printf("ERROR: NHR table : %s.\n", $session->error); + $session->close; + exit $ERRORS{"UNKNOWN"}; +} +my $oidindex = 0; +foreach my $key (keys %$resultat) { + verb("OID : $key, Desc : $$resultat{$key}"); + if ($$resultat{$key} == 2) { # found NHR + $key =~ s/$lp_type\.//; + $nhr_table[$nhr_num++] = $key; + $oids[$oidindex++] = $lp_name . "." . $key; + $oids[$oidindex++] = $lp_users . "." . $key; + $oids[$oidindex++] = $lp_state . "." . $key; + $oids[$oidindex++] = $lp_port . "." . $key; + verb("found nhr : $key"); + } +} + +if ($nhr_num == 0) { + print "No NHR found : CRITICAL\n"; + exit $ERRORS{"CRITICAL"}; +} + +my $result = undef; +if (version->parse(Net::SNMP->VERSION) < 4) { + $result = $session->get_request(@oids); +} else { + if ($session->version == 0) { + + # snmpv1 + $result = $session->get_request(-varbindlist => \@oids); + } else { + + # snmp v2c or v3 : get_bulk_request is not really good for this, so do simple get + $result = $session->get_request(-varbindlist => \@oids); + } +} + +if (!defined($result)) { + printf("ERROR: NHR table get : %s.\n", $session->error); + $session->close; + exit $ERRORS{"UNKNOWN"}; +} + +my ($nhr_name, $nhr_state, $nhr_users) = (undef, undef, undef); +my @nhr_text_state = ("", "active", "Not in service", "No new session"); +for (my $i = 0; $i < $nhr_num; $i++) { + if (defined($output)) { $output .= "; "; } + $nhr_name = $$result{ $lp_name . "." . $nhr_table[$i] }; + $nhr_state = $$result{ $lp_state . "." . $nhr_table[$i] }; + $nhr_users = $$result{ $lp_users . "." . $nhr_table[$i] }; + $output .= $nhr_name . "(" . $nhr_users . "):" . $nhr_text_state[$nhr_state]; + if ($nhr_state == 1) { + if (defined($o_perf)) { + if (defined($perf_output)) { $perf_output .= " "; } + $perf_output .= $nhr_name . "=" . $nhr_users; + } + } elsif ($nhr_state == 2) { + $inactive_nhr++; + $global_status = 1; + } else { + $global_status = 1; + } +} + +$session->close; + +if ($inactive_nhr == $nhr_num) { + $output .= " : CRITICAL"; + if (defined($o_perf)) { $output .= " | " . $perf_output; } + print $output, "\n"; + exit $ERRORS{"CRITICAL"}; +} + +if ($global_status == 1) { + $output .= " : WARNING"; + if (defined($o_perf)) { $output .= " | " . $perf_output; } + print $output, "\n"; + exit $ERRORS{"WARNING"}; +} + +$output .= " : OK"; +if (defined($o_perf)) { $output .= " | " . $perf_output; } +print $output, "\n"; +exit $ERRORS{"OK"}; diff --git a/plugins/check_snmp_load.pl b/plugins/check_snmp_load.pl new file mode 100755 index 0000000..e8efe1a --- /dev/null +++ b/plugins/check_snmp_load.pl @@ -0,0 +1,900 @@ +#!/usr/bin/perl -w +############################## check_snmp_load ################# +my $VERSION = "2.0.0"; + +# Date : Oct 12 2007 +# Author : Patrick Proy ( patrick at proy.org) +# Help : http://nagios.manubulon.com/ +# License : GPL - http://www.fsf.org/licenses/gpl.txt +# Contributors : F. Lacroix and many others !!! +################################################################# +# +# Help : ./check_snmp_load.pl -h +# + +use strict; +use Net::SNMP; +use Getopt::Long; + +# Icinga specific +my %ERRORS = ('OK' => 0, 'WARNING' => 1, 'CRITICAL' => 2, 'UNKNOWN' => 3, 'DEPENDENT' => 4); + +# SNMP Datas + +# Generic with host-ressource-mib +my $base_proc = "1.3.6.1.2.1.25.3.3.1"; # oid for all proc info +my $proc_id = "1.3.6.1.2.1.25.3.3.1.1"; # list of processors (product ID) +my $proc_load = "1.3.6.1.2.1.25.3.3.1.2"; # %time the proc was not idle over last minute + +# Linux load + +my $linload_table = "1.3.6.1.4.1.2021.10.1"; # net-snmp load table +my $linload_name = "1.3.6.1.4.1.2021.10.1.2"; # text 'Load-1','Load-5', 'Load-15' +my $linload_load = "1.3.6.1.4.1.2021.10.1.3"; # effective load table + +# Cisco cpu/load + +my $cisco_cpu_5m = "1.3.6.1.4.1.9.2.1.58.0"; # Cisco CPU load (5min %) +my $cisco_cpu_1m = "1.3.6.1.4.1.9.2.1.57.0"; # Cisco CPU load (1min %) +my $cisco_cpu_5s = "1.3.6.1.4.1.9.2.1.56.0"; # Cisco CPU load (5sec %) + +# Cisco catalyst cpu/load + +my $ciscocata_cpu_5m = ".1.3.6.1.4.1.9.9.109.1.1.1.1.5.9"; # Cisco CPU load (5min %) +my $ciscocata_cpu_1m = ".1.3.6.1.4.1.9.9.109.1.1.1.1.3.9"; # Cisco CPU load (1min %) +my $ciscocata_cpu_5s = ".1.3.6.1.4.1.9.9.109.1.1.1.1.4.9"; # Cisco CPU load (5sec %) + +# Netscreen cpu/load + +my $nsc_cpu_5m = "1.3.6.1.4.1.3224.16.1.4.0"; # NS CPU load (5min %) +my $nsc_cpu_1m = "1.3.6.1.4.1.3224.16.1.2.0"; # NS CPU load (1min %) +my $nsc_cpu_5s = "1.3.6.1.4.1.3224.16.1.3.0"; # NS CPU load (5sec %) + +# AS/400 CPU + +my $as400_cpu = "1.3.6.1.4.1.2.6.4.5.1.0"; # AS400 CPU load (10000=100%); + +# N5K CPU +my $n5k_cpu = "1.3.6.1.4.1.9.9.305.1.1.1.0"; # N5K CPU load (%) + +# Net-SNMP CPU + +my $ns_cpu_idle = "1.3.6.1.4.1.2021.11.11.0"; # Net-snmp cpu idle +my $ns_cpu_user = "1.3.6.1.4.1.2021.11.9.0"; # Net-snmp user cpu usage +my $ns_cpu_system = "1.3.6.1.4.1.2021.11.10.0"; # Net-snmp system cpu usage + +# Procurve CPU +my $procurve_cpu = "1.3.6.1.4.1.11.2.14.11.5.1.9.6.1.0"; # Procurve CPU Counter + +# Nokia CPU +my $nokia_cpu = "1.3.6.1.4.1.94.1.21.1.7.1.0"; # Nokia CPU % usage + +# Bluecoat Appliance +my $bluecoat_cpu = "1.3.6.1.4.1.3417.2.4.1.1.1.4.1"; # Bluecoat %cpu usage. + +# Fortigate CPU +my $fortigate_cpu = ".1.3.6.1.4.1.12356.1.8.0"; # Fortigate CPU % usage + +# Linkproof Appliance +my $linkproof_cpu = "1.3.6.1.4.1.89.35.1.55.0"; # CPU RE (Routing Engine Tasks) + +# 1.3.6.1.4.1.89.35.1.53.0 : Ressource utilisation (%) Considers network utilization and internal CPU utilization +# 1.3.6.1.4.1.89.35.1.54 : CPU only (%) +# 1.3.6.1.4.1.89.35.1.55 : network only (%) + +# HP-UX cpu usage (thanks to krizb for the OIDs). +my $hpux_load_1_min = "1.3.6.1.4.1.11.2.3.1.1.3.0"; +my $hpux_load_5_min = "1.3.6.1.4.1.11.2.3.1.1.4.0"; +my $hpux_load_15_min = "1.3.6.1.4.1.11.2.3.1.1.5.0"; + +# valid values +my @valid_types + = ("stand", "netsc", "netsl", "as400", "cisco", "cata", "nsc", "fg", "bc", "nokia", "hp", "lp", "hpux", "n5k"); + +# CPU OID array +my %cpu_oid = ( + "netsc", $ns_cpu_idle, "as400", $as400_cpu, "bc", $bluecoat_cpu, "nokia", $nokia_cpu, + "hp", $procurve_cpu, "lp", $linkproof_cpu, "fg", $fortigate_cpu, "n5k", $n5k_cpu +); + +# Globals + +my $o_host = undef; # hostname +my $o_community = undef; # community +my $o_port = 161; # port +my $o_domain = 'udp/ipv4'; # protocol +my $o_help = undef; # wan't some help ? +my $o_verb = undef; # verbose mode +my $o_version = undef; # print version + +# check type : stand | netsc | netsl | as400 | cisco | cata | nsc | fg | bc | nokia | hp | lp | hpux +my $o_check_type = "stand"; + +# End compatibility +my $o_warn = undef; # warning level +my @o_warnL = undef; # warning levels for Linux Load or Cisco CPU +my $o_crit = undef; # critical level +my @o_critL = undef; # critical level for Linux Load or Cisco CPU +my $o_timeout = undef; # Timeout (Default 5) +my $o_perf = undef; # Output performance data +my $o_version2 = undef; # use snmp v2c + +# SNMPv3 specific +my $o_login = undef; # Login for snmpv3 +my $o_passwd = undef; # Pass for snmpv3 +my $v3protocols = undef; # V3 protocol list. +my $o_authproto = 'md5'; # Auth protocol +my $o_privproto = 'des'; # Priv protocol +my $o_privpass = undef; # priv password + +# functions + +sub p_version { print "check_snmp_load version : $VERSION\n"; } + +sub print_usage { + print +"Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] [-P ] -w -c -T=[stand|netsl|netsc|as400|cisco|cata|nsc|fg|bc|nokia|hp|lp|hpux] [-f] [-t ] [-V]\n"; +} + +sub isnnum { # Return true if arg is not a number + my $num = shift; + if ($num =~ /^(\d+\.?\d*)|(^\.\d+)$/) { return 0; } + return 1; +} + +sub help { + print "\nSNMP Load & CPU Monitor for Icinga/Nagios/Naemon/Shinken, Version ", $VERSION, "\n"; + print "GPL license, (c)2004-2007 Patrick Proy\n\n"; + print_usage(); + print <, + : Authentication protocol (md5|sha : default md5) + : Priv protocole (des|aes : default des) +-p, --port=PORT + SNMP port (Default 161) +-P, --protocol=PROTOCOL + Network protocol to be used + ['udp/ipv4'] : UDP over IPv4 + 'udp/ipv6' : UDP over IPv6 + 'tcp/ipv4' : TCP over IPv4 + 'tcp/ipv6' : TCP over IPv6 + + Network protocol (Default udp/ipv4) +-w, --warn=INTEGER | INT,INT,INT + 1 value check : warning level for cpu in percent (on one minute) + 3 value check : comma separated level for load or cpu for 1min, 5min, 15min +-c, --crit=INTEGER | INT,INT,INT + critical level for cpu in percent (on one minute) + 1 value check : critical level for cpu in percent (on one minute) + 3 value check : comma separated level for load or cpu for 1min, 5min, 15min +-T, --type=stand|netsl|netsc|as400|cisco|bc|nokia|hp|lp + CPU check : + stand : standard MIBII (works with Windows), + can handle multiple CPU. + netsl : linux load provided by Net SNMP (1,5 & 15 minutes values) + netsc : cpu usage given by net-snmp (100-idle) + as400 : as400 CPU usage + cisco : Cisco CPU usage + n5k : Cisco Nexus CPU Usage + cata : Cisco catalyst CPU usage + nsc : NetScreen CPU usage + fg : Fortigate CPU usage + bc : Bluecoat CPU usage + nokia : Nokia CPU usage + hp : HP procurve switch CPU usage + lp : Linkproof CPU usage + hpux : HP-UX load (1,5 & 15 minutes values) +-f, --perfparse, --perfdata + Performance data output +-t, --timeout=INTEGER + timeout for SNMP in seconds (Default: 5) +-V, --version + prints version number +EOT +} + +# For verbose output +sub verb { my $t = shift; print $t, "\n" if defined($o_verb); } + +sub check_options { + Getopt::Long::Configure("bundling"); + GetOptions( + 'v' => \$o_verb, + 'verbose' => \$o_verb, + 'h' => \$o_help, + 'help' => \$o_help, + 'H:s' => \$o_host, + 'hostname:s' => \$o_host, + 'p:i' => \$o_port, + 'port:i' => \$o_port, + 'P:s' => \$o_domain, + 'protocol:s' => \$o_domain, + 'C:s' => \$o_community, + 'community:s' => \$o_community, + 'l:s' => \$o_login, + 'login:s' => \$o_login, + 'x:s' => \$o_passwd, + 'passwd:s' => \$o_passwd, + 'X:s' => \$o_privpass, + 'privpass:s' => \$o_privpass, + 'L:s' => \$v3protocols, + 'protocols:s' => \$v3protocols, + 't:i' => \$o_timeout, + 'timeout:i' => \$o_timeout, + 'V' => \$o_version, + 'version' => \$o_version, + '2' => \$o_version2, + 'v2c' => \$o_version2, + 'c:s' => \$o_crit, + 'critical:s' => \$o_crit, + 'w:s' => \$o_warn, + 'warn:s' => \$o_warn, + 'f' => \$o_perf, + 'perfparse' => \$o_perf, + 'perfdata' => \$o_perf, + 'T:s' => \$o_check_type, + 'type:s' => \$o_check_type + ); + + # check the -T option + my $T_option_valid = 0; + foreach (@valid_types) { + if ($_ eq $o_check_type) { $T_option_valid = 1 } + } + if ($T_option_valid == 0) { print "Invalid check type (-T)!\n"; print_usage(); exit $ERRORS{"UNKNOWN"} } + + # Basic checks + if (defined($o_timeout) && (isnnum($o_timeout) || ($o_timeout < 2) || ($o_timeout > 60))) { + print "Timeout must be >1 and <60 !\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (!defined($o_timeout)) { $o_timeout = 5; } + if (defined($o_help)) { help(); exit $ERRORS{"UNKNOWN"} } + if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"} } + if (!defined($o_host)) # check host and filter + { + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + + # check snmp information + if (!defined($o_community) && (!defined($o_login) || !defined($o_passwd))) { + print "Put snmp login info!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if ((defined($o_login) || defined($o_passwd)) && (defined($o_community) || defined($o_version2))) { + print "Can't mix snmp v1,2c,3 protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (defined($v3protocols)) { + if (!defined($o_login)) { + print "Put snmp V3 login info with protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + my @v3proto = split(/,/, $v3protocols); + if ((defined($v3proto[0])) && ($v3proto[0] ne "")) { $o_authproto = $v3proto[0]; } # Auth protocol + if (defined($v3proto[1])) { $o_privproto = $v3proto[1]; } # Priv protocol + if ((defined($v3proto[1])) && (!defined($o_privpass))) { + print "Put snmp V3 priv login info with priv protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + } + + # Check warnings and critical + if (!defined($o_warn) || !defined($o_crit)) { + print "put warning and critical info!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + + # Get rid of % sign + $o_warn =~ s/\%//g; + $o_crit =~ s/\%//g; + + # Check for multiple warning and crit in case of -L + if ( ($o_check_type eq "netsl") + || ($o_check_type eq "cisco") + || ($o_check_type eq "cata") + || ($o_check_type eq "nsc") + || ($o_check_type eq "hpux")) + { + @o_warnL = split(/,/, $o_warn); + @o_critL = split(/,/, $o_crit); + if (($#o_warnL != 2) || ($#o_critL != 2)) { + print "3 warnings and critical !\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + for (my $i = 0; $i < 3; $i++) { + if (isnnum($o_warnL[$i]) || isnnum($o_critL[$i])) { + print "Numeric value for warning or critical !\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if ($o_warnL[$i] > $o_critL[$i]) { + print "warning <= critical ! \n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + } + } else { + if (($o_warn =~ /,/) || ($o_crit =~ /,/)) { + { + print "Multiple warning/critical levels not available for this check\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"} + } + } + if (isnnum($o_warn) || isnnum($o_crit)) { + print "Numeric value for warning or critical !\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if ($o_warn > $o_crit) { print "warning <= critical ! \n"; print_usage(); exit $ERRORS{"UNKNOWN"} } + } +} + +# This is required to get around all of the silly historical methods of +# versioning with Net::SNMP. +sub is_legacy_snmp_version { + my $version = Net::SNMP->VERSION; #using a variable for easier testing + if ($version =~ /^\D*(\d)/ and $1 < 4) { + return 1; + } else { + return 0; + } +} + +########## MAIN ####### + +check_options(); + +# Check timeout if snmp screws up +if (defined($o_timeout)) { + verb("Alarm in $o_timeout seconds"); + alarm($o_timeout); +} + +$SIG{'ALRM'} = sub { + print "No answer from host $o_host:$o_port\n"; + exit $ERRORS{"UNKNOWN"}; +}; + +# Connect to host +my ($session, $error); +if (defined($o_login) && defined($o_passwd)) { + + # SNMPv3 login + verb("SNMPv3 login"); + if (!defined($o_privpass)) { + verb("SNMPv3 AuthNoPriv login : $o_login, $o_authproto"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => '3', + -username => $o_login, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, + -timeout => $o_timeout, + -domain => $o_domain + ); + } else { + verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => '3', + -username => $o_login, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, + -privpassword => $o_privpass, + -privprotocol => $o_privproto, + -timeout => $o_timeout, + -domain => $o_domain + ); + } +} else { + if (defined($o_version2)) { + + # SNMPv2 Login + verb("SNMP v2c login"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => 2, + -community => $o_community, + -port => $o_port, + -timeout => $o_timeout, + -domain => $o_domain + ); + } else { + + # SNMPV1 login + verb("SNMP v1 login"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -community => $o_community, + -port => $o_port, + -timeout => $o_timeout, + -domain => $o_domain + ); + } +} +if (!defined($session)) { + printf("ERROR opening session: %s.\n", $error); + exit $ERRORS{"UNKNOWN"}; +} + +my $exit_val = undef; +########### Linux load check ############## + +if ($o_check_type eq "netsl") { + + verb("Checking linux load"); + + # Get number of CPUs + my $resultat + = (is_legacy_snmp_version()) + ? $session->get_table($proc_id) + : $session->get_table(Baseoid => $proc_id); + + if (!defined($resultat)) { + printf("ERROR: Description table : %s.\n", $session->error); + $session->close; + exit $ERRORS{"UNKNOWN"}; + } + + my $ncpu = keys %$resultat; + + # Get load table + $resultat + = (is_legacy_snmp_version()) + ? $session->get_table($linload_table) + : $session->get_table(Baseoid => $linload_table); + + if (!defined($resultat)) { + printf("ERROR: Description table : %s.\n", $session->error); + $session->close; + exit $ERRORS{"UNKNOWN"}; + } + $session->close; + + my @load = undef; + my @iload = undef; + my @oid = undef; + my $exist = 0; + foreach my $key (keys %$resultat) { + verb("OID : $key, Desc : $$resultat{$key}"); + if ($key =~ /$linload_name/) { + @oid = split(/\./, $key); + $iload[0] = pop(@oid) if ($$resultat{$key} eq "Load-1"); + $iload[1] = pop(@oid) if ($$resultat{$key} eq "Load-5"); + $iload[2] = pop(@oid) if ($$resultat{$key} eq "Load-15"); + $exist = 1; + } + } + + if ($exist == 0) { + print "Can't find snmp information on load : UNKNOWN\n"; + exit $ERRORS{"UNKNOWN"}; + } + + for (my $i = 0; $i < 3; $i++) { $load[$i] = $$resultat{ $linload_load . "." . $iload[$i] } } + + print "Load (CPUs: $ncpu) : $load[0] $load[1] $load[2] :"; + + $exit_val = $ERRORS{"OK"}; + for (my $i = 0; $i < 3; $i++) { + + # Multiply warning and critical levels by the number of CPUs + $o_warnL[$i] *= $ncpu; + $o_critL[$i] *= $ncpu; + if ($load[$i] > $o_critL[$i]) { + print " $load[$i] > $o_critL[$i] : CRITICAL"; + $exit_val = $ERRORS{"CRITICAL"}; + } + if ($load[$i] > $o_warnL[$i]) { + + # output warn error only if no critical was found + if ($exit_val eq $ERRORS{"OK"}) { + print " $load[$i] > $o_warnL[$i] : WARNING"; + $exit_val = $ERRORS{"WARNING"}; + } + } + } + print " OK" if ($exit_val eq $ERRORS{"OK"}); + if (defined($o_perf)) { + print " | load_1_min=$load[0];$o_warnL[0];$o_critL[0] "; + print "load_5_min=$load[1];$o_warnL[1];$o_critL[1] "; + print "load_15_min=$load[2];$o_warnL[2];$o_critL[2]\n"; + } else { + print "\n"; + } + exit $exit_val; +} + +############## Cisco CPU check ################ + +if ($o_check_type eq "cisco") { + my @oidlists = ($cisco_cpu_5m, $cisco_cpu_1m, $cisco_cpu_5s); + my $resultat + = (is_legacy_snmp_version()) + ? $session->get_request(@oidlists) + : $session->get_request(-varbindlist => \@oidlists); + + if (!defined($resultat)) { + printf("ERROR: Description table : %s.\n", $session->error); + $session->close; + exit $ERRORS{"UNKNOWN"}; + } + + $session->close; + + if (!defined($$resultat{$cisco_cpu_5s})) { + print "No CPU information : UNKNOWN\n"; + exit $ERRORS{"UNKNOWN"}; + } + + my @load = undef; + + $load[0] = $$resultat{$cisco_cpu_5s}; + $load[1] = $$resultat{$cisco_cpu_1m}; + $load[2] = $$resultat{$cisco_cpu_5m}; + + print "CPU : $load[0] $load[1] $load[2] :"; + + $exit_val = $ERRORS{"OK"}; + for (my $i = 0; $i < 3; $i++) { + if ($load[$i] > $o_critL[$i]) { + print " $load[$i] > $o_critL[$i] : CRITICAL"; + $exit_val = $ERRORS{"CRITICAL"}; + } + if ($load[$i] > $o_warnL[$i]) { + + # output warn error only if no critical was found + if ($exit_val eq $ERRORS{"OK"}) { + print " $load[$i] > $o_warnL[$i] : WARNING"; + $exit_val = $ERRORS{"WARNING"}; + } + } + } + print " OK" if ($exit_val eq $ERRORS{"OK"}); + if (defined($o_perf)) { + print " | load_5_sec=$load[0]%;$o_warnL[0];$o_critL[0] "; + print "load_1_min=$load[1]%;$o_warnL[1];$o_critL[1] "; + print "load_5_min=$load[2]%;$o_warnL[2];$o_critL[2]\n"; + } else { + print "\n"; + } + + exit $exit_val; +} + +############## Cisco N5K CPU Check ################### +if ($o_check_type eq "n5k") { + my @oidlists = ($n5k_cpu); + my $resultat + = (is_legacy_snmp_version()) + ? $session->get_request(@oidlists) + : $session->get_request(-varbindlist => \@oidlists); + if (!defined($resultat)) { + printf("ERROR: Description table : %s.\n", $session->error); + $session->close; + exit $ERRORS{"UNKNOWN"}; + } + + $session->close; + if (!defined($$resultat{$n5k_cpu})) { + print "No CPU information : UNKNOWN\n"; + exit $ERRORS{"UNKNOWN"}; + } + + my $n5k_load = $$resultat{$n5k_cpu}; + if ($n5k_load > $o_crit) { + print "$n5k_load% > $o_crit% : CRITICAL"; + $exit_val = $ERRORS{"CRITICAL"}; + } elsif ($n5k_load > $o_warn) { + print "$n5k_load% > $o_warn% : WARNING"; + $exit_val = $ERRORS{"WARNING"}; + } else { + print "CPU: $n5k_load%"; + $exit_val = $ERRORS{"OK"}; + } + if (defined($o_perf)) { + print " | n5k_load=$n5k_load%"; + } + print "\n"; + exit $exit_val; + +} +############## Cisco Catalyst CPU check ################ + +if ($o_check_type eq "cata") { + my @oidlists = ($ciscocata_cpu_5m, $ciscocata_cpu_1m, $ciscocata_cpu_5s); + my $resultat + = (is_legacy_snmp_version()) + ? $session->get_request(@oidlists) + : $session->get_request(-varbindlist => \@oidlists); + + if (!defined($resultat)) { + printf("ERROR: Description table : %s.\n", $session->error); + $session->close; + exit $ERRORS{"UNKNOWN"}; + } + + $session->close; + + if (!defined($$resultat{$ciscocata_cpu_5s})) { + print "No CPU information : UNKNOWN\n"; + exit $ERRORS{"UNKNOWN"}; + } + + my @load = undef; + + $load[0] = $$resultat{$ciscocata_cpu_5s}; + $load[1] = $$resultat{$ciscocata_cpu_1m}; + $load[2] = $$resultat{$ciscocata_cpu_5m}; + + print "CPU : $load[0] $load[1] $load[2] :"; + + $exit_val = $ERRORS{"OK"}; + for (my $i = 0; $i < 3; $i++) { + if ($load[$i] > $o_critL[$i]) { + print " $load[$i] > $o_critL[$i] : CRITICAL"; + $exit_val = $ERRORS{"CRITICAL"}; + } + if ($load[$i] > $o_warnL[$i]) { + + # output warn error only if no critical was found + if ($exit_val eq $ERRORS{"OK"}) { + print " $load[$i] > $o_warnL[$i] : WARNING"; + $exit_val = $ERRORS{"WARNING"}; + } + } + } + print " OK" if ($exit_val eq $ERRORS{"OK"}); + if (defined($o_perf)) { + print " | load_5_sec=$load[0]%;$o_warnL[0];$o_critL[0] "; + print "load_1_min=$load[1]%;$o_warnL[1];$o_critL[1] "; + print "load_5_min=$load[2]%;$o_warnL[2];$o_critL[2]\n"; + } else { + print "\n"; + } + + exit $exit_val; +} + +############## Netscreen CPU check ################ + +if ($o_check_type eq "nsc") { + my @oidlists = ($nsc_cpu_5m, $nsc_cpu_1m, $nsc_cpu_5s); + my $resultat + = (is_legacy_snmp_version()) + ? $session->get_request(@oidlists) + : $session->get_request(-varbindlist => \@oidlists); + + if (!defined($resultat)) { + printf("ERROR: Description table : %s.\n", $session->error); + $session->close; + exit $ERRORS{"UNKNOWN"}; + } + + $session->close; + + if (!defined($$resultat{$nsc_cpu_5s})) { + print "No CPU information : UNKNOWN\n"; + exit $ERRORS{"UNKNOWN"}; + } + + my @load = undef; + + $load[0] = $$resultat{$nsc_cpu_5s}; + $load[1] = $$resultat{$nsc_cpu_1m}; + $load[2] = $$resultat{$nsc_cpu_5m}; + + print "CPU : $load[0] $load[1] $load[2] :"; + + $exit_val = $ERRORS{"OK"}; + for (my $i = 0; $i < 3; $i++) { + if ($load[$i] > $o_critL[$i]) { + print " $load[$i] > $o_critL[$i] : CRITICAL"; + $exit_val = $ERRORS{"CRITICAL"}; + } + if ($load[$i] > $o_warnL[$i]) { + + # output warn error only if no critical was found + if ($exit_val eq $ERRORS{"OK"}) { + print " $load[$i] > $o_warnL[$i] : WARNING"; + $exit_val = $ERRORS{"WARNING"}; + } + } + } + print " OK" if ($exit_val eq $ERRORS{"OK"}); + if (defined($o_perf)) { + print " | cpu_5_sec=$load[0]%;$o_warnL[0];$o_critL[0] "; + print "cpu_1_min=$load[1]%;$o_warnL[1];$o_critL[1] "; + print "cpu_5_min=$load[2]%;$o_warnL[2];$o_critL[2]\n"; + } else { + print "\n"; + } + + exit $exit_val; +} + +################## CPU for : AS/400 , Netsnmp, HP, Bluecoat, linkproof, fortigate ########### +if ($o_check_type =~ /netsc|as400|bc|nokia|^hp$|lp|fg/) { + + # Get load table + my @oidlist = $cpu_oid{$o_check_type}; + verb("Checking OID : @oidlist"); + my $resultat + = (is_legacy_snmp_version()) + ? $session->get_request(@oidlist) + : $session->get_request(-varbindlist => \@oidlist); + if (!defined($resultat)) { + printf("ERROR: Description table : %s.\n", $session->error); + $session->close; + exit $ERRORS{"UNKNOWN"}; + } + $session->close; + + if (!defined($$resultat{ $cpu_oid{$o_check_type} })) { + print "No CPU information : UNKNOWN\n"; + exit $ERRORS{"UNKNOWN"}; + } + + my $load = $$resultat{ $cpu_oid{$o_check_type} }; + verb("OID returned $load"); + + # for AS400, divide by 100 + if ($o_check_type eq "as400") { $load /= 100; } + + # for Net-snmp : oid returned idle time so load = 100-idle. + if ($o_check_type eq "netsc") { $load = 100 - $load; } + + printf("CPU used %.1f%% (", $load); + + $exit_val = $ERRORS{"OK"}; + if ($load > $o_crit) { + print ">$o_crit) : CRITICAL"; + $exit_val = $ERRORS{"CRITICAL"}; + } else { + if ($load > $o_warn) { + print ">$o_warn) : WARNING"; + $exit_val = $ERRORS{"WARNING"}; + } + } + print "<$o_warn) : OK" if ($exit_val eq $ERRORS{"OK"}); + (defined($o_perf)) + ? print " | cpu_prct_used=$load%;$o_warn;$o_crit\n" + : print "\n"; + exit $exit_val; + +} + +##### Checking hpux load +if ($o_check_type eq "hpux") { + + verb("Checking hpux load"); + + my @oidlists = ($hpux_load_1_min, $hpux_load_5_min, $hpux_load_15_min); + my $resultat + = (is_legacy_snmp_version()) + ? $session->get_request(@oidlists) + : $session->get_request(-varbindlist => \@oidlists); + + if (!defined($resultat)) { + printf("ERROR: Load table : %s.\n", $session->error); + $session->close; + exit $ERRORS{"UNKNOWN"}; + } + + $session->close; + + if (!defined($$resultat{$hpux_load_1_min})) { + print "No Load information : UNKNOWN\n"; + exit $ERRORS{"UNKNOWN"}; + } + + my @load = undef; + + $load[0] = $$resultat{$hpux_load_1_min} / 100; + $load[1] = $$resultat{$hpux_load_5_min} / 100; + $load[2] = $$resultat{$hpux_load_15_min} / 100; + + print "Load : $load[0] $load[1] $load[2] :"; + + $exit_val = $ERRORS{"OK"}; + for (my $i = 0; $i < 3; $i++) { + if ($load[$i] > $o_critL[$i]) { + print " $load[$i] > $o_critL[$i] : CRITICAL"; + $exit_val = $ERRORS{"CRITICAL"}; + } + if ($load[$i] > $o_warnL[$i]) { + + # output warn error only if no critical was found + if ($exit_val eq $ERRORS{"OK"}) { + print " $load[$i] > $o_warnL[$i] : WARNING"; + $exit_val = $ERRORS{"WARNING"}; + } + } + } + print " OK" if ($exit_val eq $ERRORS{"OK"}); + if (defined($o_perf)) { + print " | load_1_min=$load[0]%;$o_warnL[0];$o_critL[0] "; + print "load_5_min=$load[1]%;$o_warnL[1];$o_critL[1] "; + print "load_15_min=$load[2]%;$o_warnL[2];$o_critL[2]\n"; + } else { + print "\n"; + } + + exit $exit_val; +} + +########## Standard cpu usage check ############ +# Get desctiption table +my $resultat + = (is_legacy_snmp_version()) + ? $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 $ERRORS{"UNKNOWN"}; +} + +$session->close; + +my ($cpu_used, $ncpu) = (0, 0); +foreach my $key (keys %$resultat) { + verb("OID : $key, Desc : $$resultat{$key}"); + if ($key =~ /$proc_load/) { + $cpu_used += $$resultat{$key}; + $ncpu++; + } +} + +if ($ncpu == 0) { + print "Can't find CPU usage information : UNKNOWN\n"; + exit $ERRORS{"UNKNOWN"}; +} + +$cpu_used /= $ncpu; + +print "$ncpu CPU, ", $ncpu == 1 ? "load" : "average load"; +printf(" %.1f%%", $cpu_used); +$exit_val = $ERRORS{"OK"}; + +if ($cpu_used > $o_crit) { + print " > $o_crit% : CRITICAL"; + $exit_val = $ERRORS{"CRITICAL"}; +} else { + if ($cpu_used > $o_warn) { + print " > $o_warn% : WARNING"; + $exit_val = $ERRORS{"WARNING"}; + } +} +print " < $o_warn% : OK" if ($exit_val eq $ERRORS{"OK"}); +(defined($o_perf)) + ? print " | cpu_prct_used=$cpu_used%;$o_warn;$o_crit\n" + : print "\n"; +exit $exit_val; + diff --git a/plugins/check_snmp_mem.pl b/plugins/check_snmp_mem.pl new file mode 100755 index 0000000..d8471f9 --- /dev/null +++ b/plugins/check_snmp_mem.pl @@ -0,0 +1,626 @@ +#!/usr/bin/perl -w +############################## check_snmp_mem ############## +my $VERSION = "2.0.0"; + +# Date : 17 October 2007 +# Author : Patrick Proy (nagios at proy.org) +# Help : http://nagios.manubulon.com/ +# License : GPL - http://www.fsf.org/licenses/gpl.txt +# Contrib : Jan Jungmann, Patrick Griffin +# TODO : +################################################################# +# +# Help : ./check_snmp_mem.pl -h +# + +use strict; +use Net::SNMP; +use Getopt::Long; + +# Icinga specific +my $TIMEOUT = 15; +my %ERRORS = ('OK' => 0, 'WARNING' => 1, 'CRITICAL' => 2, 'UNKNOWN' => 3, 'DEPENDENT' => 4); + +# SNMP Datas + +# Net-snmp memory + +my $nets_ram_free = "1.3.6.1.4.1.2021.4.6.0"; # Real memory free +my $nets_ram_total = "1.3.6.1.4.1.2021.4.5.0"; # Real memory total +my $nets_ram_buffer = "1.3.6.1.4.1.2021.4.14.0"; # Real memory buffered +my $nets_ram_cache = "1.3.6.1.4.1.2021.4.15.0"; # Real memory cached +my $nets_swap_free = "1.3.6.1.4.1.2021.4.4.0"; # swap memory free +my $nets_swap_total = "1.3.6.1.4.1.2021.4.3.0"; # Swap memory total +my @nets_oids = ($nets_ram_free, $nets_ram_total, $nets_swap_free, $nets_swap_total, $nets_ram_cache, $nets_ram_buffer); + +# Cisco + +my $cisco_mem_pool = "1.3.6.1.4.1.9.9.48.1.1.1"; # Cisco memory pool +my $cisco_index = "1.3.6.1.4.1.9.9.48.1.1.1.2"; # memory pool name and index +my $cisco_valid = "1.3.6.1.4.1.9.9.48.1.1.1.4"; # Valid memory if 1 +my $cisco_used = "1.3.6.1.4.1.9.9.48.1.1.1.5"; # Used memory +my $cisco_free = "1.3.6.1.4.1.9.9.48.1.1.1.6"; # Free memory + +# .1 : type, .2 : name, .3 : alternate, .4 : valid, .5 : used, .6 : free, .7 : max free + +# HP Procurve + +my $hp_mem_pool = "1.3.6.1.4.1.11.2.14.11.5.1.1.2.2.1.1"; # HP memory pool +my $hp_mem_index = "1.3.6.1.4.1.11.2.14.11.5.1.1.2.2.1.1.1"; # memory slot index +my $hp_mem_total = "1.3.6.1.4.1.11.2.14.11.5.1.1.2.2.1.1.5"; # Total Bytes +my $hp_mem_free = "1.3.6.1.4.1.11.2.14.11.5.1.1.2.2.1.1.6"; # Free Bytes +my $hp_mem_free_seg = "1.3.6.1.4.1.11.2.14.11.5.1.1.2.2.1.1.3"; # Free segments + +# AS/400 + +# Windows NT/2K/(XP?) + +# check_snmp_storage.pl -C -H -m "^Virtual Memory$" -w -c + +# Globals + +my $o_host = undef; # hostname +my $o_community = undef; # community +my $o_port = 161; # port +my $o_domain = 'udp/ipv4'; # Default to UDP over IPv4 +my $o_help = undef; # wan't some help ? +my $o_verb = undef; # verbose mode +my $o_version = undef; # print version +my $o_netsnmp = 1; # Check with netsnmp (default) +my $o_cisco = undef; # Check cisco router mem +my $o_hp = undef; # Check hp procurve mem +my $o_warn = undef; # warning level option +my $o_warnR = undef; # warning level for Real memory +my $o_warnS = undef; # warning levels for swap +my $o_crit = undef; # Critical level option +my $o_critR = undef; # critical level for Real memory +my $o_critS = undef; # critical level for swap +my $o_perf = undef; # Performance data option +my $o_cache = undef; # Include cached memory as used memory +my $o_buffer = undef; # Exclude buffered memory as used memory +my $o_timeout = undef; # Timeout (Default 5) +my $o_version2 = undef; # use snmp v2c + +# SNMPv3 specific +my $o_login = undef; # Login for snmpv3 +my $o_passwd = undef; # Pass for snmpv3 +my $v3protocols = undef; # V3 protocol list. +my $o_authproto = 'md5'; # Auth protocol +my $o_privproto = 'des'; # Priv protocol +my $o_privpass = undef; # priv password + +# functions + +sub p_version { print "check_snmp_mem version : $VERSION\n"; } + +sub print_usage { + print +"Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] [-P ] -w -c [-I|-N|-E] [-f] [-m -b] [-t ] [-V]\n"; +} + +sub isnnum { # Return true if arg is not a number + my $num = shift; + if ($num =~ /^(\d+\.?\d*)|(^\.\d+)$/) { return 0; } + return 1; +} + +sub round ($$) { + sprintf "%.$_[1]f", $_[0]; +} + +sub help { + print "\nSNMP Memory Monitor for Icinga/Nagios/Naemon/Shinken, Version ", $VERSION, "\n"; + print "GPL license, (c)2004-2007 Patrick Proy\n\n"; + print_usage(); + print <, + : Authentication protocol (md5|sha : default md5) + : Priv protocole (des|aes : default des) +-p, --port=PORT + SNMP port (Default 161) +-P, --protocol=PROTOCOL + Network protocol to be used + ['udp/ipv4'] : UDP over IPv4 + 'udp/ipv6' : UDP over IPv6 + 'tcp/ipv4' : TCP over IPv4 + 'tcp/ipv6' : TCP over IPv6 +-w, --warn=INTEGER | INT,INT + warning level for memory in percent (0 for no checks) + Default (-N switch) : comma separated level for Real Memory and Swap + -I switch : warning level +-c, --crit=INTEGER | INT,INT + critical level for memory in percent (0 for no checks) + Default (-N switch) : comma separated level for Real Memory and Swap + -I switch : critical level +-N, --netsnmp (default) + check linux memory & swap provided by Net SNMP +-m, --memcache + include cached memory in used memory (only with Net-SNMP) +-b, --membuffer + exclude buffered memory in used memory (only with Net-SNMP) +-I, --cisco + check cisco memory (sum of all memory pools) +-E, --hp + check HP proccurve memory +-f, --perfdata + Performance data output +-t, --timeout=INTEGER + timeout for SNMP in seconds (Default: 5) +-V, --version + prints version number +EOT +} + +# For verbose output +sub verb { my $t = shift; print $t, "\n" if defined($o_verb); } + +# Get the alarm signal (just in case snmp timout screws up) +$SIG{'ALRM'} = sub { + print("ERROR: Alarm signal (Nagios time-out)\n"); + exit $ERRORS{"UNKNOWN"}; +}; + +sub check_options { + Getopt::Long::Configure("bundling"); + GetOptions( + 'v' => \$o_verb, + 'verbose' => \$o_verb, + 'h' => \$o_help, + 'help' => \$o_help, + 'H:s' => \$o_host, + 'hostname:s' => \$o_host, + 'p:i' => \$o_port, + 'port:i' => \$o_port, + 'P:s' => \$o_domain, + 'protocol:s' => \$o_domain, + 'C:s' => \$o_community, + 'community:s' => \$o_community, + 'l:s' => \$o_login, + 'login:s' => \$o_login, + 'x:s' => \$o_passwd, + 'passwd:s' => \$o_passwd, + 'X:s' => \$o_privpass, + 'privpass:s' => \$o_privpass, + 'L:s' => \$v3protocols, + 'protocols:s' => \$v3protocols, + 't:i' => \$o_timeout, + 'timeout:i' => \$o_timeout, + 'V' => \$o_version, + 'version' => \$o_version, + 'I' => \$o_cisco, + 'cisco' => \$o_cisco, + 'N' => \$o_netsnmp, + 'netsnmp' => \$o_netsnmp, + 'E' => \$o_hp, + 'hp' => \$o_hp, + '2' => \$o_version2, + 'v2c' => \$o_version2, + 'c:s' => \$o_crit, + 'critical:s' => \$o_crit, + 'w:s' => \$o_warn, + 'warn:s' => \$o_warn, + 'm' => \$o_cache, + 'memcache' => \$o_cache, + 'b' => \$o_buffer, + 'membuffer' => \$o_buffer, + 'f' => \$o_perf, + 'perfdata' => \$o_perf + ); + if (defined($o_help)) { help(); exit $ERRORS{"UNKNOWN"} } + if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"} } + if (!defined($o_host)) # check host and filter + { + print "No host defined!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + + # check snmp information + if (!defined($o_community) && (!defined($o_login) || !defined($o_passwd))) { + print "Put snmp login info!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if ((defined($o_login) || defined($o_passwd)) && (defined($o_community) || defined($o_version2))) { + print "Can't mix snmp v1,2c,3 protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (defined($v3protocols)) { + if (!defined($o_login)) { + print "Put snmp V3 login info with protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + my @v3proto = split(/,/, $v3protocols); + if ((defined($v3proto[0])) && ($v3proto[0] ne "")) { $o_authproto = $v3proto[0]; } # Auth protocol + if (defined($v3proto[1])) { $o_privproto = $v3proto[1]; } # Priv protocol + if ((defined($v3proto[1])) && (!defined($o_privpass))) { + print "Put snmp V3 priv login info with priv protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + } + if (defined($o_timeout) && (isnnum($o_timeout) || ($o_timeout < 2) || ($o_timeout > 60))) { + print "Timeout must be >1 and <60 !\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (!defined($o_timeout)) { $o_timeout = 5; } + + #Check Warning and crit are present + if (!defined($o_warn) || !defined($o_crit)) { + print "Put warning and critical values!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + + # Get rid of % sign + $o_warn =~ s/\%//g; + $o_crit =~ s/\%//g; + + # if -N or -E switch , undef $o_netsnmp + if (defined($o_cisco) || defined($o_hp)) { + $o_netsnmp = undef; + if (isnnum($o_warn) || isnnum($o_crit)) { + print "Numeric value for warning or critical !\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (($o_crit != 0) && ($o_warn > $o_crit)) { + print "warning <= critical ! \n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + } + if (defined($o_netsnmp)) { + my @o_warnL = split(/,/, $o_warn); + my @o_critL = split(/,/, $o_crit); + if (($#o_warnL != 1) || ($#o_critL != 1)) { + print "2 warnings and critical !\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + for (my $i = 0; $i < 2; $i++) { + if (isnnum($o_warnL[$i]) || isnnum($o_critL[$i])) { + print "Numeric value for warning or critical !\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (($o_critL[$i] != 0) && ($o_warnL[$i] > $o_critL[$i])) { + print "warning <= critical ! \n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if ($o_critL[$i] > 100) { + print "critical percent must be < 100 !\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + } + $o_warnR = $o_warnL[0]; + $o_warnS = $o_warnL[1]; + $o_critR = $o_critL[0]; + $o_critS = $o_critL[1]; + } + +} + +########## MAIN ####### + +check_options(); + +# Check gobal timeout if snmp screws up +if (defined($TIMEOUT)) { + verb("Alarm at $TIMEOUT"); + alarm($TIMEOUT); +} else { + verb("no timeout defined : $o_timeout + 10"); + alarm($o_timeout + 10); +} + +# Connect to host +my ($session, $error); +if (defined($o_login) && defined($o_passwd)) { + + # SNMPv3 login + if (!defined($o_privpass)) { + verb("SNMPv3 AuthNoPriv login : $o_login, $o_authproto"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => '3', + -username => $o_login, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, + -port => $o_port, + -timeout => $o_timeout, + -domain => $o_domain + ); + } else { + verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => '3', + -username => $o_login, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, + -privpassword => $o_privpass, + -privprotocol => $o_privproto, + -port => $o_port, + -timeout => $o_timeout, + -domain => $o_domain + ); + } +} else { + if (defined($o_version2)) { + + # SNMPv2 Login + verb("SNMP v2c login"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => 2, + -community => $o_community, + -port => $o_port, + -timeout => $o_timeout, + -domain => $o_domain + ); + } else { + + # SNMPV1 login + verb("SNMP v1 login"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -community => $o_community, + -port => $o_port, + -timeout => $o_timeout, + -domain => $o_domain + ); + } +} +if (!defined($session)) { + printf("ERROR opening session: %s.\n", $error); + exit $ERRORS{"UNKNOWN"}; +} + +# Global variable +my $resultat = undef; + +########### Cisco memory check ############ +if (defined($o_cisco)) { + + # Get Cisco memory table + $resultat + = (version->parse(Net::SNMP->VERSION) < 4) + ? $session->get_table($cisco_mem_pool) + : $session->get_table(Baseoid => $cisco_mem_pool); + + if (!defined($resultat)) { + printf("ERROR: Description table : %s.\n", $session->error); + $session->close; + exit $ERRORS{"UNKNOWN"}; + } + my (@oid, @index) = (undef, undef); + my $nindex = 0; + foreach my $key (keys %$resultat) { + verb("OID : $key, Desc : $$resultat{$key}"); + if ($key =~ /$cisco_index/) { + @oid = split(/\./, $key); + $index[$nindex++] = pop(@oid); + } + } + + # Check if at least 1 memory pool exists + if ($nindex == 0) { + printf("ERROR: No memory pools found"); + $session->close; + exit $ERRORS{"UNKNOWN"}; + } + + # Test every memory pool + my ($c_output, $prct_free) = (undef, undef); + my ($warn_s, $crit_s) = (0, 0); + my ($used, $free) = (0, 0); + foreach (@index) { + $c_output .= "," if defined($c_output); + if ($$resultat{ $cisco_valid . "." . $_ } == 1) { + $used += $$resultat{ $cisco_used . "." . $_ }; + $free += $$resultat{ $cisco_free . "." . $_ }; + $prct_free = round( + $$resultat{ $cisco_used . "." . $_ } * 100 + / ($$resultat{ $cisco_free . "." . $_ } + $$resultat{ $cisco_used . "." . $_ }), + 0 + ); + $c_output .= $$resultat{ $cisco_index . "." . $_ } . ":" . $prct_free . "%"; + if (($o_crit != 0) && ($o_crit <= $prct_free)) { + $crit_s = 1; + } elsif (($o_warn != 0) && ($o_warn <= $prct_free)) { + $warn_s = 1; + } + } else { + $c_output .= $$resultat{ $cisco_index . "." . $_ } . ": INVALID"; + $crit_s = 1; + } + } + my $total = $used + $free; + $prct_free = round($used * 100 / ($total), 0); + verb("Total used : $used, free: $free, output : $c_output"); + my $c_status = "OK"; + $c_output .= " : " . $prct_free . "% : "; + if ($crit_s == 1) { + $c_output .= " > " . $o_crit; + $c_status = "CRITICAL"; + } else { + if ($warn_s == 1) { + $c_output .= " > " . $o_warn; + $c_status = "WARNING"; + } + } + $c_output .= " ; " . $c_status; + if (defined($o_perf)) { + $c_output .= " | ram_used=" . $used . ";"; + $c_output .= ($o_warn == 0) ? ";" : round($o_warn * $total / 100, 0) . ";"; + $c_output .= ($o_crit == 0) ? ";" : round($o_crit * $total / 100, 0) . ";"; + $c_output .= "0;" . $total; + } + $session->close; + print "$c_output \n"; + exit $ERRORS{$c_status}; +} + +########### HP Procurve memory check ############ +if (defined($o_hp)) { + + # Get hp memory table + $resultat + = (version->parse(Net::SNMP->VERSION) < 4) + ? $session->get_table($hp_mem_pool) + : $session->get_table(Baseoid => $hp_mem_pool); + + if (!defined($resultat)) { + printf("ERROR: Description table : %s.\n", $session->error); + $session->close; + exit $ERRORS{"UNKNOWN"}; + } + my (@oid, @index) = (undef, undef); + my $nindex = 0; + foreach my $key (keys %$resultat) { + verb("OID : $key, Desc : $$resultat{$key}"); + if ($key =~ /$hp_mem_index/) { + @oid = split(/\./, $key); + $index[$nindex++] = pop(@oid); + } + } + + # Check if at least 1 memory slots exists + if ($nindex == 0) { + printf("ERROR: No memory slots found"); + $session->close; + exit $ERRORS{"UNKNOWN"}; + } + + # Consolidate the datas + my ($total, $free) = (0, 0); + my ($c_output, $prct_free) = (undef, undef); + foreach (@index) { + $c_output .= "," if defined($c_output); + $total += $$resultat{ $hp_mem_total . "." . $_ }; + $free += $$resultat{ $hp_mem_free . "." . $_ }; + $c_output + .= "Slot " + . $$resultat{ $hp_mem_index . "." . $_ } . ":" + . round(100 - ($$resultat{ $hp_mem_free . "." . $_ } * 100 / $$resultat{ $hp_mem_total . "." . $_ }), 0) + . "%"; + } + my $used = $total - $free; + $prct_free = round($used * 100 / ($total), 0); + verb("Used : $used, Free: $free, Output : $c_output"); + my $c_status = "OK"; + $c_output .= " : " . $prct_free . "% : "; + if (($o_crit != 0) && ($o_crit <= $prct_free)) { + $c_output .= " > " . $o_crit; + $c_status = "CRITICAL"; + } else { + if (($o_warn != 0) && ($o_warn <= $prct_free)) { + $c_output .= " > " . $o_warn; + $c_status = "WARNING"; + } + } + $c_output .= " ; " . $c_status; + if (defined($o_perf)) { + $c_output .= " | ram_used=" . $used . ";"; + $c_output .= ($o_warn == 0) ? ";" : round($o_warn * $total / 100, 0) . ";"; + $c_output .= ($o_crit == 0) ? ";" : round($o_crit * $total / 100, 0) . ";"; + $c_output .= "0;" . $total; + } + $session->close; + print "$c_output \n"; + exit $ERRORS{$c_status}; +} + +########### Net snmp memory check ############ +if (defined($o_netsnmp)) { + + # Get NetSNMP memory values + $resultat + = (version->parse(Net::SNMP->VERSION) < 4) + ? $session->get_request(@nets_oids) + : $session->get_request(-varbindlist => \@nets_oids); + + if (!defined($resultat)) { + printf("ERROR: netsnmp : %s.\n", $session->error); + $session->close; + exit $ERRORS{"UNKNOWN"}; + } + + my ($realused, $swapused) = (undef, undef); + my $totalcachedbuffered = 0; + if (defined($o_buffer)) { + $totalcachedbuffered = $$resultat{$nets_ram_buffer}; + } + if (!defined($o_cache)) { + $totalcachedbuffered = $totalcachedbuffered + $$resultat{$nets_ram_cache}; + } + + $realused = ($$resultat{$nets_ram_total} - ($$resultat{$nets_ram_free} + $totalcachedbuffered)) + / $$resultat{$nets_ram_total}; + + if ($$resultat{$nets_ram_total} == 0) { $realused = 0; } + + $swapused + = ($$resultat{$nets_swap_total} == 0) + ? 0 + : ($$resultat{$nets_swap_total} - $$resultat{$nets_swap_free}) / $$resultat{$nets_swap_total}; + $realused = round($realused * 100, 0); + $swapused = round($swapused * 100, 0); + verb( +"Ram : $$resultat{$nets_ram_free} ($$resultat{$nets_ram_cache} cached, $$resultat{$nets_ram_buffer} buff) / $$resultat{$nets_ram_total} : $realused" + ); + verb("Swap : $$resultat{$nets_swap_free} / $$resultat{$nets_swap_total} : $swapused"); + + my $n_status = "OK"; + my $n_output = "Ram : " . $realused . "%, Swap : " . $swapused . "% :"; + if ((($o_critR != 0) && ($o_critR <= $realused)) || (($o_critS != 0) && ($o_critS <= $swapused))) { + $n_output .= " > " . $o_critR . ", " . $o_critS; + $n_status = "CRITICAL"; + } else { + if ((($o_warnR != 0) && ($o_warnR <= $realused)) || (($o_warnS != 0) && ($o_warnS <= $swapused))) { + $n_output .= " > " . $o_warnR . ", " . $o_warnS; + $n_status = "WARNING"; + } + } + $n_output .= " ; " . $n_status; + if (defined($o_perf)) { + if (defined($o_cache)) { + $n_output .= " | ram_used=" . ($$resultat{$nets_ram_total} - $$resultat{$nets_ram_free}) . ";"; + } else { + $n_output .= " | ram_used=" + . ($$resultat{$nets_ram_total} - $$resultat{$nets_ram_free} - $$resultat{$nets_ram_cache}) . ";"; + } + $n_output .= ($o_warnR == 0) ? ";" : round($o_warnR * $$resultat{$nets_ram_total} / 100, 0) . ";"; + $n_output .= ($o_critR == 0) ? ";" : round($o_critR * $$resultat{$nets_ram_total} / 100, 0) . ";"; + $n_output .= "0;" . $$resultat{$nets_ram_total} . " "; + $n_output .= "swap_used=" . ($$resultat{$nets_swap_total} - $$resultat{$nets_swap_free}) . ";"; + $n_output .= ($o_warnS == 0) ? ";" : round($o_warnS * $$resultat{$nets_swap_total} / 100, 0) . ";"; + $n_output .= ($o_critS == 0) ? ";" : round($o_critS * $$resultat{$nets_swap_total} / 100, 0) . ";"; + $n_output .= "0;" . $$resultat{$nets_swap_total}; + } + $session->close; + print "$n_output \n"; + exit $ERRORS{$n_status}; + +} diff --git a/plugins/check_snmp_nsbox.pl b/plugins/check_snmp_nsbox.pl new file mode 100755 index 0000000..b177614 --- /dev/null +++ b/plugins/check_snmp_nsbox.pl @@ -0,0 +1,406 @@ +#!/usr/bin/perl -w +############################## check_snmp_nsbox ################# +# Version : 1.0 +# Date : Jan 16 2007 +# Author : Patrick Proy ( patrick at proy.org) +# Help : http://www.manubulon.com/nagios/ +# License : GPL - http://www.fsf.org/licenses/gpl.txt +# Changelog : +# Contributors : +################################################################# +# +# Help : ./check_snmp_nsbox.pl -h +# + +use strict; +use Net::SNMP; +use Getopt::Long; + +# Icinga specific +my $TIMEOUT = 15; +my %ERRORS = ('OK' => 0, 'WARNING' => 1, 'CRITICAL' => 2, 'UNKNOWN' => 3, 'DEPENDENT' => 4); + +# SNMP Datas +my $ns_service_status = "1.3.6.1.4.1.14020.2.2.1.3.0"; # service status 1= ok ?? + +my $ns_service_table = "1.3.6.1.4.1.14020.2.3"; # vhost & diode table +my $ns_vhost_table = "1.3.6.1.4.1.14020.2.3.1"; # vhost table +my $ns_vhost_name = "1.0"; # GUI Vhost Name +my $ns_vhost_requests = "2.0"; # Instant Vhost Requests per Second : NOT POPULATED IN V 2.0.8 +my $ns_vhost_Trequests = "2.0"; # Total Vhost Requests : NOT POPULATED IN V 2.0.8 +my $ns_diode_table = "1.3.6.1.4.1.14020.2.3.2"; # diode table +my $ns_diode_name = "1.0"; # GUI Diode Name +my $ns_diode_status = "2.0"; # Last diode Status (" " = OK?) (undocumented) + +my $ns_rsa_prct_usage = ".1.3.6.1.4.1.14020.1.1.1.3.0"; # % usage of RSA operations. (undocumented) +my $ns_rsa_oper_second = ".1.3.6.1.4.1.14020.1.1.3.4.0;"; # number of RSA operations/s (undocumented) + +# Globals + +my $VERSION = "2.0.0"; + +my $o_host = undef; # hostname +my $o_community = undef; # community +my $o_port = 161; # port +my $o_help = undef; # wan't some help ? +my $o_verb = undef; # verbose mode +my $o_version = undef; # print version +my $o_timeout = undef; # Timeout (Default 5) +my $o_perf = undef; # Output performance data +my $o_version2 = undef; # use snmp v2c + +# specific +my $o_vhost = undef; # vhost regexp +my $o_diode = undef; # diode regexp +my $o_nvhost = undef; # vhost number +my $o_ndiode = undef; # diode number + +# SNMPv3 specific +my $o_login = undef; # Login for snmpv3 +my $o_passwd = undef; # Pass for snmpv3 +my $v3protocols = undef; # V3 protocol list. +my $o_authproto = 'md5'; # Auth protocol +my $o_privproto = 'des'; # Priv protocol +my $o_privpass = undef; # priv password + +# functions + +sub p_version { print "check_snmp_nsbox version : $VERSION\n"; } + +sub print_usage { + print +"Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) -d -s -n , [-p ] [-f] [-t ] [-V]\n"; +} + +sub isnnum { # Return true if arg is not a number + my $num = shift; + if ($num =~ /^(\d+\.?\d*)|(^\.\d+)$/) { return 0; } + return 1; +} + +sub set_status { # return worst status with this order : OK, unknwonw, warning, critical + my $new_status = shift; + my $cur_status = shift; + if (($cur_status == 0) || ($new_status == $cur_status)) { return $new_status; } + if ($new_status == 3) { return $cur_status; } + if ($new_status > $cur_status) { return $new_status; } + return $cur_status; +} + +sub is_pattern_valid { # Test for things like "" or "+5-i" + my $pat = shift; + if (!defined($pat)) { $pat = " "; } # Just to get rid of compilation time warnings + return eval { "" =~ /$pat/; 1 } || 0; +} + +sub help { + print "\nSNMP NetSecureOne Netbox monitor for Icinga/Nagios/Naemon/Shinken, Version ", $VERSION, "\n"; + print "(c)2004-2006 Patrick Proy\n\n"; + print_usage(); + print <, + : Authentication protocol (md5|sha : default md5) + : Priv protocole (des|aes : default des) +-d, --diode= + Diode selection by regexp +-s, --vhost= + Vhost selection by regexp +-n, --number=, + number of diode and vhost that must be up. +-P, --port=PORT + SNMP port (Default 161) +-f, --perfparse, --perfdata + Performance data output +-t, --timeout=INTEGER + timeout for SNMP in seconds (Default: 5) +-V, --version + prints version number +EOT +} + +# For verbose output +sub verb { my $t = shift; print $t, "\n" if defined($o_verb); } + +sub check_options { + Getopt::Long::Configure("bundling"); + GetOptions( + 'v' => \$o_verb, + 'verbose' => \$o_verb, + 'h' => \$o_help, + 'help' => \$o_help, + 'H:s' => \$o_host, + 'hostname:s' => \$o_host, + 'p:i' => \$o_port, + 'port:i' => \$o_port, + 'C:s' => \$o_community, + 'community:s' => \$o_community, + 'l:s' => \$o_login, + 'login:s' => \$o_login, + 'x:s' => \$o_passwd, + 'passwd:s' => \$o_passwd, + 'X:s' => \$o_privpass, + 'privpass:s' => \$o_privpass, + 'L:s' => \$v3protocols, + 'protocols:s' => \$v3protocols, + 't:i' => \$o_timeout, + 'timeout:i' => \$o_timeout, + 'V' => \$o_version, + 'version' => \$o_version, + '2' => \$o_version2, + 'v2c' => \$o_version2, + 'f' => \$o_perf, + 'perfparse' => \$o_perf, + 'perfdata' => \$o_perf, + 'd:s' => \$o_diode, + 'diode:s' => \$o_diode, + 's:s' => \$o_vhost, + 'vhost:s' => \$o_vhost, + 'n:s' => \$o_nvhost, + 'number:s' => \$o_nvhost + ); + + # Basic checks + if (defined($o_timeout) && (isnnum($o_timeout) || ($o_timeout < 2) || ($o_timeout > 60))) { + print "Timeout must be >1 and <60 !\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (!defined($o_timeout)) { $o_timeout = 5; } + if (defined($o_help)) { help(); exit $ERRORS{"UNKNOWN"} } + if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"} } + if (!defined($o_host)) # check host and filter + { + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + + # check snmp information + if (!defined($o_community) && (!defined($o_login) || !defined($o_passwd))) { + print "Put snmp login info!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if ((defined($o_login) || defined($o_passwd)) && (defined($o_community) || defined($o_version2))) { + print "Can't mix snmp v1,2c,3 protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (defined($v3protocols)) { + if (!defined($o_login)) { + print "Put snmp V3 login info with protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + my @v3proto = split(/,/, $v3protocols); + if ((defined($v3proto[0])) && ($v3proto[0] ne "")) { $o_authproto = $v3proto[0]; } # Auth protocol + if (defined($v3proto[1])) { $o_privproto = $v3proto[1]; } # Priv protocol + if ((defined($v3proto[1])) && (!defined($o_privpass))) { + print "Put snmp V3 priv login info with priv protocols!\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + } + if (!defined($o_vhost) || !(is_pattern_valid($o_vhost))) { + print "Vhost selection must be set and be a valid regexp (-s)\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (!defined($o_diode) || !(is_pattern_valid($o_diode))) { + print "Diode selection must be set and be a valid regexp (-d)\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + if (!defined($o_nvhost)) { + print "Diode and vhost number must be set (-n)\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + my @nsbox_number = split(/,/, $o_nvhost); + if ($#nsbox_number != 1) { print "2 numbers must be set with -n option\n"; print_usage(); exit $ERRORS{"UNKNOWN"} } + if (isnnum($nsbox_number[0]) || isnnum($nsbox_number[1])) { + print "2 numbers must be set with -n option\n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } + $o_ndiode = $nsbox_number[0]; + $o_nvhost = $nsbox_number[1]; +} + +########## MAIN ####### + +check_options(); + +# Check gobal timeout if snmp screws up +if (defined($TIMEOUT)) { + verb("Alarm at $TIMEOUT + 5"); + alarm($TIMEOUT + 5); +} else { + verb("no global timeout defined : $o_timeout + 10"); + alarm($o_timeout + 10); +} + +# Connect to host +my ($session, $error); +if (defined($o_login) && defined($o_passwd)) { + + # SNMPv3 login + verb("SNMPv3 login"); + if (!defined($o_privpass)) { + verb("SNMPv3 AuthNoPriv login : $o_login, $o_authproto"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => '3', + -username => $o_login, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, + -timeout => $o_timeout + ); + } else { + verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => '3', + -username => $o_login, + -authpassword => $o_passwd, + -authprotocol => $o_authproto, + -privpassword => $o_privpass, + -privprotocol => $o_privproto, + -timeout => $o_timeout + ); + } +} else { + if (defined($o_version2)) { + + # SNMPv2 Login + verb("SNMP v2c login"); + ($session, $error) = Net::SNMP->session( + -hostname => $o_host, + -version => 2, + -community => $o_community, + -port => $o_port, + -timeout => $o_timeout + ); + } else { + + # SNMPV1 login + verb("SNMP v1 login"); + ($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 $ERRORS{"UNKNOWN"}; +} + +########### check global status ############## +my @oidlist = ($ns_service_status); +my $resultat + = (version->parse(Net::SNMP->VERSION) < 4) + ? $session->get_request(@oidlist) + : $session->get_request(-varbindlist => \@oidlist); + +if (!defined($resultat) || ($$resultat{$ns_service_status} eq "noSuchObject")) { + printf("ERROR: Global status oid not found : %s.\n", $session->error); + $session->close; + exit $ERRORS{"UNKNOWN"}; +} + +if ($$resultat{$ns_service_status} != 1) { + print "Global service is in state ", $$resultat{$ns_service_status}, " : CRITICAL\n"; + exit $ERRORS{"CRITICAL"}; +} + +########### check vhost & diode status ############## +$resultat = undef; +$resultat + = (version->parse(Net::SNMP->VERSION) < 4) + ? $session->get_table($ns_service_table) + : $session->get_table(Baseoid => $ns_service_table); + +if (!defined($resultat)) { + printf("ERROR: vhost and diode status table : %s.\n", $session->error); + $session->close; + exit $ERRORS{"UNKNOWN"}; +} +$session->close; + +my $output = ""; +my $output_perf = ""; +my ($index, $name) = undef; +my ($nvhost, $ndiode) = (0, 0); +my (@found_vhost, @found_diode) = (undef, undef); + +foreach my $key (keys %$resultat) { + verb("OID : $key, Desc : $$resultat{$key}"); + if ($key =~ /($ns_vhost_table)\.(\d+)\.($ns_vhost_name)/) { # Get index of vhost with name + $index = $2; + $name = $$resultat{$key}; + if ($name =~ /$o_vhost/) { + $found_vhost[$nvhost++] = $name; + verb("found vhost $name"); + } + } + if ($key =~ /($ns_diode_table)\.(\d+)\.($ns_diode_name)/) { # Get index of diode with name + $index = $2; + $name = $$resultat{$key}; + if ($name =~ /$o_diode/) { + + # TODO Check diode status : undocumented for now. + $found_diode[$ndiode++] = $name; + verb("found diode $name"); + } + } +} + +if (($ndiode < $o_ndiode) || ($nvhost < $o_nvhost)) { + $output = "Diode"; + if ($ndiode == 0) { $output .= ": none "; } + else { + $output .= "(" . $ndiode . "): :"; + for (my $i = 0; $i < $ndiode; $i++) { + $output .= $found_diode[$i] . " "; + } + } + $output .= "Vhost"; + if ($nvhost == 0) { $output .= ": none "; } + else { + $output .= "(" . $nvhost . "): :"; + for (my $i = 0; $i < $nvhost; $i++) { + $output .= $found_vhost[$i] . " "; + } + } + $output .= " < " . $o_ndiode . "," . $o_nvhost . " : CRITICAL"; + print $output, "\n"; + exit $ERRORS{"CRITICAL"}; +} + +$output = $ndiode . " diodes, " . $nvhost . " vhosts :"; +if (($ndiode > $o_ndiode) || ($nvhost > $o_nvhost)) { + $output .= " > " . $o_ndiode . "," . $o_nvhost . " : WARNING"; +} else { + $output .= " OK"; +} +print $output, "\n"; +exit $ERRORS{"OK"}; + diff --git a/plugins/check_snmp_process.pl b/plugins/check_snmp_process.pl new file mode 100755 index 0000000..22f2cc9 --- /dev/null +++ b/plugins/check_snmp_process.pl @@ -0,0 +1,848 @@ +#!/usr/bin/perl -w +############################## check_snmp_process ############## +my $VERSION = "2.0.0"; + +# Date : Oct 12 2007 +# Author : Patrick Proy (patrick at proy dot org) +# Help : http://nagios.manubulon.com +# License : GPL - http://www.fsf.org/licenses/gpl.txt +# Contrib : Makina Corpus, adam At greekattic d0t com +# TODO : put $o_delta as an option +# If testing on localhost, selects itself.... +############################################################### +# +# help : ./check_snmp_process -h + +use strict; +use Net::SNMP; +use Getopt::Long; + +############### BASE DIRECTORY FOR TEMP FILE ######## +my $o_base_dir = "/tmp/tmp_Icinga_proc."; +my $file_history = 200; # number of data to keep in files. +my $delta_of_time_to_make_average = 300; # 5minutes by default + +# Icinga specific +my $TIMEOUT = 15; +my %ERRORS = ('OK' => 0, 'WARNING' => 1, 'CRITICAL' => 2, 'UNKNOWN' => 3, 'DEPENDENT' => 4); + +# SNMP Datas +my $process_table = '1.3.6.1.2.1.25.4.2.1'; +my $index_table = '1.3.6.1.2.1.25.4.2.1.1'; +my $run_name_table = '1.3.6.1.2.1.25.4.2.1.2'; +my $run_path_table = '1.3.6.1.2.1.25.4.2.1.4'; +my $run_param_table = '1.3.6.1.2.1.25.4.2.1.5'; +my $proc_mem_table = '1.3.6.1.2.1.25.5.1.1.2'; # Kbytes +my $proc_cpu_table = '1.3.6.1.2.1.25.5.1.1.1'; # Centi sec of CPU +my $proc_run_state = '1.3.6.1.2.1.25.4.2.1.7'; + +# Globals + +my $o_host = undef; # hostname +my $o_community = undef; # community +my $o_port = 161; # port +my $o_domain = 'udp/ipv4'; # Default to UDP over IPv4 +my $o_version2 = undef; #use snmp v2c +my $o_descr = undef; # description filter +my $o_warn = 0; # warning limit +my @o_warnL = undef; # warning limits (min,max) +my $o_crit = 0; # critical limit +my @o_critL = undef; # critical limits (min,max) +my $o_help = undef; # wan't some help ? +my $o_verb = undef; # verbose mode +my $o_version = undef; # print version +my $o_noreg = undef; # Do not use Regexp for name +my $o_path = undef; # check path instead of name +my $o_inverse = undef; # checks max instead of min number of process +my $o_get_all = undef; # get all tables at once +my $o_param = undef; # Add process parameters for selection +my $o_perf = undef; # Add performance output +my $o_timeout = 5; # Default 5s Timeout + +# SNMP V3 specific +my $o_login = undef; # snmp v3 login +my $o_passwd = undef; # snmp v3 passwd +my $v3protocols = undef; # V3 protocol list. +my $o_authproto = 'md5'; # Auth protocol +my $o_privproto = 'des'; # Priv protocol +my $o_privpass = undef; # priv password + +# SNMP Message size parameter (Makina Corpus contrib) +my $o_octetlength = undef; + +# Memory & CPU +my $o_mem = undef; # checks memory (max) +my @o_memL = undef; # warn and crit level for mem +my $o_mem_avg = undef; # cheks memory average +my $o_cpu = undef; # checks CPU usage +my @o_cpuL = undef; # warn and crit level for cpu +my $o_delta = $delta_of_time_to_make_average; # delta time for CPU check + +# functions + +sub p_version { print "check_snmp_process version : $VERSION\n"; } + +sub print_usage { + print +"Usage: $0 [-v] -H -C [-2] | (-l login -x passwd) [-p ] [-P ] -n [-w [,] -c [,max_proc] ] [-m, -a -u, -d ] [-t ] [-o ] [-f -A -F ] [-r] [-V] [-g]\n"; +} + +sub isnotnum { # Return true if arg is not a number + my $num = shift; + if ($num =~ /^-?(\d+\.?\d*)|(^\.\d+)$/) { return 0; } + return 1; +} + +sub read_file { + + # Input : File, items_number + # Returns : array of value : [line][item] + my ($traffic_file, $items_number) = @_; + my ($ligne, $n_rows) = (undef, 0); + my (@last_values, @file_values, $i); + open(FILE, "<" . $traffic_file) || return (1, 0, 0); + + while ($ligne = ) { + chomp($ligne); + @file_values = split(":", $ligne); + + #verb("@file_values"); + if ($#file_values >= ($items_number - 1)) { + + # check if there is enough data, else ignore line + for ($i = 0; $i < $items_number; $i++) { $last_values[$n_rows][$i] = $file_values[$i]; } + $n_rows++; + } + } + close FILE; + if ($n_rows != 0) { + return (0, $n_rows, @last_values); + } else { + return (1, 0, 0); + } +} + +sub write_file { + + # Input : file , rows, items, array of value : [line][item] + # Returns : 0 / OK, 1 / error + my ($file_out, $rows, $item, @file_values) = @_; + my $start_line = ($rows > $file_history) ? $rows - $file_history : 0; + if (open(FILE2, ">" . $file_out)) { + for (my $i = $start_line; $i < $rows; $i++) { + for (my $j = 0; $j < $item; $j++) { + print FILE2 $file_values[$i][$j]; + if ($j != ($item - 1)) { print FILE2 ":" } + } + print FILE2 "\n"; + } + close FILE2; + return 0; + } else { + return 1; + } +} + +sub help { + print "\nSNMP Process Monitor for Icinga/Nagios/Naemon/Shinken, Version ", $VERSION, "\n"; + print "GPL license, (c)2004-2006 Patrick Proy\n\n"; + print_usage(); + print <, + : Authentication protocol (md5|sha : default md5) + : Priv protocole (des|aes : default des) +-p, --port=PORT + SNMP port (Default 161) +-P, --protocol=PROTOCOL + Network protocol to be used + ['udp/ipv4'] : UDP over IPv4 + 'udp/ipv6' : UDP over IPv6 + 'tcp/ipv4' : TCP over IPv4 + 'tcp/ipv6' : TCP over IPv6 +-n, --name=NAME + Name of the process (regexp) + No trailing slash ! +-r, --noregexp + Do not use regexp to match NAME in description OID +-f, --fullpath + Use full path name instead of process name + (Windows doesn't provide full path name) +-A, --param + Add parameters to select processes. + ex : "named.*-t /var/named/chroot" will only select named process with this parameter +-F, --perfout + Add performance output + outputs : memory_usage, num_process, cpu_usage +-w, --warn=MIN[,MAX] + Number of process that will cause a warning + -1 for no warning, MAX must be >0. Ex : -w-1,50 +-c, --critical=MIN[,MAX] + number of process that will cause an error ( + -1 for no critical, MAX must be >0. Ex : -c-1,50 +Notes on warning and critical : + with the following options : -w m1,x1 -c m2,x2 + you must have : m2 <= m1 < x1 <= x2 + you can omit x1 or x2 or both +-m, --memory=WARN,CRIT + checks memory usage (default max of all process) + values are warning and critical values in Mb +-a, --average + makes an average of memory used by process instead of max +-u, --cpu=WARN,CRIT + checks cpu usage of all process + values are warning and critical values in % of CPU usage + if more than one CPU, value can be > 100% : 100%=1 CPU +-d, --delta=seconds + make an average of seconds for CPU (default 300=5min) +-g, --getall + In some cases, it is necessary to get all data at once because + process die very frequently. + This option eats bandwidth an cpu (for remote host) at breakfast. +-o, --octetlength=INTEGER + max-size of the SNMP message, usefull in case of Too Long responses. + Be carefull with network filters. Range 484 - 65535, default are + usually 1472,1452,1460 or 1440. +-t, --timeout=INTEGER + timeout for SNMP in seconds (Default: 5) +-V, --version + prints version number +Note : + CPU usage is in % of one cpu, so maximum can be 100% * number of CPU + example : + Browse process list : +- + + + + ----------- + + +- SourceForge.net Logo ++ http://sourceforge.net/projects/nagios-snmp + + + +@@ -295,7 +284,7 @@

This project is also hosted by :
@@ -21,7 +47,24 @@ Date: Sun Mar 2 21:22:42 2014 +0100 --- a/doc/html/nagios.manubulon.com/index_commands.html +++ b/doc/html/nagios.manubulon.com/index_commands.html -@@ -104,7 +104,7 @@ +@@ -87,24 +87,13 @@ + + + +- +- + + + ----------- @@ -30,7 +73,7 @@ Date: Sun Mar 2 21:22:42 2014 +0100 -@@ -2004,7 +2004,7 @@ +@@ -2004,7 +1993,7 @@

This project is hosted on :
@@ -74,7 +117,33 @@ Date: Sun Mar 2 21:22:42 2014 +0100 --- a/doc/html/nagios.manubulon.com/snmp_int.html +++ b/doc/html/nagios.manubulon.com/snmp_int.html -@@ -687,7 +687,7 @@ +@@ -116,24 +116,13 @@ + + + +- +- + + + + ----------- + + +- SourceForge.net Logo ++ http://sourceforge.net/projects/nagios-snmp + + + +@@ -687,7 +676,7 @@

This project is hosted on :
@@ -118,7 +187,33 @@ Date: Sun Mar 2 21:22:42 2014 +0100 trademarks of Ethan Galstad.

--- a/doc/html/nagios.manubulon.com/snmp_storage.html +++ b/doc/html/nagios.manubulon.com/snmp_storage.html -@@ -1278,7 +1278,7 @@ +@@ -175,24 +175,13 @@ + + + +- +- + + + + ----------- + + +- SourceForge.net Logo ++ http://sourceforge.net/projects/nagios-snmp + + + +@@ -1278,7 +1267,7 @@ @@ -129,7 +224,33 @@ Date: Sun Mar 2 21:22:42 2014 +0100 --- a/doc/html/nagios.manubulon.com/snmp_vrrp.html +++ b/doc/html/nagios.manubulon.com/snmp_vrrp.html -@@ -348,7 +348,7 @@ +@@ -94,24 +94,13 @@ + + + +- +- + + + + ----------- + + +- SourceForge.net Logo ++ http://sourceforge.net/projects/nagios-snmp + + + +@@ -348,7 +337,7 @@

This project is hosted on :
@@ -149,3 +270,125 @@ Date: Sun Mar 2 21:22:42 2014 +0100

Nagios and the Nagios logo are registered trademarks of Ethan Galstad.

+--- a/doc/html/nagios.manubulon.com/index.html ++++ b/doc/html/nagios.manubulon.com/index.html +@@ -88,24 +88,13 @@ + + + +- +- + + + + ----------- + + +- SourceForge.net Logo ++ http://sourceforge.net/projects/nagios-snmp + + + +@@ -339,7 +328,7 @@ + +

All code here is under GPL licence.

+

This project is hosted on :
+- SourceForge.net Logo

++ http://sourceforge.net/projects/nagios-snmp

+

Nagios and the Nagios logo are registered + trademarks of Ethan Galstad.

+ +--- a/doc/html/nagios.manubulon.com/index_info.html ++++ b/doc/html/nagios.manubulon.com/index_info.html +@@ -86,24 +86,13 @@ + + + +- +- + + + + ----------- + + +-
SourceForge.net Logo ++ http://sourceforge.net/projects/nagios-snmp + + + +@@ -588,7 +577,7 @@ + +
+

This project is hosted on :
+- SourceForge.net Logo ++ http://sourceforge.net/projects/nagios-snmp +

+

Nagios and the Nagios logo are registered + trademarks of Ethan Galstad.

+--- a/doc/html/nagios.manubulon.com/index_snmp.html ++++ b/doc/html/nagios.manubulon.com/index_snmp.html +@@ -86,24 +86,13 @@ + + + +- +- + + + + ----------- + + +- SourceForge.net Logo ++ http://sourceforge.net/projects/nagios-snmp + + + +@@ -437,7 +426,7 @@ + +
+

This project is hosted on :
+- SourceForge.net Logo ++ http://sourceforge.net/projects/nagios-snmp +

+

Nagios and the Nagios logo are registered + trademarks of Ethan Galstad.

+--- a/doc/html/nagios.manubulon.com/package_c.html ++++ b/doc/html/nagios.manubulon.com/package_c.html +@@ -162,7 +162,7 @@ + +

This project is hosted on :
+ +- SourceForge.net Logo ++ http://sourceforge.net/projects/nagios-snmp + +

+ From 117e4008742c715f93b4eea0fe676ccc3ff3d9f5 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 29 Nov 2017 17:30:37 +0100 Subject: [PATCH 129/205] d/control: Bump Standards-Version to 4.1.1, no changes needed --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index fd5c11a..f1c8544 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Build-Depends: debhelper (>= 5) Homepage: http://www.manubulon.com/nagios/index_snmp.html Vcs-Browser: https://anonscm.debian.org/cgit/pkg-nagios/pkg-nagios-snmp-plugins.git Vcs-Git: https://anonscm.debian.org/git/pkg-nagios/pkg-nagios-snmp-plugins -Standards-Version: 3.9.8 +Standards-Version: 4.1.1 Package: nagios-snmp-plugins Architecture: all From f2e8ac9d62af405eaa606c1192d80e07f8be2a34 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 29 Nov 2017 20:06:39 +0100 Subject: [PATCH 130/205] d/docs: Fix location of the README --- debian/docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/docs b/debian/docs index cc35a19..b43bf86 100644 --- a/debian/docs +++ b/debian/docs @@ -1 +1 @@ -plugins/README +README.md From c0535e4989a15caf3053d4064cc362ea75104d32 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 29 Nov 2017 17:43:10 +0100 Subject: [PATCH 131/205] Adding .travis-ci.yml --- .travis.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..7f8109c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,20 @@ +sudo: required + +env: + - TRAVIS_DEBIAN_DISTRIBUTION=unstable + - TRAVIS_DEBIAN_DISTRIBUTION=testing + - TRAVIS_DEBIAN_DISTRIBUTION=stable + +services: + - docker + +script: + # build the debian package + - wget -O- http://travis.debian.net/script.sh | sh - + +#notifications: +# email: false + +branches: + except: + - /^debian\/\d/ From 019d443c1fc617459093d5e937f72869ea536567 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 11 Mar 2018 15:56:10 +0100 Subject: [PATCH 132/205] d/control: Update VCS-headers --- debian/control | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/control b/debian/control index f1c8544..78dc81f 100644 --- a/debian/control +++ b/debian/control @@ -5,8 +5,8 @@ Maintainer: Debian Nagios Maintainer Group Build-Depends: debhelper (>= 5) Homepage: http://www.manubulon.com/nagios/index_snmp.html -Vcs-Browser: https://anonscm.debian.org/cgit/pkg-nagios/pkg-nagios-snmp-plugins.git -Vcs-Git: https://anonscm.debian.org/git/pkg-nagios/pkg-nagios-snmp-plugins +Vcs-Browser: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins +Vcs-Git: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins.git Standards-Version: 4.1.1 Package: nagios-snmp-plugins From c07faf2ca92e2ac3c9f66ae5e72cc815f483a739 Mon Sep 17 00:00:00 2001 From: Bas Couwenberg Date: Thu, 5 Jul 2018 11:39:19 +0200 Subject: [PATCH 133/205] Bump Standards-Version to 4.1.5, no changes. --- debian/changelog | 1 + debian/control | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 3fbdff7..7780ce4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ nagios-snmp-plugins (2.1.0-1~1.gbp0ced9d) UNRELEASED; urgency=medium * UNRELEASED * [75687e0] New upstream version 2.1.0 + * Bump Standards-Version to 4.1.5, no changes. -- Jan Wagner Wed, 29 Nov 2017 16:30:09 +0100 diff --git a/debian/control b/debian/control index 78dc81f..f3d5bed 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Build-Depends: debhelper (>= 5) Homepage: http://www.manubulon.com/nagios/index_snmp.html Vcs-Browser: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins Vcs-Git: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins.git -Standards-Version: 4.1.1 +Standards-Version: 4.1.5 Package: nagios-snmp-plugins Architecture: all From 53cdb548efe21601d0d45382bf19ba5196c4a37b Mon Sep 17 00:00:00 2001 From: Bas Couwenberg Date: Sun, 5 Aug 2018 21:12:03 +0200 Subject: [PATCH 134/205] Bump Standards-Version to 4.2.0, no changes. --- debian/changelog | 2 +- debian/control | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 7780ce4..331e6f2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,7 +2,7 @@ nagios-snmp-plugins (2.1.0-1~1.gbp0ced9d) UNRELEASED; urgency=medium * UNRELEASED * [75687e0] New upstream version 2.1.0 - * Bump Standards-Version to 4.1.5, no changes. + * Bump Standards-Version to 4.2.0, no changes. -- Jan Wagner Wed, 29 Nov 2017 16:30:09 +0100 diff --git a/debian/control b/debian/control index f3d5bed..70e2e60 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Build-Depends: debhelper (>= 5) Homepage: http://www.manubulon.com/nagios/index_snmp.html Vcs-Browser: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins Vcs-Git: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins.git -Standards-Version: 4.1.5 +Standards-Version: 4.2.0 Package: nagios-snmp-plugins Architecture: all From 70b71385af5664f291c3239da6203b81b5b0810a Mon Sep 17 00:00:00 2001 From: Bas Couwenberg Date: Tue, 28 Aug 2018 18:49:13 +0200 Subject: [PATCH 135/205] Bump Standards-Version to 4.2.1, no changes. --- debian/changelog | 2 +- debian/control | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 331e6f2..f7cd9ab 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,7 +2,7 @@ nagios-snmp-plugins (2.1.0-1~1.gbp0ced9d) UNRELEASED; urgency=medium * UNRELEASED * [75687e0] New upstream version 2.1.0 - * Bump Standards-Version to 4.2.0, no changes. + * Bump Standards-Version to 4.2.1, no changes. -- Jan Wagner Wed, 29 Nov 2017 16:30:09 +0100 diff --git a/debian/control b/debian/control index 70e2e60..f28ce62 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Build-Depends: debhelper (>= 5) Homepage: http://www.manubulon.com/nagios/index_snmp.html Vcs-Browser: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins Vcs-Git: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins.git -Standards-Version: 4.2.0 +Standards-Version: 4.2.1 Package: nagios-snmp-plugins Architecture: all From 3d095b1adc259f0fada8da6487ffe5dbef401b6f Mon Sep 17 00:00:00 2001 From: Bas Couwenberg Date: Tue, 25 Dec 2018 23:31:38 +0100 Subject: [PATCH 136/205] Bump Standards-Version to 4.3.0, no changes. --- debian/changelog | 2 +- debian/control | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index f7cd9ab..608731d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,7 +2,7 @@ nagios-snmp-plugins (2.1.0-1~1.gbp0ced9d) UNRELEASED; urgency=medium * UNRELEASED * [75687e0] New upstream version 2.1.0 - * Bump Standards-Version to 4.2.1, no changes. + * Bump Standards-Version to 4.3.0, no changes. -- Jan Wagner Wed, 29 Nov 2017 16:30:09 +0100 diff --git a/debian/control b/debian/control index f28ce62..485ef3b 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Build-Depends: debhelper (>= 5) Homepage: http://www.manubulon.com/nagios/index_snmp.html Vcs-Browser: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins Vcs-Git: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins.git -Standards-Version: 4.2.1 +Standards-Version: 4.3.0 Package: nagios-snmp-plugins Architecture: all From cb6672991633766190b88fdb96d8e69ee748bd85 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 23 Jan 2019 20:02:42 +0100 Subject: [PATCH 137/205] Delete old unused patches --- debian/patches/01_update_pre_1.1.2 | 1571 ----------------- debian/patches/10_fix_net_snmp_version | 439 ----- debian/patches/15_check_snmp_storage_64bit | 163 -- debian/patches/16_perfdata | 266 --- debian/patches/17_protocol_fam | 385 ---- debian/patches/18_check_snmp_process_tmp_file | 32 - debian/patches/19_check_snmp_load_n5k | 97 - .../patches/20_check_snmp_load_multiple_cpus | 64 - ...heck_snmp_load_abstract_snmp_version_check | 121 -- debian/patches/22_remove_utils_pm | 509 ------ .../patches/23_check_snmp_load_drop_debugging | 22 - debian/patches/24_check_snmp_int_use_ifname | 63 - debian/patches/series | 12 - 13 files changed, 3744 deletions(-) delete mode 100644 debian/patches/01_update_pre_1.1.2 delete mode 100644 debian/patches/10_fix_net_snmp_version delete mode 100644 debian/patches/15_check_snmp_storage_64bit delete mode 100644 debian/patches/16_perfdata delete mode 100644 debian/patches/17_protocol_fam delete mode 100644 debian/patches/18_check_snmp_process_tmp_file delete mode 100644 debian/patches/19_check_snmp_load_n5k delete mode 100644 debian/patches/20_check_snmp_load_multiple_cpus delete mode 100644 debian/patches/21_check_snmp_load_abstract_snmp_version_check delete mode 100644 debian/patches/22_remove_utils_pm delete mode 100644 debian/patches/23_check_snmp_load_drop_debugging delete mode 100644 debian/patches/24_check_snmp_int_use_ifname diff --git a/debian/patches/01_update_pre_1.1.2 b/debian/patches/01_update_pre_1.1.2 deleted file mode 100644 index 9a28014..0000000 --- a/debian/patches/01_update_pre_1.1.2 +++ /dev/null @@ -1,1571 +0,0 @@ -## 01_update_pre_1.1.2 by Jan Wagner -## -## DP: Update to the latest know CVS verions - ---- a/Changelog -+++ b/Changelog -@@ -1,4 +1,38 @@ - ################################ -+Release 1.1.2 / Jun 2007 : -+ -+Scripts, actual CVS version and changelog : -+check_snmp_mem.pl : 1.3 -+check_snmp_vrrp.pl : 1.3 -+check_snmp_linkproof_nhr.pl : 1.1 -+check_snmp_process.pl : 1.7 -+ - Added option to select process with his parameter -+ - Added option for performance output -+ - Corrected negative CPU when process restarts -+ - Added delta option for cpu average (-d option) -+check_snmp_boostedge.pl : 1.2 -+check_snmp_nsbox.pl : 1.2 -+check_snmp_css_main.pl : 1.1 -+check_snmp_cpfw.pl : 1.7 -+check_snmp_int.pl : 1.22 -+ - Correct speed query for interface > 4 Gbps -+ - Reduced snmp queries to 2 instead of 3 when perf data is on -+ - Bad maximum in perfdata when in Bps -+ - Added option to make dormant state OK -+check_snmp_storage.pl : 1.10 -+ - Return an UNKNOWN status when size/used/alloc is not defined in snmp -+ - Patch from Alexander Greiner-B?r to remove the reserved disk space for superuser on ext2/3 FS. -+ New -R option for this -+ - Added -G (giga) option for output & levels in Gigabytes -+check_snmp_win.pl : 0.6 -+check_snmp_css.pl : 1.3 -+check_snmp_env.pl : 1.8 -+ - Added test to check existence of some OIDs -+check_snmp_load.pl : 1.11 -+ - Corrected bug in performance output -+ - Added SIG{ALRM} sub and % sign in output -+ -+################################ - Release 1.1.1 / April 2007 : - - Added documentation in doc/ directory : (html format). ---- /dev/null -+++ b/INSTALL -@@ -0,0 +1,15 @@ -+Installation: -+------------- -+ -+You can simply copy the .pl files to the Nagios Plugin directory if -+- Nagios plugins and utils.pm file are in /usr/local/nagios/libexec. -+- You are sure Net::SNMP is installed. (Getopt::Long is standard). -+- perl is in /usr/bin/perl -+- Temp files can be written by Nagios in /tmp -+ -+You can also use the "install.sh" script provided in this directory to install the plugins. -+Type : "./install.sh" to install all the plugins or "./install.sh " for a specific one. -+ -+The script will check for dependencies and ask for Nagios and temp directories. -+It will modify the scripts depending on these answers and install the scripts. -+ ---- a/README -+++ b/README -@@ -1,4 +1,4 @@ --Nagios SNMP plugins 1.1.1 README -+Nagios SNMP plugins 1.1.2 README - ------------------------------ - - -@@ -32,7 +32,7 @@ - Legal stuff: - ------------ - -- Nagios SNMP plugins version 1.1.1, Copyright (C) 2004-2007 Patrick Proy (nagios at proy.org) -+ Nagios SNMP plugins version 1.1.2, Copyright (C) 2004-2007 Patrick Proy (nagios at proy.org) - - 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 ---- a/check_snmp_cpfw.pl -+++ b/check_snmp_cpfw.pl -@@ -1,10 +1,11 @@ - #!/usr/bin/perl -w - ############################## check_snmp_cpfw ############## --# Version : 1.2.1 --# Date : April 19 2007 -+my $Version='1.8'; -+# Date : Oct 20 2007 - # Author : Patrick Proy (patrick at proy.org) - # Help : http://nagios.manubulon.com - # Licence : GPL - http://www.fsf.org/licenses/gpl.txt -+# Contrib : StaGue - # TODO : - # - check sync method - ################################################################# -@@ -18,10 +19,8 @@ - - # Nagios specific - --use lib "/usr/local/nagios/libexec"; --use utils qw(%ERRORS $TIMEOUT); --#my $TIMEOUT = 15; --#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); -+my $TIMEOUT = 15; -+my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - - ########### SNMP Datas ########### - -@@ -73,8 +72,6 @@ - - #################################### Globals ##############################"" - --my $Version='1.2.1'; -- - my $o_host = undef; # hostname - my $o_community = undef; # community - my $o_version2 =undef; # Version 2 -@@ -247,7 +244,7 @@ - } - - $SIG{'ALRM'} = sub { -- print "No answer from host\n"; -+ print "No answer from host $o_host:$o_port\n"; - exit $ERRORS{"UNKNOWN"}; - }; - -@@ -332,15 +329,15 @@ - } - } - } else { -- $svn_print .= "cannot find oids"; -+ $svn_print .= "cannot find OIDs"; - #Critical state if not found because it means soft is not activated - $svn_state=2; - } - - if ($svn_state == 0) { -- $svn_print="SVN : OK"; -+ $svn_print="SVN: OK"; - } else { -- $svn_print="SVN : " . $svn_print; -+ $svn_print="SVN: " . $svn_print; - } - verb("$svn_print"); - } -@@ -363,14 +360,14 @@ - } - } - } else { -- $mgmt_print .= "cannot find oids"; -+ $mgmt_print .= "cannot find OIDs"; - #Critical state if not found because it means soft is not activated - $mgmt_state=2; - } - if ($mgmt_state == 0) { -- $mgmt_print="MGMT : OK"; -+ $mgmt_print="MGMT: OK"; - } else { -- $mgmt_print="MGMT : " . $mgmt_print; -+ $mgmt_print="MGMT: " . $mgmt_print; - } - verb("$svn_print"); - } -@@ -402,7 +399,7 @@ - if (defined($o_policy)) { - if ($$resultat{$policy_name} ne $o_policy) { - $fw_state=2; -- $fw_print .= "Policy installed : $$resultat{$policy_name}"; -+ $fw_print .= "Policy installed: $$resultat{$policy_name}"; - } - } - -@@ -419,15 +416,15 @@ - $perf_conn=$$resultat{$connections}; - } - } else { -- $fw_print .= "cannot find oids"; -+ $fw_print .= "cannot find OIDs"; - #Critical state if not found because it means soft is not activated - $fw_state=2; - } - - if ($fw_state==0) { -- $fw_print="FW : OK"; -+ $fw_print="FW: OK"; - } else { -- $fw_print="FW : " . $fw_print; -+ $fw_print="FW: " . $fw_print; - } - - } -@@ -460,7 +457,7 @@ - } - #my $ha_mode = "1.3.6.1.4.1.2620.1.5.11.0"; # "Sync only" : ha Working mode - } else { -- $ha_print .= "cannot find oids"; -+ $ha_print .= "cannot find OIDs"; - #Critical state if not found because it means soft is not activated - $ha_state_n=2; - } -@@ -484,7 +481,7 @@ - } - } - } else { -- $ha_print .= "cannot find oids" if ($ha_state_n ==0); -+ $ha_print .= "cannot find OIDs" if ($ha_state_n ==0); - #Critical state if not found because it means soft is not activated - $ha_state_n=2; - } -@@ -513,9 +510,9 @@ - } - - if ($ha_state_n == 0) { -- $ha_print = "HA : OK"; -+ $ha_print = "HA: OK"; - } else { -- $ha_print = "HA : " . $ha_print; -+ $ha_print = "HA: " . $ha_print; - } - - } -@@ -532,9 +529,9 @@ - if (defined ($o_mgmt)) { $f_print = (defined ($f_print)) ? $f_print . " / ". $mgmt_print : $mgmt_print } - - my $exit_status=undef; --$f_print .= " / CPFW Status : "; -+$f_print .= " / CPFW Status: "; - if (($ha_state_n+$svn_state+$fw_state+$mgmt_state) == 0 ) { -- $f_print .= "OK"; -+ $f_print .= "OK, " . $perf_conn . " conn."; - $exit_status= $ERRORS{"OK"}; - } else { - if (($fw_state==1) || ($ha_state_n==1) || ($svn_state==1) || ($mgmt_state==1)) { -@@ -547,7 +544,7 @@ - } - - if (defined($o_perf) && defined ($perf_conn)) { -- $f_print .= " | fw_connexions=" . $perf_conn; -+ $f_print .= " | fw_connexions=" . $perf_conn . ";" . $o_warn . ";" . $o_crit . ";0"; - } - - print "$f_print\n"; ---- a/check_snmp_env.pl -+++ b/check_snmp_env.pl -@@ -1,7 +1,7 @@ - #!/usr/bin/perl -w - ############################## check_snmp_env ################# --# Version : 1.2 --# Date : April 19 2007 -+# Version : 1.3 -+# Date : May 24 2007 - # Author : Patrick Proy ( patrick at proy.org) - # Help : http://www.manubulon.com/nagios/ - # Licence : GPL - http://www.fsf.org/licenses/gpl.txt -@@ -145,9 +145,24 @@ - - my @foundry_status = (3,0,2); # oper status : 1:other, 2: Normal, 3: Failure - -+# Linux Net-SNMP with LM-SENSORS -+my $linux_temp = "1.3.6.1.4.1.2021.13.16.2.1"; # temperature table -+my $linux_temp_descr = "1.3.6.1.4.1.2021.13.16.2.1.2"; # temperature entry description -+my $linux_temp_value = "1.3.6.1.4.1.2021.13.16.2.1.3"; # temperature entry value (mC) -+my $linux_fan = "1.3.6.1.4.1.2021.13.16.3.1"; # fan table -+my $linux_fan_descr = "1.3.6.1.4.1.2021.13.16.3.1.2"; # fan entry description -+my $linux_fan_value = "1.3.6.1.4.1.2021.13.16.3.1.3"; # fan entry value (RPM) -+my $linux_volt = "1.3.6.1.4.1.2021.13.16.4.1"; # voltage table -+my $linux_volt_descr = "1.3.6.1.4.1.2021.13.16.4.1.2"; # voltage entry description -+my $linux_volt_value = "1.3.6.1.4.1.2021.13.16.4.1.3"; # voltage entry value (mV) -+my $linux_misc = "1.3.6.1.4.1.2021.13.16.4.1"; # misc table -+my $linux_misc_descr = "1.3.6.1.4.1.2021.13.16.4.1.2"; # misc entry description -+my $linux_misc_value = "1.3.6.1.4.1.2021.13.16.4.1.3"; # misc entry value -+ -+ - # Globals - --my $Version='1.2'; -+my $Version='1.3'; - - my $o_host = undef; # hostname - my $o_community = undef; # community -@@ -160,7 +175,7 @@ - my $o_version2= undef; # use snmp v2c - # check type - my $o_check_type= "cisco"; # default Cisco --my @valid_types =("cisco","nokia","bc","iron","foundry"); -+my @valid_types =("cisco","nokia","bc","iron","foundry","linux"); - my $o_temp= undef; # max temp - my $o_fan= undef; # min fan speed - -@@ -177,7 +192,7 @@ - sub p_version { print "check_snmp_env version : $Version\n"; } - - sub print_usage { -- print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -T (cisco|nokia|bc|iron|foundry) [-F ] [-c ] [-f] [-t ] [-V]\n"; -+ print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -T (cisco|nokia|bc|iron|foundry|linux) [-F ] [-c ] [-f] [-t ] [-V]\n"; - } - - sub isnnum { # Return true if arg is not a number -@@ -221,17 +236,18 @@ - -P, --port=PORT - SNMP port (Default 161) - -T, --type=cisco|nokia|bc|iron|foundry -- Environemental check : -- cisco : voltage,temp,fan,power supply status -- will try to check everything present -- nokia : fan and power supply -- bc : fans, power supply, voltage, disks -- iron : fans, power supply, temp -- foundry : power supply, temp -+ Environemental check : -+ cisco : All Cisco equipements : voltage,temp,fan,power supply -+ (will try to check everything in the env mib) -+ nokia : Nokia IP platforms : fan and power supply -+ bc : BlueCoat platforms : fans, power supply, voltage, disks -+ iron : IronPort platforms : fans, power supply, temp -+ foundry : Foundry Network platforms : power supply, temp -+ linux : Net-SNMP with LM-SENSORS : temp, fan, volt, misc - -F, --fan= -- Minimum fan rpm value -+ Minimum fan rpm value (only needed for 'iron' & 'linux') - -c, --celcius= -- Maximum temp in degree celcius -+ Maximum temp in degree celcius (only needed for 'iron' & 'linux') - -f, --perfparse - Perfparse compatible output - -t, --timeout=INTEGER -@@ -428,8 +444,10 @@ - if (!defined ($cur_status)) { ### Error TODO - $volt_global=1; - } -- $perf_output.=" '".$$resultat{$ciscoVoltageTableDesc .".".$voltindex[$i]}."'=" ; -- $perf_output.=$$resultat{$ciscoVoltageTableValue."." . $voltindex[$i]}; -+ if (defined($$resultat{$ciscoVoltageTableValue."." . $voltindex[$i]})) { -+ $perf_output.=" '".$$resultat{$ciscoVoltageTableDesc .".".$voltindex[$i]}."'=" ; -+ $perf_output.=$$resultat{$ciscoVoltageTableValue."." . $voltindex[$i]}; -+ } - if ($Nagios_state[$CiscoEnvMonNagios{$cur_status}] ne "OK") { - $volt_global= 1; - $volt_status{$$resultat{$ciscoVoltageTableDesc .".".$voltindex[$i]}}=$cur_status; -@@ -448,8 +466,10 @@ - if (!defined ($cur_status)) { ### Error TODO - $temp_global=1; - } -- $perf_output.=" '".$$resultat{$ciscoTempTableDesc .".".$tempindex[$i]}."'=" ; -- $perf_output.=$$resultat{$ciscoTempTableValue."." . $tempindex[$i]}; -+ if (defined($$resultat{$ciscoTempTableValue."." . $tempindex[$i]})) { -+ $perf_output.=" '".$$resultat{$ciscoTempTableDesc .".".$tempindex[$i]}."'=" ; -+ $perf_output.=$$resultat{$ciscoTempTableValue."." . $tempindex[$i]}; -+ } - if ($Nagios_state[$CiscoEnvMonNagios{$cur_status}] ne "OK") { - $temp_global= 1; - $temp_status{$$resultat{$ciscoTempTableDesc .".".$tempindex[$i]}}=$cur_status; -@@ -1003,4 +1023,14 @@ - - } - --exit (3); -+########### Cisco env checks ############## -+if ($o_check_type eq "linux") { -+ -+ verb("Checking linux env"); -+ -+ print "Not implemented yet : UNKNOWN\n"; -+ exit $ERRORS{"UNKNOWN"}; -+} -+ -+print "Unknown check type : UNKNOWN\n"; -+exit $ERRORS{"UNKNOWN"}; ---- a/check_snmp_int.pl -+++ b/check_snmp_int.pl -@@ -1,13 +1,12 @@ - #!/usr/bin/perl -w - ############################## check_snmp_int ############## --# Version : 1.4.6 --# Date : April 23 2007 -+my $Version='1.24'; -+# Date : Oct 10 2007 - # Author : Patrick Proy ( patrick at proy.org ) - # Help : http://nagios.manubulon.com - # Licence : GPL - http://www.fsf.org/licenses/gpl.txt - # Contrib : J. Jungmann, S. Probst, R. Leroy, M. Berger - # TODO : --# Check isdn "dormant" state - # Maybe put base directory for performance as an option - ################################################################# - # -@@ -23,10 +22,8 @@ - - # Nagios specific - --use lib "/usr/local/nagios/libexec"; --use utils qw(%ERRORS $TIMEOUT); --#my $TIMEOUT = 5; --#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); -+my $TIMEOUT = 15; -+my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - - # SNMP Datas - -@@ -36,6 +33,7 @@ - my $oper_table = '1.3.6.1.2.1.2.2.1.8.'; - my $admin_table = '1.3.6.1.2.1.2.2.1.7.'; - my $speed_table = '1.3.6.1.2.1.2.2.1.5.'; -+my $speed_table_64 = '1.3.6.1.2.1.31.1.1.1.15.'; - my $in_octet_table = '1.3.6.1.2.1.2.2.1.10.'; - my $in_octet_table_64 = '1.3.6.1.2.1.31.1.1.1.6.'; - my $in_error_table = '1.3.6.1.2.1.2.2.1.14.'; -@@ -49,7 +47,6 @@ - - # Globals - --my $Version='1.4.6'; - - # Standard options - my $o_host = undef; # hostname -@@ -58,6 +55,7 @@ - my $o_help= undef; # wan't some help ? - my $o_admin= undef; # admin status instead of oper - my $o_inverse= undef; # Critical when up -+my $o_dormant= undef; # Dormant state is OK - my $o_verb= undef; # verbose mode - my $o_version= undef; # print version - my $o_noreg= undef; # Do not use Regexp for name -@@ -66,16 +64,16 @@ - # Performance data options - my $o_perf= undef; # Output performance data - my $o_perfe= undef; # Output discard/error also in perf data --my $o_perfs= undef; # include speed in performance output (-S) --my $o_perfp= undef; # output performance data in % of max speed (-y) --my $o_perfr= undef; # output performance data in bits/s or Bytes/s (-Y) -+my $o_perfs= undef; # include speed in performance output (-S) -+my $o_perfp= undef; # output performance data in % of max speed (-y) -+my $o_perfr= undef; # output performance data in bits/s or Bytes/s (-Y) - # Speed/error checks - my $o_checkperf= undef; # checks in/out/err/disc values - my $o_delta= 300; # delta of time of perfcheck (default 5min) - my $o_ext_checkperf= undef; # extended perf checks (+error+discard) - my $o_warn_opt= undef; # warning options - my $o_crit_opt= undef; # critical options --my $o_kbits= undef; # Warn and critical in Kbits instead of KBytes -+my $o_kbits= undef; # Warn and critical in Kbits instead of KBytes - my @o_warn= undef; # warning levels of perfcheck - my @o_crit= undef; # critical levels of perfcheck - my $o_highperf= undef; # Use 64 bits counters -@@ -152,7 +150,7 @@ - sub p_version { print "check_snmp_int version : $Version\n"; } - - sub print_usage { -- print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,) [-p ] -n [-i] [-a] [-r] [-f[eSyY]] [-k[qBMGu] -g -w -c -d] [-o ] [-t ] [-s] --label [-V]\n"; -+ print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,) [-p ] -n [-i -a -D] [-r] [-f[eSyY]] [-k[qBMGu] -g -w -c -d] [-o ] [-t ] [-s] --label [-V]\n"; - } - - sub isnnum { # Return true if arg is not a number -@@ -195,6 +193,8 @@ - Make critical when up - -a, --admin - Use administrative status instead of operational -+-D, --dormant -+ Dormant state is an OK state - -o, --octetlength=INTEGER - max-size of the SNMP message, usefull in case of Too Long responses. - Be carefull with network filters. Range 484 - 65535, default are -@@ -214,8 +214,8 @@ - --label - Add label before speed in output : in=, out=, errors-out=, etc... - -g, --64bits -- Use 64 bits counters instead of the standard counters -- when checking bandwidth & performance data. -+ Use 64 bits counters instead of the standard counters when checking -+ bandwidth & performance data for interface >= 1Gbps. - You must use snmp v2c or v3 to get 64 bits counters. - -d, --delta=seconds - make an average of seconds (default 300=5min) -@@ -284,7 +284,8 @@ - 'u' => \$o_prct, 'prct' => \$o_prct, - 'o:i' => \$o_octetlength, 'octetlength:i' => \$o_octetlength, - 'label' => \$o_label, -- 'd:i' => \$o_delta, 'delta:i' => \$o_delta -+ 'd:i' => \$o_delta, 'delta:i' => \$o_delta, -+ 'D' => \$o_dormant, 'dormant' => \$o_dormant - ); - if (defined ($o_help) ) { help(); exit $ERRORS{"UNKNOWN"}}; - if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"}}; -@@ -460,6 +461,7 @@ - my (@oid_perf,@oid_perf_outoct,@oid_perf_inoct,@oid_perf_inerr,@oid_perf_outerr,@oid_perf_indisc,@oid_perf_outdisc)= - (undef,undef,undef,undef,undef,undef,undef); - my @oid_speed=undef; -+my @oid_speed_high=undef; - my $num_int = 0; - - # Change to 64 bit counters if option is set : -@@ -494,7 +496,8 @@ - if (defined($o_perf) || defined($o_checkperf)) { - $oid_perf_inoct[$num_int]= $in_octet_table . $tindex[$num_int]; - $oid_perf_outoct[$num_int]= $out_octet_table . $tindex[$num_int]; -- $oid_speed[$num_int]=$speed_table . $tindex[$num_int]; -+ $oid_speed[$num_int]=$speed_table . $tindex[$num_int]; -+ $oid_speed_high[$num_int]=$speed_table_64 . $tindex[$num_int]; - if (defined($o_ext_checkperf) || defined($o_perfe)) { - $oid_perf_indisc[$num_int]= $in_discard_table . $tindex[$num_int]; - $oid_perf_outdisc[$num_int]= $out_discard_table . $tindex[$num_int]; -@@ -509,25 +512,25 @@ - # No interface found -> error - if ( $num_int == 0 ) { print "ERROR : Unknown interface $o_descr\n" ; exit $ERRORS{"UNKNOWN"};} - --my ($result,$resultf)=(undef,undef); -+my $result=undef; -+# Add performance oids if requested -+if (defined($o_perf)||defined($o_checkperf)) { -+ @oids=(@oids,@oid_perf_outoct,@oid_perf_inoct,@oid_speed); -+ if (defined($o_highperf)) { -+ @oids=(@oids,@oid_speed_high); -+ } -+ if (defined ($o_ext_checkperf) || defined($o_perfe)) { -+ @oids=(@oids,@oid_perf_inerr,@oid_perf_outerr,@oid_perf_indisc,@oid_perf_outdisc); -+ } -+} -+ - # Get the requested oid values - $result = $session->get_request( - Varbindlist => \@oids - ); --if (!defined($result)) { printf("ERROR: Status table : %s.\n", $session->error); $session->close; -+if (!defined($result)) { printf("ERROR: Status/statistics table : %s.\n", $session->error); $session->close; - exit $ERRORS{"UNKNOWN"}; - } --# Get the perf value if -f (performance) option defined or -k (check bandwidth) --if (defined($o_perf)||defined($o_checkperf)) { -- @oid_perf=(@oid_perf_outoct,@oid_perf_inoct,@oid_perf_inerr,@oid_perf_outerr,@oid_perf_indisc,@oid_perf_outdisc,@oid_speed); -- $resultf = $session->get_request( -- Varbindlist => \@oid_perf -- ); -- if (!defined($resultf)) { printf("ERROR: Statistics table : %s.\n", $session->error); $session->close; -- exit $ERRORS{"UNKNOWN"}; -- } --} -- - - $session->close; - -@@ -544,6 +547,7 @@ - my $trigger_low=$timenow - 3*$o_delta; - my ($old_value,$old_time)=undef; - my $speed_unit=undef; -+my $speed_real=undef; # speed of interface using either standard or highperf mib. - - # define the OK value depending on -i option - my $ok_val= defined ($o_inverse) ? 2 : 1; -@@ -570,7 +574,22 @@ - $n_rows = shift(@ret_array); - if ($n_rows != 0) { @file_values = @ret_array }; - verb ("File read returns : $return with $n_rows rows"); -- verb ("Interface speed : $$resultf{$oid_speed[$i]}"); -+ # Get the speed in normal or highperf speed counters -+ if ($$result{$oid_speed[$i]} == 4294967295) { # Too high for this counter (cf IF-MIB) -+ if (! defined($o_highperf) && (defined($o_prct) || defined ($o_perfs) || defined ($o_perfp))) { -+ print "Cannot get interface speed with standard MIB, use highperf mib (-g) : UNKNOWN\n"; -+ exit $ERRORS{"UNKNOWN"} -+ } -+ if (defined ($$result{$oid_speed_high[$i]}) && $$result{$oid_speed_high[$i]} != 0) { -+ $speed_real=$$result{$oid_speed_high[$i]} * 1000000; -+ } else { -+ print "Cannot get interface speed using highperf mib : UNKNOWN\n"; -+ exit $ERRORS{"UNKNOWN"} -+ } -+ } else { -+ $speed_real=$$result{$oid_speed[$i]}; -+ } -+ verb ("Interface speed : $speed_real"); - #make the checks if the file is OK - if ($return ==0) { - my $j=$n_rows-1; -@@ -583,7 +602,7 @@ - my $speed_metric=undef; - if (defined($o_prct)) { # in % of speed - # Speed is in bits/s, calculated speed is in Bytes/s -- $speed_metric=$$resultf{$oid_speed[$i]}/800; -+ $speed_metric=$speed_real/800; - $speed_unit="%"; - } else { - if (defined($o_kbits)) { # metric in bits -@@ -614,24 +633,24 @@ - # First set the modulus depending on highperf counters or not - my $overfl_mod = defined ($o_highperf) ? 18446744073709551616 : 4294967296; - # Check counter (s) -- my $overfl = ($$resultf{$oid_perf_inoct[$i]} >= $file_values[$j][1] ) ? 0 : $overfl_mod; -- $checkperf_out_raw[0] = ( ($overfl + $$resultf{$oid_perf_inoct[$i]} - $file_values[$j][1])/ -+ my $overfl = ($$result{$oid_perf_inoct[$i]} >= $file_values[$j][1] ) ? 0 : $overfl_mod; -+ $checkperf_out_raw[0] = ( ($overfl + $$result{$oid_perf_inoct[$i]} - $file_values[$j][1])/ - ($timenow - $file_values[$j][0] )); - $checkperf_out[0] = $checkperf_out_raw[0] / $speed_metric; - -- $overfl = ($$resultf{$oid_perf_outoct[$i]} >= $file_values[$j][2] ) ? 0 : $overfl_mod; -- $checkperf_out_raw[1] = ( ($overfl + $$resultf{$oid_perf_outoct[$i]} - $file_values[$j][2])/ -+ $overfl = ($$result{$oid_perf_outoct[$i]} >= $file_values[$j][2] ) ? 0 : $overfl_mod; -+ $checkperf_out_raw[1] = ( ($overfl + $$result{$oid_perf_outoct[$i]} - $file_values[$j][2])/ - ($timenow - $file_values[$j][0] )); - $checkperf_out[1] = $checkperf_out_raw[1] / $speed_metric; - - if (defined($o_ext_checkperf)) { -- $checkperf_out[2] = ( ($$resultf{$oid_perf_inerr[$i]} - $file_values[$j][3])/ -+ $checkperf_out[2] = ( ($$result{$oid_perf_inerr[$i]} - $file_values[$j][3])/ - ($timenow - $file_values[$j][0] ))*60; -- $checkperf_out[3] = ( ($$resultf{$oid_perf_outerr[$i]} - $file_values[$j][4])/ -+ $checkperf_out[3] = ( ($$result{$oid_perf_outerr[$i]} - $file_values[$j][4])/ - ($timenow - $file_values[$j][0] ))*60; -- $checkperf_out[4] = ( ($$resultf{$oid_perf_indisc[$i]} - $file_values[$j][5])/ -+ $checkperf_out[4] = ( ($$result{$oid_perf_indisc[$i]} - $file_values[$j][5])/ - ($timenow - $file_values[$j][0] ))*60; -- $checkperf_out[5] = ( ($$resultf{$oid_perf_outdisc[$i]} - $file_values[$j][6])/ -+ $checkperf_out[5] = ( ($$result{$oid_perf_outdisc[$i]} - $file_values[$j][6])/ - ($timenow - $file_values[$j][0] ))*60; - } - } -@@ -641,13 +660,13 @@ - } - # Put the new values in the array and write the file - $file_values[$n_rows][0]=$timenow; -- $file_values[$n_rows][1]=$$resultf{$oid_perf_inoct[$i]}; -- $file_values[$n_rows][2]=$$resultf{$oid_perf_outoct[$i]}; -+ $file_values[$n_rows][1]=$$result{$oid_perf_inoct[$i]}; -+ $file_values[$n_rows][2]=$$result{$oid_perf_outoct[$i]}; - if (defined($o_ext_checkperf)) { # Add other values (error & disc) -- $file_values[$n_rows][3]=$$resultf{$oid_perf_inerr[$i]}; -- $file_values[$n_rows][4]=$$resultf{$oid_perf_outerr[$i]}; -- $file_values[$n_rows][5]=$$resultf{$oid_perf_indisc[$i]}; -- $file_values[$n_rows][6]=$$resultf{$oid_perf_outdisc[$i]}; -+ $file_values[$n_rows][3]=$$result{$oid_perf_inerr[$i]}; -+ $file_values[$n_rows][4]=$$result{$oid_perf_outerr[$i]}; -+ $file_values[$n_rows][5]=$$result{$oid_perf_indisc[$i]}; -+ $file_values[$n_rows][6]=$$result{$oid_perf_outdisc[$i]}; - } - $n_rows++; - $return=write_file($temp_file_name,$n_rows,$n_items_check,@file_values); -@@ -703,62 +722,79 @@ - } - # Get rid of special caracters for performance in description - $descr[$i] =~ s/'\/\(\)/_/g; -- if ( $int_status == $ok_val) { -+ if (( $int_status == $ok_val)||(defined($o_dormant) && $int_status == 5)) { - $num_ok++; - } - if (( $int_status == 1 ) && defined ($o_perf)) { - if (defined ($o_perfp)) { # output in % of speed - if ($usable_data==1) { -+ my $warn_factor=1; -+ if (!defined($o_prct)) { # warn&crit in K|M|G B|bps -> put warn_factor to make % -+ $warn_factor = (defined($o_meg)) ? 1000000 : (defined($o_gig)) ? 1000000000 : 1000; -+ if (!defined($o_kbits)) { $warn_factor*=8;} -+ $warn_factor/=$speed_real; -+ $warn_factor*=100; # now turn into displayed % : 0,1 = 10% -+ } - $perf_out .= "'" . $descr[$i] ."_in_prct'="; -- $perf_out .= sprintf("%.0f",$checkperf_out_raw[0] * 800 / $$resultf{$oid_speed[$i]}) ."%;"; -- $perf_out .= ($o_warn[0]!=0) ? $o_warn[0] . ";" : ";"; -- $perf_out .= ($o_crit[0]!=0) ? $o_crit[0] . ";" : ";"; -+ $perf_out .= sprintf("%.0f",$checkperf_out_raw[0] * 800 / $speed_real) ."%;"; -+ $perf_out .= ($o_warn[0]!=0) ? sprintf("%.0f",$o_warn[0]*$warn_factor) . ";" : ";"; -+ $perf_out .= ($o_crit[0]!=0) ? sprintf("%.0f",$o_crit[0]*$warn_factor) . ";" : ";"; - $perf_out .= "0;100 "; - $perf_out .= "'" . $descr[$i] ."_out_prct'="; -- $perf_out .= sprintf("%.0f",$checkperf_out_raw[1] * 800 / $$resultf{$oid_speed[$i]}) ."%;"; -- $perf_out .= ($o_warn[1]!=0) ? $o_warn[1] . ";" : ";"; -- $perf_out .= ($o_crit[1]!=0) ? $o_crit[1] . ";" : ";"; -+ $perf_out .= sprintf("%.0f",$checkperf_out_raw[1] * 800 / $speed_real) ."%;"; -+ $perf_out .= ($o_warn[1]!=0) ? sprintf("%.0f",$o_warn[1]*$warn_factor) . ";" : ";"; -+ $perf_out .= ($o_crit[1]!=0) ? sprintf("%.0f",$o_crit[1]*$warn_factor) . ";" : ";"; - $perf_out .= "0;100 "; - } - } elsif (defined ($o_perfr)) { # output in bites or Bytes /s - if ($usable_data==1) { - if (defined($o_kbits)) { # bps - # put warning and critical levels into bps or Bps -- my $warn_factor = (defined($o_meg)) ? 1000000 : (defined($o_gig)) ? 1000000000 : 1000; -+ my $warn_factor; -+ if (defined($o_prct)) { # warn&crit in % -> put warn_factor to 1% of speed in bps -+ $warn_factor=$speed_real/100; -+ } else { # just convert from K|M|G bps -+ $warn_factor = (defined($o_meg)) ? 1000000 : (defined($o_gig)) ? 1000000000 : 1000; -+ } - $perf_out .= "'" . $descr[$i] ."_in_bps'="; - $perf_out .= sprintf("%.0f",$checkperf_out_raw[0] * 8) .";"; - $perf_out .= ($o_warn[0]!=0) ? $o_warn[0]*$warn_factor . ";" : ";"; - $perf_out .= ($o_crit[0]!=0) ? $o_crit[0]*$warn_factor . ";" : ";"; -- $perf_out .= "0;". $$resultf{$oid_speed[$i]} ." "; -+ $perf_out .= "0;". $speed_real ." "; - $perf_out .= "'" . $descr[$i] ."_out_bps'="; - $perf_out .= sprintf("%.0f",$checkperf_out_raw[1] * 8) .";"; - $perf_out .= ($o_warn[1]!=0) ? $o_warn[1]*$warn_factor . ";" : ";"; - $perf_out .= ($o_crit[1]!=0) ? $o_crit[1]*$warn_factor . ";" : ";"; -- $perf_out .= "0;". $$resultf{$oid_speed[$i]} ." "; -+ $perf_out .= "0;". $speed_real ." "; - } else { # Bps -- my $warn_factor = (defined($o_meg)) ? 1048576 : (defined($o_gig)) ? 1073741824 : 1024; -+ my $warn_factor; -+ if (defined($o_prct)) { # warn&crit in % -> put warn_factor to 1% of speed in Bps -+ $warn_factor=$speed_real/800; -+ } else { # just convert from K|M|G bps -+ $warn_factor = (defined($o_meg)) ? 1048576 : (defined($o_gig)) ? 1073741824 : 1024; -+ } - $perf_out .= "'" . $descr[$i] ."_in_Bps'=" . sprintf("%.0f",$checkperf_out_raw[0]) .";"; - $perf_out .= ($o_warn[0]!=0) ? $o_warn[0]*$warn_factor . ";" : ";"; - $perf_out .= ($o_crit[0]!=0) ? $o_crit[0]*$warn_factor . ";" : ";"; -- $perf_out .= "0;". $$resultf{$oid_speed[$i]} ." "; -+ $perf_out .= "0;". $speed_real / 8 ." "; - $perf_out .= "'" . $descr[$i] ."_out_Bps'=" . sprintf("%.0f",$checkperf_out_raw[1]) .";" ; - $perf_out .= ($o_warn[1]!=0) ? $o_warn[1]*$warn_factor . ";" : ";"; - $perf_out .= ($o_crit[1]!=0) ? $o_crit[1]*$warn_factor . ";" : ";"; -- $perf_out .= "0;". $$resultf{$oid_speed[$i]} ." "; -+ $perf_out .= "0;". $speed_real / 8 ." "; - } - } - } else { # output in octet counter -- $perf_out .= "'" . $descr[$i] ."_in_octet'=". $$resultf{$oid_perf_inoct[$i]} ."c "; -- $perf_out .= "'" . $descr[$i] ."_out_octet'=". $$resultf{$oid_perf_outoct[$i]} ."c"; -+ $perf_out .= "'" . $descr[$i] ."_in_octet'=". $$result{$oid_perf_inoct[$i]} ."c "; -+ $perf_out .= "'" . $descr[$i] ."_out_octet'=". $$result{$oid_perf_outoct[$i]} ."c "; - } - if (defined ($o_perfe)) { -- $perf_out .= " '" . $descr[$i] ."_in_error'=". $$resultf{$oid_perf_inerr[$i]} ."c "; -- $perf_out .= "'" . $descr[$i] ."_in_discard'=". $$resultf{$oid_perf_indisc[$i]} ."c "; -- $perf_out .= "'" . $descr[$i] ."_out_error'=". $$resultf{$oid_perf_outerr[$i]} ."c "; -- $perf_out .= "'" . $descr[$i] ."_out_discard'=". $$resultf{$oid_perf_outdisc[$i]} ."c"; -+ $perf_out .= "'" . $descr[$i] ."_in_error'=". $$result{$oid_perf_inerr[$i]} ."c "; -+ $perf_out .= "'" . $descr[$i] ."_in_discard'=". $$result{$oid_perf_indisc[$i]} ."c "; -+ $perf_out .= "'" . $descr[$i] ."_out_error'=". $$result{$oid_perf_outerr[$i]} ."c "; -+ $perf_out .= "'" . $descr[$i] ."_out_discard'=". $$result{$oid_perf_outdisc[$i]} ."c "; - } - if (defined ($o_perfs)) { -- $perf_out .= " '" . $descr[$i] ."_speed_bps'=".$$resultf{$oid_speed[$i]}; -+ $perf_out .= "'" . $descr[$i] ."_speed_bps'=".$speed_real; - } - } - } ---- a/check_snmp_load.pl -+++ b/check_snmp_load.pl -@@ -1,11 +1,10 @@ - #!/usr/bin/perl -w - ############################## check_snmp_load ################# --# Version : 1.3.2 --# Date : Jan 16 2007 -+my $Version='1.12'; -+# Date : Oct 12 2007 - # Author : Patrick Proy ( patrick at proy.org) --# Help : http://www.manubulon.com/nagios/ -+# Help : http://nagios.manubulon.com/ - # Licence : GPL - http://www.fsf.org/licenses/gpl.txt --# Changelog : HP-UX load added. - # Contributors : F. Lacroix and many others !!! - ################################################################# - # -@@ -18,10 +17,8 @@ - - # Nagios specific - --use lib "/usr/local/nagios/libexec"; --use utils qw(%ERRORS $TIMEOUT); --#my $TIMEOUT = 15; --#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); -+my $TIMEOUT = 15; -+my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - - # SNMP Datas - -@@ -94,7 +91,6 @@ - - # Globals - --my $Version='1.3.2'; - - my $o_host = undef; # hostname - my $o_community = undef; # community ---- a/check_snmp_mem.pl -+++ b/check_snmp_mem.pl -@@ -1,11 +1,11 @@ - #!/usr/bin/perl -w - ############################## check_snmp_mem ############## --# Version : 1.1 --# Date : Jul 09 2006 -+my $Version='1.5'; -+# Date : 17 October 2007 - # Author : Patrick Proy (nagios at proy.org) --# Help : http://www.manubulon.com/nagios/ -+# Help : http://nagios.manubulon.com/ - # Licence : GPL - http://www.fsf.org/licenses/gpl.txt --# Contrib : Jan Jungmann -+# Contrib : Jan Jungmann, Patrick Griffin - # TODO : - ################################################################# - # -@@ -18,10 +18,8 @@ - - # Nagios specific - --use lib "/usr/local/nagios/libexec"; --use utils qw(%ERRORS $TIMEOUT); --#my $TIMEOUT = 15; --#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); -+my $TIMEOUT = 15; -+my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - - # SNMP Datas - -@@ -29,10 +27,11 @@ - - my $nets_ram_free = "1.3.6.1.4.1.2021.4.6.0"; # Real memory free - my $nets_ram_total = "1.3.6.1.4.1.2021.4.5.0"; # Real memory total --my $nets_ram_cache = "1.3.6.1.4.1.2021.4.15.0"; # Real memory cached -+my $nets_ram_buffer = "1.3.6.1.4.1.2021.4.14.0"; # Real memory buffered -+my $nets_ram_cache = "1.3.6.1.4.1.2021.4.15.0"; # Real memory cached - my $nets_swap_free = "1.3.6.1.4.1.2021.4.4.0"; # swap memory free - my $nets_swap_total = "1.3.6.1.4.1.2021.4.3.0"; # Swap memory total --my @nets_oids = ($nets_ram_free,$nets_ram_total,$nets_swap_free,$nets_swap_total,$nets_ram_cache); -+my @nets_oids = ($nets_ram_free,$nets_ram_total,$nets_swap_free,$nets_swap_total,$nets_ram_cache,$nets_ram_buffer); - - # Cisco - -@@ -60,7 +59,6 @@ - - # Globals - --my $Version='1.1'; - - my $o_host = undef; # hostname - my $o_community = undef; # community -@@ -79,6 +77,7 @@ - my $o_critS= undef; # critical level for swap - my $o_perf= undef; # Performance data option - my $o_cache= undef; # Include cached memory as used memory -+my $o_buffer= undef; # Exclude buffered memory as used memory - my $o_timeout= undef; # Timeout (Default 5) - my $o_version2= undef; # use snmp v2c - # SNMPv3 specific -@@ -94,7 +93,7 @@ - sub p_version { print "check_snmp_mem version : $Version\n"; } - - sub print_usage { -- print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -w -c [-I|-N|-E] [-f] [-m] [-t ] [-V]\n"; -+ print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -w -c [-I|-N|-E] [-f] [-m -b] [-t ] [-V]\n"; - } - - sub isnnum { # Return true if arg is not a number -@@ -109,11 +108,11 @@ - - sub help { - print "\nSNMP Memory Monitor for Nagios version ",$Version,"\n"; -- print "(c)2004-2006 to my cat Ratoune - Author: Patrick Proy\n\n"; -+ print "GPL licence, (c)2004-2007 Patrick Proy\n\n"; - print_usage(); - print < \$o_crit, 'critical:s' => \$o_crit, - 'w:s' => \$o_warn, 'warn:s' => \$o_warn, - 'm' => \$o_cache, 'memcache' => \$o_cache, -+ 'b' => \$o_buffer, 'membuffer' => \$o_buffer, - 'f' => \$o_perf, 'perfdata' => \$o_perf - ); - if (defined ($o_help) ) { help(); exit $ERRORS{"UNKNOWN"}}; -@@ -267,6 +269,7 @@ - -username => $o_login, - -authpassword => $o_passwd, - -authprotocol => $o_authproto, -+ -port => $o_port, - -timeout => $o_timeout - ); - } else { -@@ -279,6 +282,7 @@ - -authprotocol => $o_authproto, - -privpassword => $o_privpass, - -privprotocol => $o_privproto, -+ -port => $o_port, - -timeout => $o_timeout - ); - } -@@ -473,22 +477,23 @@ - } - - my ($realused,$swapused)=(undef,undef); -+ my $totalcachedbuffered = 0; -+ if (defined($o_buffer)) { -+ $totalcachedbuffered = $$resultat{$nets_ram_buffer}; -+ } -+ if (!defined($o_cache)) { -+ $totalcachedbuffered = $totalcachedbuffered + $$resultat{$nets_ram_cache}; -+ } -+ -+ $realused = ($$resultat{$nets_ram_total}-($$resultat{$nets_ram_free}+$totalcachedbuffered)) / $$resultat{$nets_ram_total}; - -- $realused= defined($o_cache) ? -- ($$resultat{$nets_ram_total}-$$resultat{$nets_ram_free})/$$resultat{$nets_ram_total} -- : -- ($$resultat{$nets_ram_total}-($$resultat{$nets_ram_free}+$$resultat{$nets_ram_cache}))/$$resultat{$nets_ram_total}; -- - if($$resultat{$nets_ram_total} == 0) { $realused = 0; } - - $swapused= ($$resultat{$nets_swap_total} == 0) ? 0 : - ($$resultat{$nets_swap_total}-$$resultat{$nets_swap_free})/$$resultat{$nets_swap_total}; - $realused=round($realused*100,0); - $swapused=round($swapused*100,0); -- defined($o_cache) ? -- verb ("Ram : $$resultat{$nets_ram_free} / $$resultat{$nets_ram_total} : $realused") -- : -- verb ("Ram : $$resultat{$nets_ram_free} ($$resultat{$nets_ram_cache} cached) / $$resultat{$nets_ram_total} : $realused"); -+ verb ("Ram : $$resultat{$nets_ram_free} ($$resultat{$nets_ram_cache} cached, $$resultat{$nets_ram_buffer} buff) / $$resultat{$nets_ram_total} : $realused"); - verb ("Swap : $$resultat{$nets_swap_free} / $$resultat{$nets_swap_total} : $swapused"); - - my $n_status="OK"; ---- a/check_snmp_process.pl -+++ b/check_snmp_process.pl -@@ -1,45 +1,43 @@ - #!/usr/bin/perl -w - ############################## check_snmp_process ############## --# Version : 1.4 --# Date : March 12 2007 --# Author : Patrick Proy (patrick at proy.org) -+my $Version='1.10'; -+# Date : Oct 12 2007 -+# Author : Patrick Proy (patrick at proy dot org) - # Help : http://nagios.manubulon.com - # Licence : GPL - http://www.fsf.org/licenses/gpl.txt --# Contrib : Makina Corpus -+# Contrib : Makina Corpus, adam At greekattic d0t com - # TODO : put $o_delta as an option --# Contrib : -+# If testing on localhost, selects itself.... - ############################################################### - # - # help : ./check_snmp_process -h - -+use strict; -+use Net::SNMP; -+use Getopt::Long; -+ - ############### BASE DIRECTORY FOR TEMP FILE ######## - my $o_base_dir="/tmp/tmp_Nagios_proc."; - my $file_history=200; # number of data to keep in files. - my $delta_of_time_to_make_average=300; # 5minutes by default -- --use strict; --use Net::SNMP; --use Getopt::Long; - - # Nagios specific - --use lib "/usr/local/nagios/libexec"; --use utils qw(%ERRORS $TIMEOUT); --#my $TIMEOUT = 5; --#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); -+my $TIMEOUT = 15; -+my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - - # SNMP Datas - my $process_table= '1.3.6.1.2.1.25.4.2.1'; - my $index_table = '1.3.6.1.2.1.25.4.2.1.1'; - my $run_name_table = '1.3.6.1.2.1.25.4.2.1.2'; - my $run_path_table = '1.3.6.1.2.1.25.4.2.1.4'; -+my $run_param_table = '1.3.6.1.2.1.25.4.2.1.5'; - my $proc_mem_table = '1.3.6.1.2.1.25.5.1.1.2'; # Kbytes - my $proc_cpu_table = '1.3.6.1.2.1.25.5.1.1.1'; # Centi sec of CPU - my $proc_run_state = '1.3.6.1.2.1.25.4.2.1.7'; - - # Globals - --my $Version='1.4'; - - my $o_host = undef; # hostname - my $o_community =undef; # community -@@ -57,6 +55,8 @@ - my $o_path= undef; # check path instead of name - my $o_inverse= undef; # checks max instead of min number of process - my $o_get_all= undef; # get all tables at once -+my $o_param= undef; # Add process parameters for selection -+my $o_perf= undef; # Add performance output - my $o_timeout= 5; # Default 5s Timeout - # SNMP V3 specific - my $o_login= undef; # snmp v3 login -@@ -80,7 +80,7 @@ - sub p_version { print "check_snmp_process version : $Version\n"; } - - sub print_usage { -- print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd) [-p ] -n [-w [,] -c [,max_proc] ] [-m, -a -u, ] [-t ] [-o ] [-f ] [-r] [-V] [-g]\n"; -+ print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd) [-p ] -n [-w [,] -c [,max_proc] ] [-m, -a -u, -d ] [-t ] [-o ] [-f -A -F ] [-r] [-V] [-g]\n"; - } - - sub isnotnum { # Return true if arg is not a number -@@ -174,6 +174,12 @@ - -f, --fullpath - Use full path name instead of process name - (Windows doesn't provide full path name) -+-A, --param -+ Add parameters to select processes. -+ ex : "named.*-t /var/named/chroot" will only select named process with this parameter -+-F, --perfout -+ Add performance output -+ outputs : memory_usage, num_process, cpu_usage - -w, --warn=MIN[,MAX] - Number of process that will cause a warning - -1 for no warning, MAX must be >0. Ex : -w-1,50 -@@ -193,6 +199,8 @@ - checks cpu usage of all process - values are warning and critical values in % of CPU usage - if more than one CPU, value can be > 100% : 100%=1 CPU -+-d, --delta=seconds -+ make an average of seconds for CPU (default 300=5min) - -g, --getall - In some cases, it is necessary to get all data at once because - process die very frequently. -@@ -242,6 +250,9 @@ - '2' => \$o_version2, 'v2c' => \$o_version2, - 'o:i' => \$o_octetlength, 'octetlength:i' => \$o_octetlength, - 'g' => \$o_get_all, 'getall' => \$o_get_all, -+ 'A' => \$o_param, 'param' => \$o_param, -+ 'F' => \$o_perf, 'perfout' => \$o_perf, -+ 'd:i' => \$o_delta, 'delta:i' => \$o_delta, - 'V' => \$o_version, 'version' => \$o_version - ); - if (defined ($o_help)) { help(); exit $ERRORS{"UNKNOWN"}}; -@@ -411,6 +422,19 @@ - exit $ERRORS{"UNKNOWN"}; - } - -+my $resultat_param=undef; -+if (defined($o_param)) { # Get parameter table too -+ $resultat_param = (Net::SNMP->VERSION < 4) ? -+ $session->get_table($run_param_table) -+ :$session->get_table(Baseoid => $run_param_table); -+ if (!defined($resultat_param)) { -+ printf("ERROR: Process param table : %s.\n", $session->error); -+ $session->close; -+ exit $ERRORS{"UNKNOWN"}; -+ } -+ -+} -+ - if (defined ($o_get_all)) { - $getall_run = (Net::SNMP->VERSION < 4) ? - $session->get_table($proc_run_state ) -@@ -458,8 +482,14 @@ - verb("Filter : $o_descr"); - - foreach my $key ( keys %$resultat) { -- verb("OID : $key, Desc : $$resultat{$key}"); - # test by regexp or exact match -+ # First add param if necessary -+ if (defined($o_param)){ -+ my $pid = (split /\./,$key)[-1]; -+ $pid = $run_param_table .".".$pid; -+ $$resultat{$key} .= " " . $$resultat_param{$pid}; -+ } -+ verb("OID : $key, Desc : $$resultat{$key}"); - my $test = defined($o_noreg) - ? $$resultat{$key} eq $o_descr - : $$resultat{$key} =~ /$o_descr/; -@@ -545,6 +575,7 @@ - } - - my $final_status=0; -+my $perf_output; - my ($res_memory,$res_cpu)=(0,0); - my $memory_print=""; - my $cpu_print=""; -@@ -571,6 +602,9 @@ - } else { - $memory_print=", Mem : ".sprintf("%.1f",$res_memory)."Mb OK"; - } -+ if (defined($o_perf)) { -+ $perf_output= "'memory_usage'=".sprintf("%.1f",$res_memory) ."MB;".$o_memL[0].";".$o_memL[1]; -+ } - } - - ######## Checks CPU usage -@@ -609,6 +643,10 @@ - if ($file_values[$j][0] > $trigger_low) { - # found value = centiseconds / seconds = %cpu - $found_value= ($res_cpu-$file_values[$j][1]) / ($timenow - $file_values[$j][0] ); -+ if ($found_value <0) { # in case of program restart -+ $j=0;$found_value=undef; # don't look for more values -+ $n_rows=0; # reset file -+ } - } - } - $j--; -@@ -631,6 +669,10 @@ - } else { - $cpu_print.=", Cpu : ".sprintf("%.0f",$found_value)."% OK"; - } -+ if (defined($o_perf)) { -+ if (!defined($perf_output)) {$perf_output="";} else {$perf_output.=" ";} -+ $perf_output.= "'cpu_usage'=". sprintf("%.0f",$found_value)."%;".$o_cpuL[0].";".$o_cpuL[1]; -+ } - } else { - if ($final_status==0) { $final_status=3 }; - $cpu_print.=", No data for CPU (".$n_rows." line(s)):UNKNOWN"; -@@ -659,7 +701,14 @@ - print " (<= ",$o_warnL[1],"):OK"; - } - --print $memory_print,$cpu_print,"\n"; -+print $memory_print,$cpu_print; -+ -+if (defined($o_perf)) { -+ if (!defined($perf_output)) {$perf_output="";} else {$perf_output.=" ";} -+ $perf_output.= "'num_process'=". $num_int_ok.";".$o_warnL[0].";".$o_critL[0]; -+ print " | ",$perf_output; -+} -+print "\n"; - - if ($final_status==2) { exit $ERRORS{"CRITICAL"};} - if ($final_status==1) { exit $ERRORS{"WARNING"};} ---- a/check_snmp_storage.pl -+++ b/check_snmp_storage.pl -@@ -1,12 +1,12 @@ - #!/usr/bin/perl -w - ############################## check_snmp_storage ############## --# Version : 1.3.2 --# Date : March 12 2007 -+# Version : 1.3.3 -+# Date : Jun 1 2007 - # Author : Patrick Proy ( patrick at proy.org) - # Help : http://nagios.manubulon.com - # Licence : GPL - http://www.fsf.org/licenses/gpl.txt - # TODO : --# Contribs : Dimo Velev, Makina Corpus -+# Contribs : Dimo Velev, Makina Corpus, A. Greiner-Bär - ################################################################# - # - # help : ./check_snmp_storage -h -@@ -57,7 +57,7 @@ - # Globals - - my $Name='check_snmp_storage'; --my $Version='1.3.2'; -+my $Version='1.3.3'; - - my $o_host = undef; # hostname - my $o_community = undef; # community -@@ -80,6 +80,8 @@ - my $o_perf= undef; # Output performance data - my $o_short= undef; # Short output parameters - my @o_shortL= undef; # output type,where,cut -+my $o_reserve= 0; # % reserved blocks (A. Greiner-Bär patch) -+my $o_giga= undef; # output and levels in gigabytes instead of megabytes - # SNMPv3 specific - my $o_login= undef; # Login for snmpv3 - my $o_passwd= undef; # Pass for snmpv3 -@@ -95,7 +97,7 @@ - sub p_version { print "$Name version : $Version\n"; } - - sub print_usage { -- print "Usage: $Name [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -m [-q storagetype] -w -c [-t ] [-T pl|pu|bl|bu ] [-r] [-s] [-i] [-e] [-S 0|1[,1,]] [-o ]\n"; -+ print "Usage: $Name [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -m [-q storagetype] -w -c [-t ] [-T pl|pu|bl|bu ] [-r -s -i -G] [-e] [-S 0|1[,1,]] [-o ] [-R <% reserved>]\n"; - } - - sub round ($$) { -@@ -122,7 +124,7 @@ - - sub help { - print "\nSNMP Disk Monitor for Nagios version ",$Version,"\n"; -- print "(c)2004-2006 Patrick Proy\n\n"; -+ print "(c)2004-2007 Patrick Proy\n\n"; - print_usage(); - print <[,,] -@@ -245,7 +252,9 @@ - 'q:s' => \$o_storagetype, 'storagetype:s'=> \$o_storagetype, - 'S:s' => \$o_short, 'short:s' => \$o_short, - 'o:i' => \$o_octetlength, 'octetlength:i' => \$o_octetlength, -- 'f' => \$o_perf, 'perfparse' => \$o_perf -+ 'f' => \$o_perf, 'perfparse' => \$o_perf, -+ 'R:i' => \$o_reserve, 'reserved:i' => \$o_reserve, -+ 'G' => \$o_giga, 'gigabyte' => \$o_giga - ); - if (defined($o_help) ) { help(); exit $ERRORS{"UNKNOWN"}}; - if (defined($o_version) ) { p_version(); exit $ERRORS{"UNKNOWN"}}; -@@ -271,6 +280,9 @@ - # Check compulsory attributes - if ( ! defined($o_descr) || ! defined($o_host) || !defined($o_warn) || - !defined($o_crit)) { print_usage(); exit $ERRORS{"UNKNOWN"}}; -+ # Get rid of % sign if any -+ $o_warn =~ s/\%//; -+ $o_crit =~ s/\%//; - # Check for positive numbers - if (($o_warn < 0) || ($o_crit < 0)) { print " warn and critical > 0 \n";print_usage(); exit $ERRORS{"UNKNOWN"}}; - # check if warn or crit in % and MB is tested -@@ -278,9 +290,6 @@ - print "warning or critical cannot be in % when MB are tested\n"; - print_usage(); exit $ERRORS{"UNKNOWN"}; - } -- # Get rid of % sign -- $o_warn =~ s/\%//; -- $o_crit =~ s/\%//; - # Check warning and critical values - if ( ( $o_type eq 'pu' ) || ( $o_type eq 'bu' )) { - if ($o_warn >= $o_crit) { print " warn < crit if type=",$o_type,"\n";print_usage(); exit $ERRORS{"UNKNOWN"}}; -@@ -306,6 +315,10 @@ - if (defined ($o_octetlength) && (isnnum($o_octetlength) || $o_octetlength > 65535 || $o_octetlength < 484 )) { - print "octet lenght must be < 65535 and > 484\n";print_usage(); exit $ERRORS{"UNKNOWN"}; - } -+ #### reserved blocks checks (A. Greiner-Bär patch). -+ if (defined ($o_reserve) && (isnnum($o_reserve) || $o_reserve > 99 || $o_reserve < 0 )) { -+ print "reserved blocks must be < 100 and >= 0\n";print_usage(); exit $ERRORS{"UNKNOWN"}; -+ } - } - - ########## MAIN ####### -@@ -521,21 +534,35 @@ - my $crit_state=0; - my ($p_warn,$p_crit); - my $output=undef; -+my $output_metric_val = 1024**2; -+my $output_metric = "M"; -+# Set the metric -+if (defined($o_giga)) { -+ $output_metric_val *= 1024; -+ $output_metric='G'; -+} -+ - for ($i=0;$i<$num_int;$i++) { - verb("Descr : $descr[$i]"); - verb("Size : $$result{$size_table . $tindex[$i]}"); - verb("Used : $$result{$used_table . $tindex[$i]}"); - verb("Alloc : $$result{$alloc_units . $tindex[$i]}"); -- my $to = $$result{$size_table . $tindex[$i]} * $$result{$alloc_units . $tindex[$i]} / 1024**2; -+ if (!defined($$result{$size_table . $tindex[$i]}) || -+ !defined($$result{$used_table . $tindex[$i]}) || -+ !defined ($$result{$alloc_units . $tindex[$i]})) { -+ print "Data not fully defined for storage ",$descr[$i]," : UNKNOWN\n"; -+ exit $ERRORS{"UNKNOWN"}; -+ } -+ my $to = $$result{$size_table . $tindex[$i]} * ( ( 100 - $o_reserve ) / 100 ) * $$result{$alloc_units . $tindex[$i]} / $output_metric_val; - my $pu=undef; - if ( $$result{$used_table . $tindex[$i]} != 0 ) { -- $pu = $$result{$used_table . $tindex[$i]}*100 / $$result{$size_table . $tindex[$i]}; -+ $pu = $$result{$used_table . $tindex[$i]}* 100 / ( $$result{$size_table . $tindex[$i]} * ( 100 - $o_reserve ) / 100 ); - }else { - $pu=0; - } -- my $bu = $$result{$used_table . $tindex[$i]} * $$result{$alloc_units . $tindex[$i]} / 1024**2; -+ my $bu = $$result{$used_table . $tindex[$i]} * $$result{$alloc_units . $tindex[$i]} / $output_metric_val; - my $pl = 100 - $pu; -- my $bl = ($$result{$size_table . $tindex[$i]}- $$result{$used_table . $tindex[$i]}) * $$result{$alloc_units . $tindex[$i]} / 1024**2; -+ my $bl = ( ( $$result{$size_table . $tindex[$i]} * ( ( 100 - $o_reserve ) / 100 ) - ( $$result{$used_table . $tindex[$i]} ) ) * $$result{$alloc_units . $tindex[$i]} / $output_metric_val ); - # add a ' ' if some data exists in $perf_out - $perf_out .= " " if (defined ($perf_out)) ; - ##### Ouputs and checks -@@ -554,7 +581,7 @@ - || (($pu >= $o_warn) && ($locstate=$warn_state=1)); - if (defined($o_shortL[2])) {} - if (!defined($o_shortL[0]) || ($locstate==1)) { # print full output if warn or critical state -- $output.=sprintf ("%s: %.0f%%used(%.0fMB/%.0fMB) ",$descr[$i],$pu,$bu,$to); -+ $output.=sprintf ("%s: %.0f%%used(%.0f%sB/%.0f%sB) ",$descr[$i],$pu,$bu,$output_metric,$to,$output_metric); - } elsif ($o_shortL[0] == 1) { - $output.=sprintf ("%s: %.0f%% ",$descr[$i],$pu); - } -@@ -566,9 +593,9 @@ - ( ($bu >= $o_crit) && ($locstate=$crit_state=1) ) - || ( ($bu >= $o_warn) && ($locstate=$warn_state=1) ); - if (!defined($o_shortL[0]) || ($locstate==1)) { # print full output if warn or critical state -- $output.=sprintf("%s: %.0fMBused/%.0fMB (%.0f%%) ",$descr[$i],$bu,$to,$pu); -+ $output.=sprintf("%s: %.0f%sBused/%.0f%sB (%.0f%%) ",$descr[$i],$bu,$output_metric,$to,$output_metric,$pu); - } elsif ($o_shortL[0] == 1) { -- $output.=sprintf("%s: %.0fMB ",$descr[$i],$bu); -+ $output.=sprintf("%s: %.0f%sB ",$descr[$i],$bu,$output_metric); - } - } - -@@ -578,9 +605,9 @@ - ( ($bl <= $o_crit) && ($locstate=$crit_state=1) ) - || ( ($bl <= $o_warn) && ($locstate=$warn_state=1) ); - if (!defined($o_shortL[0]) || ($locstate==1)) { # print full output if warn or critical state -- $output.=sprintf ("%s: %.0fMBleft/%.0fMB (%.0f%%) ",$descr[$i],$bl,$to,$pl); -+ $output.=sprintf ("%s: %.0f%sBleft/%.0f%sB (%.0f%%) ",$descr[$i],$bl,$output_metric,$to,$output_metric,$pl); - } elsif ($o_shortL[0] == 1) { -- $output.=sprintf ("%s: %.0fMB ",$descr[$i],$bl); -+ $output.=sprintf ("%s: %.0f%sB ",$descr[$i],$bl,$output_metric); - } - } - -@@ -590,13 +617,13 @@ - ( ($pl <= $o_crit) && ($locstate=$crit_state=1) ) - || ( ($pl <= $o_warn) && ($locstate=$warn_state=1) ); - if (!defined($o_shortL[0]) || ($locstate==1)) { # print full output if warn or critical state -- $output.=sprintf ("%s: %.0f%%left(%.0fMB/%.0fMB) ",$descr[$i],$pl,$bl,$to); -+ $output.=sprintf ("%s: %.0f%%left(%.0f%sB/%.0f%sB) ",$descr[$i],$pl,$bl,$output_metric,$to,$output_metric); - } elsif ($o_shortL[0] == 1) { - $output.=sprintf ("%s: %.0f%% ",$descr[$i],$pl); - } - } - # Performance output (in MB) -- $perf_out .= "'".$Pdescr. "'=" . round($bu,0) . "MB;" . round($p_warn,0) -+ $perf_out .= "'".$Pdescr. "'=" . round($bu,0) . $output_metric ."B;" . round($p_warn,0) - . ";" . round($p_crit,0) . ";0;" . round($to,0); - } - -@@ -606,8 +633,8 @@ - my $comp_unit=undef; - ($o_type eq "pu") && ($comp_oper ="<") && ($comp_unit ="%"); - ($o_type eq "pl") && ($comp_oper =">") && ($comp_unit ="%"); --($o_type eq "bu") && ($comp_oper ="<") && ($comp_unit ="MB"); --($o_type eq 'bl') && ($comp_oper =">") && ($comp_unit ="MB"); -+($o_type eq "bu") && ($comp_oper ="<") && ($comp_unit = $output_metric."B"); -+($o_type eq 'bl') && ($comp_oper =">") && ($comp_unit =$output_metric."B"); - - if (!defined ($output)) { $output="All selected storages "; } - ---- a/check_snmp_vrrp.pl -+++ b/check_snmp_vrrp.pl -@@ -1,11 +1,11 @@ - #!/usr/bin/perl -w - ############################## check_snmp_vrrp ############## --# Version : 1.3 --# Date : Aug 23 2006 -+my $Version='1.4'; -+# Date : Oct 17 2007 - # Author : Patrick Proy (patrick at proy.org) --# Help : http://www.manubulon.com/nagios/ -+# Help : http://nagios.manubulon.com/ - # Licence : GPL - http://www.fsf.org/licenses/gpl.txt --# Contrib : C. Maser (Alteon + Netscreen) -+# Contrib : C. Maser (Alteon + Netscreen), Harm-Jan Blok (Foundry) - ################################################################# - # - # Help : ./check_snmp_vrrp.pl -h -@@ -17,10 +17,8 @@ - - # Nagios specific - --use lib "/usr/local/nagios/libexec"; --use utils qw(%ERRORS $TIMEOUT); --#my $TIMEOUT = 15; --#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); -+my $TIMEOUT = 15; -+my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - - # SNMP Datas - -@@ -59,32 +57,43 @@ - my $ns_vrrp_admin = ""; - my $ns_vrrp_prio = "1.3.6.1.4.1.3224.6.2.2.1.4"; - -+######## Foundry -+my $foundry_base_vrrp = "1.3.6.1.4.1.1991.1.2.12.3.1.1"; # oid for vrrp -+my $foundry_vrrp_oper = "1.3.6.1.4.1.1991.1.2.12.3.1.1.10"; # vrrp operational status -+my $foundry_vrrp_admin ="1.3.6.1.4.1.1991.1.2.12.3.1.1.3"; # vrrp admin status -+my $foundry_vrrp_prio = "1.3.6.1.4.1.1991.1.2.12.3.1.1.6"; # vrrp vrid priority -+ -+ - ######### Make an array - my %base_vrrp = ("nokia",$nokia_base_vrrp, - "lp",$lp_base_vrrp, - "alteon",$alteon_base_vrrp, -- "nsc",$ns_base_vrrp -+ "nsc",$ns_base_vrrp, -+ "foundry",$foundry_base_vrrp - ); - my %vrrp_oper = ("nokia",$nokia_vrrp_oper, - "lp",$lp_vrrp_oper, - "alteon",$alteon_vrrp_oper, -- "nsc",$ns_vrrp_oper -+ "nsc",$ns_vrrp_oper, -+ "foundry",$foundry_vrrp_oper - ); - my %vrrp_admin =("nokia",$nokia_vrrp_admin, - "lp",$lp_vrrp_admin, - "alteon",$alteon_vrrp_admin, -- "nsc",$ns_vrrp_admin -+ "nsc",$ns_vrrp_admin, -+ "foundry",$foundry_vrrp_admin - ); - my %vrrp_prio = ("nokia",$nokia_vrrp_prio, - "lp",$lp_vrrp_prio, - "alteon",$alteon_vrrp_prio, -- "nsc",$ns_vrrp_prio); --my %state_master=("nokia",3,"alteon",2,"lp",3,"nsc",2); --my %state_backup=("nokia",2,"alteon",3,"lp",2,"nsc",3); -+ "nsc",$ns_vrrp_prio, -+ "foundry",$foundry_vrrp_oper -+ ); - --# Globals -+my %state_master=("nokia",3,"alteon",2,"lp",3,"nsc",2,"foundry",1); -+my %state_backup=("nokia",2,"alteon",3,"lp",2,"nsc",3,"foundry",2); - --my $Version='1.3'; -+# Globals - - my $o_host = undef; # hostname - my $o_community = undef; # community -@@ -96,7 +105,7 @@ - my $o_state= undef; # Check master or backup state for ok - my $o_clustnum= undef; # number of cluster members - my $o_clustprct= undef; # Max % assigned to one cluster. --my $o_type= 'nokia'; # Check type : nokia|alteon|lp|nsc -+my $o_type= 'nokia'; # Check type : nokia|alteon|lp|nsc|foundry - my $o_long= undef; # Make output long - my $o_timeout= 5; # Default 5s Timeout - -@@ -113,7 +122,7 @@ - sub p_version { print "check_snmp_vrrp version : $Version\n"; } - - sub print_usage { -- print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) -s [-T ] [-p ] [-t ] [-V]\n"; -+ print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) -s [-T ] [-p ] [-t ] [-V]\n"; - } - - sub isnnum { # Return true if arg is not a number -@@ -124,11 +133,11 @@ - - sub help { - print "\nSNMP VRRP Monitor for Nagios version ",$Version,"\n"; -- print "(c)2004-2006 to my cat Ratoune - Author : Patrick Proy\n\n"; -+ print "GPL licence, (c)2004-2007 Patrick Proy\n\n"; - print_usage(); - print < - Type of vrrp router to check -- nokia (default) : Nokai vrrp. Should be working for most vrrp routers -+ nokia (default) : Nokia vrrp. Should be working for most vrrp routers - alteon : for Alteon AD4 Loadbalancers - lp : Radware Linkproof - nsc : Nescreen (ScreenOS 5.x NSRP) - ipso : Nokia IPSO clustering -+ foundry : Foundry VRRP - -s, --state=master|backup|num,% - Nokia ipso clustering : number of members, max % assigned to nodes. - Other : check vrrp interface to be master or backup -@@ -226,7 +236,7 @@ - { print "state must be master or backup\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - } - # Check type -- if ( !defined($o_type) || (($o_type ne "nokia") && ($o_type ne "alteon") && ($o_type ne "lp") && ($o_type ne"nsc") && ($o_type ne"ipso")) ) -+ if ( !defined($o_type) || (($o_type ne "nokia") && ($o_type ne "alteon") && ($o_type ne "lp") && ($o_type ne"nsc") && ($o_type ne"ipso") && ($o_type ne "foundry")) ) - { print "type must be alteon,nokia,lp,nsc or ipso\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - - } -@@ -257,6 +267,7 @@ - -username => $o_login, - -authpassword => $o_passwd, - -authprotocol => $o_authproto, -+ -port => $o_port, - -timeout => $o_timeout - ); - } else { -@@ -269,6 +280,7 @@ - -authprotocol => $o_authproto, - -privpassword => $o_privpass, - -privprotocol => $o_privproto, -+ -port => $o_port, - -timeout => $o_timeout - ); - } -@@ -429,7 +441,11 @@ - $key= $vrrp_admin{$o_type} . "." . $vrid[$i]; - $value = ($$resultat{$key} == 1) ? "up" : "down"; - $output.= $value . "/"; -- ($value eq "up" ) && $ok++; -+ if (($o_type eq 'foundry') && ($o_state eq 'backup') && ($value eq "down")) { -+ $ok++ -+ } else { -+ ($value eq "up") && $ok++; -+ } - } - # Get the priority - $key=$vrrp_prio{$o_type}.".".$vrid[$i]; ---- a/check_snmp_win.pl -+++ b/check_snmp_win.pl -@@ -1,10 +1,11 @@ - #!/usr/bin/perl -w - ############################## check_snmp_win ############## --# Version : 0.6 --# Date : Nov 29 2006 -+my $Version='1.1'; -+# Date : Oct 12 2007 - # Author : Patrick Proy (patrick at proy.org) --# Help : http://www.manubulon.com/nagios/ -+# Help : http://nagios.manubulon.com/ - # Licence : GPL - http://www.fsf.org/licenses/gpl.txt -+# Contrib : Tenaku - # TODO : - ############################################################### - # -@@ -16,10 +17,10 @@ - - # Nagios specific - --use lib "/usr/local/nagios/libexec"; --use utils qw(%ERRORS $TIMEOUT); --#my $TIMEOUT = 5; --#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); -+#use lib "/usr/local/nagios/libexec"; -+#use utils qw(%ERRORS $TIMEOUT); -+my $TIMEOUT = 15; -+my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - - # SNMP Datas for processes (MIB II) - my $process_table= '1.3.6.1.2.1.25.4.2.1'; -@@ -44,7 +45,6 @@ - - # Globals - --my $Version='0.6'; - my $Name='check_snmp_win'; - - my $o_host = undef; # hostname -@@ -93,7 +93,7 @@ - - sub help { - print "\nSNMP Windows Monitor for Nagios version ",$Version,"\n"; -- print "GPL licence, (c)2004-2005 Patrick Proy\n\n"; -+ print "GPL licence, (c)2004-2007 Patrick Proy\n\n"; - print_usage(); - print < -## -## DP: Fixing Net::SNMP version -## DP: sed -i 's/Net::SNMP->VERSION < 4/Net::SNMP->VERSION lt 4/g' -## DP: fix Argument "v6.0.1" isn't numeric in numeric lt (<) -## DP: (see https://wiki.icinga.org/display/howtos/check_snmp#checksnmp-Argumentv601isntnumericinnumericlt) - ---- a/check_snmp_boostedge.pl -+++ b/check_snmp_boostedge.pl -@@ -249,7 +249,7 @@ - - # Get global status - my @oidlist=($be_global_status); --my $resultat = (Net::SNMP->VERSION < 4) ? -+my $resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_request(@oidlist) - : $session->get_request(-varbindlist => \@oidlist); - -@@ -266,7 +266,7 @@ - - $resultat=undef; - # Get service table --$resultat = (Net::SNMP->VERSION < 4) ? -+$resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_table($be_service_table) - : $session->get_table(Baseoid => $be_service_table); - ---- a/check_snmp_css.pl -+++ b/check_snmp_css.pl -@@ -356,7 +356,7 @@ - } - close (FILE); - } else { -- $resultat = (Net::SNMP->VERSION < 4) ? -+ $resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_table($css_svc_name) - : $session->get_table(Baseoid => $css_svc_name); - -@@ -392,7 +392,7 @@ - } - - $resultat = undef; --$resultat = (Net::SNMP->VERSION < 4) ? -+$resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_request(@oid_list) - : $session->get_request(-varbindlist => \@oid_list); - -@@ -402,7 +402,7 @@ - exit $ERRORS{"UNKNOWN"}; - } - my $resultat2 = undef; --$resultat2 = (Net::SNMP->VERSION < 4) ? -+$resultat2 = (Net::SNMP->VERSION lt 4) ? - $session->get_request(@oid_list2) - : $session->get_request(-varbindlist => \@oid_list2); - ---- a/check_snmp_css_main.pl -+++ b/check_snmp_css_main.pl -@@ -219,7 +219,7 @@ - ########### Cisco CSS checks ############## - - # Get load table --my $resultat = (Net::SNMP->VERSION < 4) ? -+my $resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_table($css_svc_name) - : $session->get_table(Baseoid => $css_svc_name); - ---- a/check_snmp_env.pl -+++ b/check_snmp_env.pl -@@ -390,7 +390,7 @@ - verb("Checking cisco env"); - - # Get load table --my $resultat = (Net::SNMP->VERSION < 4) ? -+my $resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_table($ciscoEnvMonMIB) - : $session->get_table(Baseoid => $ciscoEnvMonMIB); - -@@ -594,7 +594,7 @@ - my $global_status=0; - my $output=""; - # get temp --$resultat = (Net::SNMP->VERSION < 4) ? -+$resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_table($nokia_temp_tbl) - : $session->get_table(Baseoid => $nokia_temp_tbl); - if (defined($resultat)) { -@@ -609,7 +609,7 @@ - } - - # Get fan table --$resultat = (Net::SNMP->VERSION < 4) ? -+$resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_table($nokia_fan_table) - : $session->get_table(Baseoid => $nokia_fan_table); - -@@ -631,7 +631,7 @@ - } - - # Get ps table --$resultat = (Net::SNMP->VERSION < 4) ? -+$resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_table($nokia_ps_table) - : $session->get_table(Baseoid => $nokia_ps_table); - -@@ -697,7 +697,7 @@ - - - # get sensor table -- $resultat = (Net::SNMP->VERSION < 4) ? -+ $resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_table($bc_sensor_table) - : $session->get_table(Baseoid => $bc_sensor_table); - if (defined($resultat)) { -@@ -740,7 +740,7 @@ - } - - # Get disk table -- $resultat = (Net::SNMP->VERSION < 4) ? -+ $resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_table($bc_dsk_table) - : $session->get_table(Baseoid => $bc_dsk_table); - -@@ -811,7 +811,7 @@ - # get temp if $o_temp is defined - if (defined($o_temp)) { - verb("Checking temp < $o_temp"); -- $resultat = (Net::SNMP->VERSION < 4) ? -+ $resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_table($iron_tmp_table) - : $session->get_table(Baseoid => $iron_tmp_table); - if (defined($resultat)) { -@@ -843,7 +843,7 @@ - # Get fan status if $o_fan is defined - if (defined($o_fan)) { - verb("Checking fan > $o_fan"); -- $resultat = (Net::SNMP->VERSION < 4) ? -+ $resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_table($iron_fan_table) - : $session->get_table(Baseoid => $iron_fan_table); - if (defined($resultat)) { -@@ -874,7 +874,7 @@ - - # Get power supply status - verb("Checking PS"); -- $resultat = (Net::SNMP->VERSION < 4) ? -+ $resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_table($iron_ps_table) - : $session->get_table(Baseoid => $iron_ps_table); - if (defined($resultat)) { -@@ -966,7 +966,7 @@ - - # Get PS table (TODO : Bug in FAN table, see with Foundry). - --my $result_ps = (Net::SNMP->VERSION < 4) ? -+my $result_ps = (Net::SNMP->VERSION lt 4) ? - $session->get_table($foundry_ps_table) - : $session->get_table(Baseoid => $foundry_ps_table); - ---- a/check_snmp_linkproof_nhr.pl -+++ b/check_snmp_linkproof_nhr.pl -@@ -232,7 +232,7 @@ - my $global_status=0; - - # Get load table --my $resultat = (Net::SNMP->VERSION < 4) ? -+my $resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_table($lp_type) - : $session->get_table(Baseoid => $lp_type); - -@@ -261,7 +261,7 @@ - } - - my $result=undef; --if (Net::SNMP->VERSION < 4) { -+if (Net::SNMP->VERSION lt 4) { - $result = $session->get_request(@oids); - } else { - if ($session->version == 0) { ---- a/check_snmp_load.pl -+++ b/check_snmp_load.pl -@@ -346,7 +346,7 @@ - - verb("Checking linux load"); - # Get load table --my $resultat = (Net::SNMP->VERSION < 4) ? -+my $resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_table($linload_table) - : $session->get_table(Baseoid => $linload_table); - -@@ -410,7 +410,7 @@ - - if ($o_check_type eq "cisco") { - my @oidlists = ($cisco_cpu_5m, $cisco_cpu_1m, $cisco_cpu_5s); --my $resultat = (Net::SNMP->VERSION < 4) ? -+my $resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_request(@oidlists) - : $session->get_request(-varbindlist => \@oidlists); - -@@ -465,7 +465,7 @@ - - if ($o_check_type eq "cata") { - my @oidlists = ($ciscocata_cpu_5m, $ciscocata_cpu_1m, $ciscocata_cpu_5s); --my $resultat = (Net::SNMP->VERSION < 4) ? -+my $resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_request(@oidlists) - : $session->get_request(-varbindlist => \@oidlists); - -@@ -520,7 +520,7 @@ - - if ($o_check_type eq "nsc") { - my @oidlists = ($nsc_cpu_5m, $nsc_cpu_1m, $nsc_cpu_5s); --my $resultat = (Net::SNMP->VERSION < 4) ? -+my $resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_request(@oidlists) - : $session->get_request(-varbindlist => \@oidlists); - -@@ -577,7 +577,7 @@ - # Get load table - my @oidlist = $cpu_oid{$o_check_type}; - verb("Checking OID : @oidlist"); --my $resultat = (Net::SNMP->VERSION < 4) ? -+my $resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_request(@oidlist) - : $session->get_request(-varbindlist => \@oidlist); - if (!defined($resultat)) { -@@ -625,7 +625,7 @@ - verb("Checking hpux load"); - - my @oidlists = ($hpux_load_1_min, $hpux_load_5_min, $hpux_load_15_min); --my $resultat = (Net::SNMP->VERSION < 4) ? -+my $resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_request(@oidlists) - : $session->get_request(-varbindlist => \@oidlists); - -@@ -678,7 +678,7 @@ - - ########## Standard cpu usage check ############ - # Get desctiption table --my $resultat = (Net::SNMP->VERSION < 4) ? -+my $resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_table($base_proc) - : $session->get_table(Baseoid => $base_proc); - ---- a/check_snmp_mem.pl -+++ b/check_snmp_mem.pl -@@ -320,7 +320,7 @@ - if (defined ($o_cisco)) { - - # Get Cisco memory table -- $resultat = (Net::SNMP->VERSION < 4) ? -+ $resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_table($cisco_mem_pool) - :$session->get_table(Baseoid => $cisco_mem_pool); - -@@ -397,7 +397,7 @@ - if (defined ($o_hp)) { - - # Get hp memory table -- $resultat = (Net::SNMP->VERSION < 4) ? -+ $resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_table($hp_mem_pool) - :$session->get_table(Baseoid => $hp_mem_pool); - -@@ -466,7 +466,7 @@ - if (defined ($o_netsnmp)) { - - # Get NetSNMP memory values -- $resultat = (Net::SNMP->VERSION < 4) ? -+ $resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_request(@nets_oids) - :$session->get_request(-varbindlist => \@nets_oids); - ---- a/check_snmp_nsbox.pl -+++ b/check_snmp_nsbox.pl -@@ -265,7 +265,7 @@ - - ########### check global status ############## - my @oidlist=($ns_service_status); --my $resultat = (Net::SNMP->VERSION < 4) ? -+my $resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_request(@oidlist) - : $session->get_request(-varbindlist => \@oidlist); - -@@ -282,7 +282,7 @@ - - ########### check vhost & diode status ############## - $resultat=undef; --$resultat = (Net::SNMP->VERSION < 4) ? -+$resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_table($ns_service_table) - : $session->get_table(Baseoid => $ns_service_table); - ---- a/check_snmp_process.pl -+++ b/check_snmp_process.pl -@@ -407,11 +407,11 @@ - my %result_cons=(); - my ($getall_run,$getall_cpu,$getall_mem)=(undef,undef,undef); - if ( !defined ($o_path) ) { -- $resultat = (Net::SNMP->VERSION < 4) ? -+ $resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_table($run_name_table) - : $session->get_table(Baseoid => $run_name_table); - } else { -- $resultat = (Net::SNMP->VERSION < 4) ? -+ $resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_table($run_path_table) - :$session->get_table(Baseoid => $run_path_table); - } -@@ -424,7 +424,7 @@ - - my $resultat_param=undef; - if (defined($o_param)) { # Get parameter table too -- $resultat_param = (Net::SNMP->VERSION < 4) ? -+ $resultat_param = (Net::SNMP->VERSION lt 4) ? - $session->get_table($run_param_table) - :$session->get_table(Baseoid => $run_param_table); - if (!defined($resultat_param)) { -@@ -436,7 +436,7 @@ - } - - if (defined ($o_get_all)) { -- $getall_run = (Net::SNMP->VERSION < 4) ? -+ $getall_run = (Net::SNMP->VERSION lt 4) ? - $session->get_table($proc_run_state ) - :$session->get_table(Baseoid => $proc_run_state ); - if (!defined($getall_run)) { -@@ -447,7 +447,7 @@ - foreach my $key ( keys %$getall_run) { - $result_cons{$key}=$$getall_run{$key}; - } -- $getall_cpu = (Net::SNMP->VERSION < 4) ? -+ $getall_cpu = (Net::SNMP->VERSION lt 4) ? - $session->get_table($proc_cpu_table) - : $session->get_table(Baseoid => $proc_cpu_table); - if (!defined($getall_cpu)) { -@@ -458,7 +458,7 @@ - foreach my $key ( keys %$getall_cpu) { - $result_cons{$key}=$$getall_cpu{$key}; - } -- $getall_mem = (Net::SNMP->VERSION < 4) ? -+ $getall_mem = (Net::SNMP->VERSION lt 4) ? - $session->get_table($proc_mem_table) - : $session->get_table(Baseoid => $proc_mem_table); - if (!defined($getall_mem)) { -@@ -539,7 +539,7 @@ - $toid[$i]=$oids[$i+$tmp_index]; - #verb("$i : $toid[$i] : $oids[$i+$tmp_index]"); - } -- $tmp_result = (Net::SNMP->VERSION < 4) ? -+ $tmp_result = (Net::SNMP->VERSION lt 4) ? - $session->get_request(@toid) - : $session->get_request(Varbindlist => \@toid); - if (!defined($tmp_result)) { printf("ERROR: running table : %s.\n", $session->error); $session->close; -@@ -551,7 +551,7 @@ - } - - } else { -- $result = (Net::SNMP->VERSION < 4) ? -+ $result = (Net::SNMP->VERSION lt 4) ? - $session->get_request(@oids) - : $session->get_request(Varbindlist => \@oids); - if (!defined($result)) { printf("ERROR: running table : %s.\n", $session->error); $session->close; ---- a/check_snmp_storage.pl -+++ b/check_snmp_storage.pl -@@ -411,13 +411,13 @@ - # Get rid of UTF8 translation in case of accentuated caracters (thanks to Dimo Velev). - $session->translate(Net::SNMP->TRANSLATE_NONE); - if (defined ($o_index)){ -- if (Net::SNMP->VERSION < 4) { -+ if (Net::SNMP->VERSION lt 4) { - $resultat = $session->get_table($index_table); - } else { - $resultat = $session->get_table(Baseoid => $index_table); - } - } else { -- if (Net::SNMP->VERSION < 4) { -+ if (Net::SNMP->VERSION lt 4) { - $resultat = $session->get_table($descr_table); - } else { - $resultat = $session->get_table(Baseoid => $descr_table); -@@ -425,7 +425,7 @@ - } - #get storage typetable for reference - if (defined($o_storagetype)){ -- if (Net::SNMP->VERSION < 4) { -+ if (Net::SNMP->VERSION lt 4) { - $stype = $session->get_table($storagetype_table); - } else { - $stype = $session->get_table(Baseoid => $storagetype_table); -@@ -491,7 +491,7 @@ - - my $result=undef; - --if (Net::SNMP->VERSION < 4) { -+if (Net::SNMP->VERSION lt 4) { - $result = $session->get_request(@oids); - } else { - if ($session->version == 0) { ---- a/check_snmp_vrrp.pl -+++ b/check_snmp_vrrp.pl -@@ -318,7 +318,7 @@ - if ($o_type eq "ipso") { - # Get cluster table - my $resultat; --if (Net::SNMP->VERSION < 4) { -+if (Net::SNMP->VERSION lt 4) { - $resultat = $session->get_table( $nokia_clust_table ); - } else { - $resultat = $session->get_table( Baseoid => $nokia_clust_table ); -@@ -376,7 +376,7 @@ - - # Get vrrp table - my $resultat; --if (Net::SNMP->VERSION < 4) { -+if (Net::SNMP->VERSION lt 4) { - $resultat = $session->get_table( $base_vrrp{$o_type} ); - } else { - $resultat = $session->get_table( Baseoid => $base_vrrp{$o_type} ); ---- a/check_snmp_win.pl -+++ b/check_snmp_win.pl -@@ -256,7 +256,7 @@ - # Look for process in name or path name table - my $resultat=undef; - --$resultat = (Net::SNMP->VERSION < 4) ? -+$resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_table($win_serv_name) - : $session->get_table(Baseoid => $win_serv_name); - -@@ -314,7 +314,7 @@ - my $result=undef; - my $num_int_ok=0; - --$result = (Net::SNMP->VERSION < 4) ? -+$result = (Net::SNMP->VERSION lt 4) ? - $session->get_request(@oids) - : $session->get_request(Varbindlist => \@oids); - diff --git a/debian/patches/15_check_snmp_storage_64bit b/debian/patches/15_check_snmp_storage_64bit deleted file mode 100644 index 60a5a14..0000000 --- a/debian/patches/15_check_snmp_storage_64bit +++ /dev/null @@ -1,163 +0,0 @@ -## 15_check_snmp_storage_64bit by Martin Fürstenau -## -## DP: Make check_snmp_storage 64 Bit prrof - -## From 144c57a0adda190000bef500f3274425cb90d6ba Mon Sep 17 00:00:00 2001 -## From: Michael Friedrich -## Date: Wed, 26 Sep 2012 16:32:40 +0200 -## Subject: [PATCH] =?UTF-8?q?apply=20check=5Fsnmp=5Fstorage=20patch=20and=20?= -## =?UTF-8?q?1.3.3=20from=20Martin=20F=C3=BCrstenau?= -## MIME-Version: 1.0 -## Content-Type: text/plain; charset=UTF-8 -## Content-Transfer-Encoding: 8bit -## -## http://www.monitoring-portal.org/wbb/index.php?page=Thread&threadID=12031 ---- - check_snmp_storage.pl | 54 ++++++++++++++++++++++++++++--------------- - 1 file changed, 36 insertions(+), 18 deletions(-) - -diff --git a/check_snmp_storage.pl b/check_snmp_storage.pl -index 1b8a398..a3c784f 100644 ---- a/check_snmp_storage.pl -+++ b/check_snmp_storage.pl -@@ -6,7 +6,7 @@ - # Help : http://nagios.manubulon.com - # Licence : GPL - http://www.fsf.org/licenses/gpl.txt - # TODO : --# Contribs : Dimo Velev, Makina Corpus, A. Greiner-Bär -+# Contribs : Dimo Velev, Makina Corpus, A. Greiner-B\ufffdr - ################################################################# - # - # help : ./check_snmp_storage -h -@@ -80,7 +80,7 @@ - my $o_perf= undef; # Output performance data - my $o_short= undef; # Short output parameters - my @o_shortL= undef; # output type,where,cut --my $o_reserve= 0; # % reserved blocks (A. Greiner-Bär patch) -+my $o_reserve= 0; # % reserved blocks (A. Greiner-B\ufffdr patch) - my $o_giga= undef; # output and levels in gigabytes instead of megabytes - # SNMPv3 specific - my $o_login= undef; # Login for snmpv3 -@@ -89,6 +89,7 @@ - my $o_authproto='md5'; # Auth protocol - my $o_privproto='des'; # Priv protocol - my $o_privpass= undef; # priv password -+my $UOM_float= 4; # decimal places - # SNMP Message size parameter (Makina Corpus contrib) - my $o_octetlength=undef; - -@@ -112,8 +113,10 @@ sub is_pattern_valid { # Test for things like "" or "+5-i" - - # Get the alarm signal (just in case snmp timout screws up) - $SIG{'ALRM'} = sub { -- print ("ERROR: General time-out (Alarm signal)\n"); -- exit $ERRORS{"UNKNOWN"}; -+# print ("ERROR: General time-out (Alarm signal)\n"); -+# exit $ERRORS{"UNKNOWN"}; -+ print ("Waiting for info\n"); -+ exit $ERRORS{"OK"}; - }; - - sub isnnum { # Return true if arg is not a number -@@ -315,7 +318,7 @@ sub check_options { - if (defined ($o_octetlength) && (isnnum($o_octetlength) || $o_octetlength > 65535 || $o_octetlength < 484 )) { - print "octet lenght must be < 65535 and > 484\n";print_usage(); exit $ERRORS{"UNKNOWN"}; - } -- #### reserved blocks checks (A. Greiner-Bär patch). -+ #### reserved blocks checks (A. Greiner-B\ufffdr patch). - if (defined ($o_reserve) && (isnnum($o_reserve) || $o_reserve > 99 || $o_reserve < 0 )) { - print "reserved blocks must be < 100 and >= 0\n";print_usage(); exit $ERRORS{"UNKNOWN"}; - } -@@ -348,6 +351,7 @@ sub check_options { - -authpassword => $o_passwd, - -authprotocol => $o_authproto, - -port => $o_port, -+ -retries => 10, - -timeout => $o_timeout - ); - } else { -@@ -361,6 +365,7 @@ sub check_options { - -privpassword => $o_privpass, - -privprotocol => $o_privproto, - -port => $o_port, -+ -retries => 10, - -timeout => $o_timeout - ); - } -@@ -373,6 +378,7 @@ sub check_options { - -version => 2, - -community => $o_community, - -port => $o_port, -+ -retries => 10, - -timeout => $o_timeout - ); - } else { -@@ -382,6 +388,7 @@ sub check_options { - -hostname => $o_host, - -community => $o_community, - -port => $o_port, -+ -retries => 10, - -timeout => $o_timeout - ); - } -@@ -491,18 +498,28 @@ sub check_options { - - my $result=undef; - --if (Net::SNMP->VERSION lt 4) { -- $result = $session->get_request(@oids); --} else { -- if ($session->version == 0) { -- # snmpv1 -- $result = $session->get_request(Varbindlist => \@oids); -- } else { -- # snmp v2c or v3 : get_bulk_request is not really good for this, so do simple get -- $result = $session->get_request(Varbindlist => \@oids); -- foreach my $key ( keys %$result) { verb("$key : $$result{$key}"); } -- } --} -+if (Net::SNMP->VERSION lt 4) -+ { -+ $result = $session->get_request(@oids); -+ } -+else -+ { -+ $result = $session->get_request(Varbindlist => \@oids); -+ foreach my $key ( keys %$result) -+ { -+ # Fix for filesystems larger 2 TB. More than 2 TB will cause an error because -+ # as defined in the RFC hrStorageSize is a 32 bit integer. So filesystems -+ # larger 2 TB report a negative value because the first bit will be interpreted -+ # as an algebraic sign. (0 = +, all others will be -). You simply have to add -+ # 2 to the power of 32 (4294967296) and it is fixed. -+ # Martin Fuerstenau, Oce Printing Systems, 25th Sept 2012 -+ if ($$result{$key} < 0) -+ { -+ $$result{$key} = $$result{$key} + 4294967296; -+ } -+ verb("$key x $$result{$key}"); -+ } -+ } - - if (!defined($result)) { printf("ERROR: Size table :%s.\n", $session->error); $session->close; - exit $ERRORS{"UNKNOWN"}; -@@ -547,6 +564,7 @@ sub check_options { - verb("Size : $$result{$size_table . $tindex[$i]}"); - verb("Used : $$result{$used_table . $tindex[$i]}"); - verb("Alloc : $$result{$alloc_units . $tindex[$i]}"); -+ - if (!defined($$result{$size_table . $tindex[$i]}) || - !defined($$result{$used_table . $tindex[$i]}) || - !defined ($$result{$alloc_units . $tindex[$i]})) { -@@ -623,7 +641,7 @@ sub check_options { - } - } - # Performance output (in MB) -- $perf_out .= "'".$Pdescr. "'=" . round($bu,0) . $output_metric ."B;" . round($p_warn,0) -+ $perf_out .= "'".$Pdescr. "'=" . round($bu,$UOM_float) . $output_metric ."B;" . round($p_warn,0) - . ";" . round($p_crit,0) . ";0;" . round($to,0); - } - --- -1.8.5.1 - diff --git a/debian/patches/16_perfdata b/debian/patches/16_perfdata deleted file mode 100644 index d24ba34..0000000 --- a/debian/patches/16_perfdata +++ /dev/null @@ -1,266 +0,0 @@ -## 16_perfdata by Michael Friedrich -## -## DP: Add perfdata - -## From 264a0b15dd69a7ab4133b351b9316e1b443da154 Mon Sep 17 00:00:00 2001 -## From: Michael Friedrich -## Date: Sat, 11 May 2013 11:34:47 +0200 -## Subject: [PATCH] add --perfdata next to --perfparse, clarify on what this is - ---- - check_snmp_boostedge.pl | 6 +++--- - check_snmp_cpfw.pl | 8 ++++---- - check_snmp_int.pl | 6 +++--- - check_snmp_linkproof_nhr.pl | 6 +++--- - check_snmp_load.pl | 6 +++--- - check_snmp_nsbox.pl | 6 +++--- - check_snmp_storage.pl | 6 +++--- - doc/snmp_cpfw.html | 4 ++-- - doc/snmp_css.html | 4 ++-- - doc/snmp_env.html | 4 ++-- - doc/snmp_int.html | 4 ++-- - doc/snmp_load.html | 4 ++-- - doc/snmp_storage.html | 4 ++-- - 13 files changed, 34 insertions(+), 34 deletions(-) - ---- a/check_snmp_boostedge.pl -+++ b/check_snmp_boostedge.pl -@@ -121,8 +121,8 @@ - : Priv protocole (des|aes : default des) - -P, --port=PORT - SNMP port (Default 161) ---f, --perfparse -- Perfparse compatible output -+-f, --perfparse, --perfdata -+ Performance data output - -t, --timeout=INTEGER - timeout for SNMP in seconds (Default: 5) - -V, --version -@@ -148,7 +148,7 @@ - 't:i' => \$o_timeout, 'timeout:i' => \$o_timeout, - 'V' => \$o_version, 'version' => \$o_version, - '2' => \$o_version2, 'v2c' => \$o_version2, -- 'f' => \$o_perf, 'perfparse' => \$o_perf, -+ 'f' => \$o_perf, 'perfparse' => \$o_perf, 'perfdata' => \$o_perf, - 's:s' => \$o_service, 'service:s' => \$o_service, - 'n:i' => \$o_nservice, 'number:i' => \$o_nservice - ); ---- a/check_snmp_cpfw.pl -+++ b/check_snmp_cpfw.pl -@@ -148,8 +148,8 @@ - check if installed policy is POLICY_NAME (must have -w) - -c, --connexions=WARN,CRIT - check warn and critical number of connexions (must have -w) ---f, --perfparse -- perfparse output (only works with -c) -+-f, --perfparse, --perfdata -+ performance data output (only works with -c) - -P, --port=PORT - SNMP port (Default 161) - -t, --timeout=INTEGER -@@ -183,7 +183,7 @@ - 'm' => \$o_mgmt, 'mgmt' => \$o_mgmt, - 'p:s' => \$o_policy, 'policy:s' => \$o_policy, - 'c:s' => \$o_conn, 'connexions:s' => \$o_conn, -- 'f' => \$o_perf, 'perfparse' => \$o_perf -+ 'f' => \$o_perf, 'perfparse' => \$o_perf, 'perfdata' => \$o_perf - ); - if (defined ($o_help) ) { help(); exit $ERRORS{"UNKNOWN"}}; - if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"}}; -@@ -222,7 +222,7 @@ - { print "Put a policy name !\n"; print_usage(); exit $ERRORS{"UNKNOWN"}} - } - if (defined($o_perf) && ! defined ($o_conn)) -- { print "Nothing selected for perfparse !\n";print_usage(); exit $ERRORS{"UNKNOWN"}} -+ { print "Nothing selected for performance data output !\n";print_usage(); exit $ERRORS{"UNKNOWN"}} - if (!defined($o_fw) && !defined($o_ha) && !defined($o_mgmt) && !defined($o_svn)) - { print "Must select a product to check !\n";print_usage(); exit $ERRORS{"UNKNOWN"}} - if (defined ($o_ha) && ($o_ha ne "") && ($o_ha ne "standby")) ---- a/check_snmp_int.pl -+++ b/check_snmp_int.pl -@@ -199,8 +199,8 @@ - max-size of the SNMP message, usefull in case of Too Long responses. - Be carefull with network filters. Range 484 - 65535, default are - usually 1472,1452,1460 or 1440. ---f, --perfparse -- Perfparse compatible output (no output when interface is down). -+-f, --perfparse, --perfdata -+ Performance data output (no output when interface is down). - -e, --error - Add error & discard to Perfparse output - -S, --intspeed -@@ -267,7 +267,7 @@ - 'a' => \$o_admin, 'admin' => \$o_admin, - 'r' => \$o_noreg, 'noregexp' => \$o_noreg, - 'V' => \$o_version, 'version' => \$o_version, -- 'f' => \$o_perf, 'perfparse' => \$o_perf, -+ 'f' => \$o_perf, 'perfparse' => \$o_perf, 'perfdata' => \$o_perf, - 'e' => \$o_perfe, 'error' => \$o_perfe, - 'k' => \$o_checkperf, 'perfcheck' => \$o_checkperf, - 'q' => \$o_ext_checkperf, 'extperfcheck' => \$o_ext_checkperf, ---- a/check_snmp_linkproof_nhr.pl -+++ b/check_snmp_linkproof_nhr.pl -@@ -100,8 +100,8 @@ - : Priv protocole (des|aes : default des) - -P, --port=PORT - SNMP port (Default 161) ---f, --perfparse -- Perfparse compatible output -+-f, --perfparse, --perfdata -+ Performance data output - -t, --timeout=INTEGER - timeout for SNMP in seconds (Default: 5) - -V, --version -@@ -127,7 +127,7 @@ - 't:i' => \$o_timeout, 'timeout:i' => \$o_timeout, - 'V' => \$o_version, 'version' => \$o_version, - '2' => \$o_version2, 'v2c' => \$o_version2, -- 'f' => \$o_perf, 'perfparse' => \$o_perf, -+ 'f' => \$o_perf, 'perfparse' => \$o_perf, 'perfdata' => \$o_perf - ); - # Basic checks - if (defined($o_timeout) && (isnnum($o_timeout) || ($o_timeout < 2) || ($o_timeout > 60))) ---- a/check_snmp_load.pl -+++ b/check_snmp_load.pl -@@ -178,8 +178,8 @@ - hp : HP procurve switch CPU usage - lp : Linkproof CPU usage - hpux : HP-UX load (1,5 & 15 minutes values) ---f, --perfparse -- Perfparse compatible output -+-f, --perfparse, --perfdata -+ Performance data output - -t, --timeout=INTEGER - timeout for SNMP in seconds (Default: 5) - -V, --version -@@ -207,7 +207,7 @@ - '2' => \$o_version2, 'v2c' => \$o_version2, - 'c:s' => \$o_crit, 'critical:s' => \$o_crit, - 'w:s' => \$o_warn, 'warn:s' => \$o_warn, -- 'f' => \$o_perf, 'perfparse' => \$o_perf, -+ 'f' => \$o_perf, 'perfparse' => \$o_perf, 'perfdata' => \$o_perf, - 'T:s' => \$o_check_type, 'type:s' => \$o_check_type - ); - # check the -T option ---- a/check_snmp_nsbox.pl -+++ b/check_snmp_nsbox.pl -@@ -126,8 +126,8 @@ - number of diode and vhost that must be up. - -P, --port=PORT - SNMP port (Default 161) ---f, --perfparse -- Perfparse compatible output -+-f, --perfparse, --perfdata -+ Performance data output - -t, --timeout=INTEGER - timeout for SNMP in seconds (Default: 5) - -V, --version -@@ -153,7 +153,7 @@ - 't:i' => \$o_timeout, 'timeout:i' => \$o_timeout, - 'V' => \$o_version, 'version' => \$o_version, - '2' => \$o_version2, 'v2c' => \$o_version2, -- 'f' => \$o_perf, 'perfparse' => \$o_perf, -+ 'f' => \$o_perf, 'perfparse' => \$o_perf, 'perfdata' => \$o_perf, - 'd:s' => \$o_diode, 'diode:s' => \$o_diode, - 's:s' => \$o_vhost, 'vhost:s' => \$o_vhost, - 'n:s' => \$o_nvhost, 'number:s' => \$o_nvhost ---- a/check_snmp_storage.pl -+++ b/check_snmp_storage.pl -@@ -189,8 +189,8 @@ - For ext2/3 filesystems, it is 5% by default - -G, --gigabyte - output, warning & critical levels in gigabytes ---f, --perfparse -- Perfparse compatible output -+-f, --perfparse, --perfdata -+ Performance data output - -S, --short=[,,] - : Make the output shorter : - 0 : only print the global result except the disk in warning or critical -@@ -255,7 +255,7 @@ - 'q:s' => \$o_storagetype, 'storagetype:s'=> \$o_storagetype, - 'S:s' => \$o_short, 'short:s' => \$o_short, - 'o:i' => \$o_octetlength, 'octetlength:i' => \$o_octetlength, -- 'f' => \$o_perf, 'perfparse' => \$o_perf, -+ 'f' => \$o_perf, 'perfparse' => \$o_perf, 'perfdata' => \$o_perf, - 'R:i' => \$o_reserve, 'reserved:i' => \$o_reserve, - 'G' => \$o_giga, 'gigabyte' => \$o_giga - ); ---- a/doc/snmp_cpfw.html -+++ b/doc/snmp_cpfw.html -@@ -414,8 +414,8 @@ - check if installed policy is POLICY_NAME (must have -w)
- -c, --connexions=WARN,CRIT
- check warn and critical number of connexions (must have -w)
-- -f, --perfparse
-- perfparse output (only works with -c)
-+ -f, --perfparse, --perfdata
-+ performance data output (only works with -c)
- -P, --port=PORT
- SNMP port (Default 161)
- -t, --timeout=INTEGER
---- a/doc/snmp_css.html -+++ b/doc/snmp_css.html -@@ -289,8 +289,8 @@ - <privproto> : Priv protocole (des|aes : default des) - -P, --port=PORT - SNMP port (Default 161) ---f, --perfparse -- Perfparse compatible output -+-f, --perfparse, --perfdata -+ Performance data output - -t, --timeout=INTEGER - timeout for SNMP in seconds (Default: 5) - -V, --version ---- a/doc/snmp_env.html -+++ b/doc/snmp_env.html -@@ -319,8 +319,8 @@ - Minimum fan rpm value
- -c, --celcius=<celcius>
- Maximum temp in degree celcius
-- -f, --perfparse
-- Perfparse compatible output
-+ -f, --perfparse, --perfdata
-+ Performance data output
- -t, --timeout=INTEGER
- timeout for SNMP in seconds (Default: 5)
- -V, --version
---- a/doc/snmp_int.html -+++ b/doc/snmp_int.html -@@ -594,8 +594,8 @@ - Be carefull with network filters. Range 484 - 65535, default - are
- usually 1472,1452,1460 or 1440.
-- -f, --perfparse
-- Perfparse compatible output (no output when interface is down).
-+ -f, --perfparse, --perfdata
-+ Performance data output (no output when interface is down).
- -e, --error
- Add error & discard to Perfparse output
- -S, --intspeed
---- a/doc/snmp_load.html -+++ b/doc/snmp_load.html -@@ -357,8 +357,8 @@ - nokia : Nokia CPU usage
- hp : HP procurve switch CPU usage
- lp : Linkproof CPU usage
-- -f, --perfparse
-- Perfparse compatible output
-+ -f, --perfparse, --perfdata
-+ Performance data output
- -t, --timeout=INTEGER
- timeout for SNMP in seconds (Default: 5)
- -V, --version
---- a/doc/snmp_storage.html -+++ b/doc/snmp_storage.html -@@ -1211,8 +1211,8 @@ - -c, --critical=INTEGER
- percent / MB of disk used to generate CRITICAL state
- you can add the % sign
-- -f, --perfparse
-- Perfparse compatible output
-+ -f, --perfparse, --perfdata
-+ Performance data output
- -S, --short=<type>[,<where>,<cut>]
- <type>: Make the output shorter :
- 0 : only print the global result except the disk in warning diff --git a/debian/patches/17_protocol_fam b/debian/patches/17_protocol_fam deleted file mode 100644 index e38e4b6..0000000 --- a/debian/patches/17_protocol_fam +++ /dev/null @@ -1,385 +0,0 @@ -## 17_protocol_fam by Alice Kærast -## -## DP: Add protocol and IPv[46] - -## From 5369da5d2b3e4351e04f016619736f7d03cbcdfd Mon Sep 17 00:00:00 2001 -## From: Michael Friedrich -## Date: Fri, 5 Jul 2013 21:32:45 +0200 -## Subject: [PATCH] add -P|--protocol= setting tcp/udp and IPv4/IPv6 for -## load/mem/process/storage -## MIME-Version: 1.0 -## Content-Type: text/plain; charset=UTF-8 -## Content-Transfer-Encoding: 8bit -## -## reworked the patches from -## https://sourceforge.net/p/nagios-snmp/feature-requests/27/ -## to make them fit the current patch level, and keep the same output the -## most. -## -## full kudos to Alice Kærast. ---- - check_snmp_load.pl | 26 ++++++++++++++++++++------ - check_snmp_mem.pl | 24 ++++++++++++++++++------ - check_snmp_process.pl | 28 ++++++++++++++++++++-------- - check_snmp_storage.pl | 22 +++++++++++++++++----- - 4 files changed, 75 insertions(+), 25 deletions(-) - -diff --git a/check_snmp_load.pl b/plugins/check_snmp_load.pl -index 71487ec..a1ccc7c 100755 ---- a/check_snmp_load.pl -+++ b/check_snmp_load.pl -@@ -95,6 +95,7 @@ - my $o_host = undef; # hostname - my $o_community = undef; # community - my $o_port = 161; # port -+my $o_domain= 'udp/ipv4'; # protocol - my $o_help= undef; # wan't some help ? - my $o_verb= undef; # verbose mode - my $o_version= undef; # print version -@@ -121,7 +122,7 @@ - sub p_version { print "check_snmp_load version : $Version\n"; } - - sub print_usage { -- print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -w -c -T=[stand|netsl|netsc|as400|cisco|cata|nsc|fg|bc|nokia|hp|lp|hpux] [-f] [-t ] [-V]\n"; -+ print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] [-P ] -w -c -T=[stand|netsl|netsc|as400|cisco|cata|nsc|fg|bc|nokia|hp|lp|hpux] [-f] [-t ] [-V]\n"; - } - - sub isnnum { # Return true if arg is not a number -@@ -153,8 +154,16 @@ sub help { - -L, --protocols=, - : Authentication protocol (md5|sha : default md5) - : Priv protocole (des|aes : default des) ---P, --port=PORT -+-p, --port=PORT - SNMP port (Default 161) -+-P, --protocol=PROTOCOL -+ Network protocol to be used -+ ['udp/ipv4'] : UDP over IPv4 -+ 'udp/ipv6' : UDP over IPv6 -+ 'tcp/ipv4' : TCP over IPv4 -+ 'tcp/ipv6' : TCP over IPv6 -+ -+ Network protocol (Default udp/ipv4) - -w, --warn=INTEGER | INT,INT,INT - 1 value check : warning level for cpu in percent (on one minute) - 3 value check : comma separated level for load or cpu for 1min, 5min, 15min -@@ -197,6 +206,7 @@ sub check_options { - 'h' => \$o_help, 'help' => \$o_help, - 'H:s' => \$o_host, 'hostname:s' => \$o_host, - 'p:i' => \$o_port, 'port:i' => \$o_port, -+ 'P:s' => \$o_domain, 'protocol:s' => \$o_domain, - 'C:s' => \$o_community, 'community:s' => \$o_community, - 'l:s' => \$o_login, 'login:s' => \$o_login, - 'x:s' => \$o_passwd, 'passwd:s' => \$o_passwd, -@@ -297,7 +307,8 @@ sub check_options { - -username => $o_login, - -authpassword => $o_passwd, - -authprotocol => $o_authproto, -- -timeout => $o_timeout -+ -timeout => $o_timeout, -+ -domain => $o_domain - ); - } else { - verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); -@@ -309,7 +320,8 @@ sub check_options { - -authprotocol => $o_authproto, - -privpassword => $o_privpass, - -privprotocol => $o_privproto, -- -timeout => $o_timeout -+ -timeout => $o_timeout, -+ -domain => $o_domain - ); - } - } else { -@@ -321,7 +333,8 @@ sub check_options { - -version => 2, - -community => $o_community, - -port => $o_port, -- -timeout => $o_timeout -+ -timeout => $o_timeout, -+ -domain => $o_domain - ); - } else { - # SNMPV1 login -@@ -330,7 +343,8 @@ sub check_options { - -hostname => $o_host, - -community => $o_community, - -port => $o_port, -- -timeout => $o_timeout -+ -timeout => $o_timeout, -+ -domain => $o_domain - ); - } - } -diff --git a/check_snmp_mem.pl b/plugins/check_snmp_mem.pl -index 631a39b..6f5425e 100644 ---- a/check_snmp_mem.pl -+++ b/check_snmp_mem.pl -@@ -63,6 +63,7 @@ - my $o_host = undef; # hostname - my $o_community = undef; # community - my $o_port = 161; # port -+my $o_domain= 'udp/ipv4'; # Default to UDP over IPv4 - my $o_help= undef; # wan't some help ? - my $o_verb= undef; # verbose mode - my $o_version= undef; # print version -@@ -93,7 +94,7 @@ - sub p_version { print "check_snmp_mem version : $Version\n"; } - - sub print_usage { -- print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -w -c [-I|-N|-E] [-f] [-m -b] [-t ] [-V]\n"; -+ print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] [-P ] -w -c [-I|-N|-E] [-f] [-m -b] [-t ] [-V]\n"; - } - - sub isnnum { # Return true if arg is not a number -@@ -129,8 +130,14 @@ sub help { - -L, --protocols=, - : Authentication protocol (md5|sha : default md5) - : Priv protocole (des|aes : default des) ---P, --port=PORT -+-p, --port=PORT - SNMP port (Default 161) -+-P, --protocol=PROTOCOL -+ Network protocol to be used -+ ['udp/ipv4'] : UDP over IPv4 -+ 'udp/ipv6' : UDP over IPv6 -+ 'tcp/ipv4' : TCP over IPv4 -+ 'tcp/ipv6' : TCP over IPv6 - -w, --warn=INTEGER | INT,INT - warning level for memory in percent (0 for no checks) - Default (-N switch) : comma separated level for Real Memory and Swap -@@ -174,6 +181,7 @@ sub check_options { - 'h' => \$o_help, 'help' => \$o_help, - 'H:s' => \$o_host, 'hostname:s' => \$o_host, - 'p:i' => \$o_port, 'port:i' => \$o_port, -+ 'P:s' => \$o_domain, 'protocol:s' => \$o_domain, - 'C:s' => \$o_community, 'community:s' => \$o_community, - 'l:s' => \$o_login, 'login:s' => \$o_login, - 'x:s' => \$o_passwd, 'passwd:s' => \$o_passwd, -@@ -270,7 +278,8 @@ sub check_options { - -authpassword => $o_passwd, - -authprotocol => $o_authproto, - -port => $o_port, -- -timeout => $o_timeout -+ -timeout => $o_timeout, -+ -domain => $o_domain - ); - } else { - verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); -@@ -283,7 +292,8 @@ sub check_options { - -privpassword => $o_privpass, - -privprotocol => $o_privproto, - -port => $o_port, -- -timeout => $o_timeout -+ -timeout => $o_timeout, -+ -domain => $o_domain - ); - } - } else { -@@ -295,7 +305,8 @@ sub check_options { - -version => 2, - -community => $o_community, - -port => $o_port, -- -timeout => $o_timeout -+ -timeout => $o_timeout, -+ -domain => $o_domain - ); - } else { - # SNMPV1 login -@@ -304,7 +315,8 @@ sub check_options { - -hostname => $o_host, - -community => $o_community, - -port => $o_port, -- -timeout => $o_timeout -+ -timeout => $o_timeout, -+ -domain => $o_domain - ); - } - } -diff --git a/check_snmp_process.pl b/plugins/check_snmp_process.pl -index 9494c7c..7a83432 100755 ---- a/check_snmp_process.pl -+++ b/check_snmp_process.pl -@@ -42,6 +42,7 @@ - my $o_host = undef; # hostname - my $o_community =undef; # community - my $o_port = 161; # port -+my $o_domain= 'udp/ipv4'; # Default to UDP over IPv4 - my $o_version2 = undef; #use snmp v2c - my $o_descr = undef; # description filter - my $o_warn = 0; # warning limit -@@ -80,7 +81,7 @@ - sub p_version { print "check_snmp_process version : $Version\n"; } - - sub print_usage { -- print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd) [-p ] -n [-w [,] -c [,max_proc] ] [-m, -a -u, -d ] [-t ] [-o ] [-f -A -F ] [-r] [-V] [-g]\n"; -+ print "Usage: $0 [-v] -H -C [-2] | (-l login -x passwd) [-p ] [-P ] -n [-w [,] -c [,max_proc] ] [-m, -a -u, -d ] [-t ] [-o ] [-f -A -F ] [-r] [-V] [-g]\n"; - } - - sub isnotnum { # Return true if arg is not a number -@@ -166,6 +167,12 @@ sub help { - : Priv protocole (des|aes : default des) - -p, --port=PORT - SNMP port (Default 161) -+-P, --protocol=PROTOCOL -+ Network protocol to be used -+ ['udp/ipv4'] : UDP over IPv4 -+ 'udp/ipv6' : UDP over IPv6 -+ 'tcp/ipv4' : TCP over IPv4 -+ 'tcp/ipv6' : TCP over IPv6 - -n, --name=NAME - Name of the process (regexp) - No trailing slash ! -@@ -233,6 +240,7 @@ sub check_options { - 'h' => \$o_help, 'help' => \$o_help, - 'H:s' => \$o_host, 'hostname:s' => \$o_host, - 'p:i' => \$o_port, 'port:i' => \$o_port, -+ 'P:s' => \$o_domain, 'protocol:s' => \$o_domain, - 'C:s' => \$o_community, 'community:s' => \$o_community, - 'l:s' => \$o_login, 'login:s' => \$o_login, - 'x:s' => \$o_passwd, 'passwd:s' => \$o_passwd, -@@ -240,20 +248,20 @@ sub check_options { - 'L:s' => \$v3protocols, 'protocols:s' => \$v3protocols, - 'c:s' => \$o_crit, 'critical:s' => \$o_crit, - 'w:s' => \$o_warn, 'warn:s' => \$o_warn, -- 't:i' => \$o_timeout, 'timeout:i' => \$o_timeout, -+ 't:i' => \$o_timeout, 'timeout:i' => \$o_timeout, - 'n:s' => \$o_descr, 'name:s' => \$o_descr, - 'r' => \$o_noreg, 'noregexp' => \$o_noreg, - 'f' => \$o_path, 'fullpath' => \$o_path, - 'm:s' => \$o_mem, 'memory:s' => \$o_mem, - 'a' => \$o_mem_avg, 'average' => \$o_mem_avg, - 'u:s' => \$o_cpu, 'cpu' => \$o_cpu, -- '2' => \$o_version2, 'v2c' => \$o_version2, -- 'o:i' => \$o_octetlength, 'octetlength:i' => \$o_octetlength, -- 'g' => \$o_get_all, 'getall' => \$o_get_all, -- 'A' => \$o_param, 'param' => \$o_param, -- 'F' => \$o_perf, 'perfout' => \$o_perf, -+ '2' => \$o_version2, 'v2c' => \$o_version2, -+ 'o:i' => \$o_octetlength, 'octetlength:i' => \$o_octetlength, -+ 'g' => \$o_get_all, 'getall' => \$o_get_all, -+ 'A' => \$o_param, 'param' => \$o_param, -+ 'F' => \$o_perf, 'perfout' => \$o_perf, - 'd:i' => \$o_delta, 'delta:i' => \$o_delta, -- 'V' => \$o_version, 'version' => \$o_version -+ 'V' => \$o_version, 'version' => \$o_version - ); - if (defined ($o_help)) { help(); exit $ERRORS{"UNKNOWN"}}; - if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"}}; -@@ -343,6 +351,7 @@ sub check_options { - -hostname => $o_host, - -version => '3', - -port => $o_port, -+ -domain => $o_domain, - -username => $o_login, - -authpassword => $o_passwd, - -authprotocol => $o_authproto, -@@ -355,6 +364,7 @@ sub check_options { - -version => '3', - -username => $o_login, - -port => $o_port, -+ -domain => $o_domain, - -authpassword => $o_passwd, - -authprotocol => $o_authproto, - -privpassword => $o_privpass, -@@ -370,6 +380,7 @@ sub check_options { - -version => 2, - -community => $o_community, - -port => $o_port, -+ -domain => $o_domain, - -timeout => $o_timeout - ); - } else { -@@ -378,6 +389,7 @@ sub check_options { - -hostname => $o_host, - -community => $o_community, - -port => $o_port, -+ -domain => $o_domain, - -timeout => $o_timeout - ); - } -diff --git a/check_snmp_storage.pl b/plugins/check_snmp_storage.pl -index 31a4015..9725dce 100644 ---- a/check_snmp_storage.pl -+++ b/check_snmp_storage.pl -@@ -62,6 +62,7 @@ - my $o_host = undef; # hostname - my $o_community = undef; # community - my $o_port = 161; # port -+my $o_domain= 'udp/ipv4'; # Default to UDP over IPv4 - my $o_version2 = undef; #use snmp v2c - my $o_descr = undef; # description filter - my $o_storagetype = undef; # parse storage type also -@@ -98,7 +99,7 @@ - sub p_version { print "$Name version : $Version\n"; } - - sub print_usage { -- print "Usage: $Name [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] -m [-q storagetype] -w -c [-t ] [-T pl|pu|bl|bu ] [-r -s -i -G] [-e] [-S 0|1[,1,]] [-o ] [-R <% reserved>]\n"; -+ print "Usage: $Name [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] [-P ] -m [-q storagetype] -w -c [-t ] [-T pl|pu|bl|bu ] [-r -s -i -G] [-e] [-S 0|1[,1,]] [-o ] [-R <% reserved>]\n"; - } - - sub round ($$) { -@@ -154,6 +155,12 @@ sub help { - Password for snmpv3 authentication - -p, --port=PORT - SNMP port (Default 161) -+-P, --protocol=PROTOCOL -+ Network protocol to be used -+ ['udp/ipv4'] : UDP over IPv4 -+ 'udp/ipv6' : UDP over IPv6 -+ 'tcp/ipv4' : TCP over IPv4 -+ 'tcp/ipv6' : TCP over IPv6 - -m, --name=NAME - Name in description OID (can be mounpoints '/home' or 'Swap Space'...) - This is treated as a regexp : -m /var will match /var , /var/log, /opt/var ... -@@ -236,6 +243,7 @@ sub check_options { - 'h' => \$o_help, 'help' => \$o_help, - 'H:s' => \$o_host, 'hostname:s' => \$o_host, - 'p:i' => \$o_port, 'port:i' => \$o_port, -+ 'P:s' => \$o_domain, 'protocol:s' => \$o_domain, - 'C:s' => \$o_community, 'community:s' => \$o_community, - '2' => \$o_version2, 'v2c' => \$o_version2, - 'l:s' => \$o_login, 'login:s' => \$o_login, -@@ -352,7 +360,8 @@ sub check_options { - -authprotocol => $o_authproto, - -port => $o_port, - -retries => 10, -- -timeout => $o_timeout -+ -timeout => $o_timeout, -+ -domain => $o_domain - ); - } else { - verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto"); -@@ -366,7 +375,8 @@ sub check_options { - -privprotocol => $o_privproto, - -port => $o_port, - -retries => 10, -- -timeout => $o_timeout -+ -timeout => $o_timeout, -+ -domain => $o_domain - ); - } - } else { -@@ -379,7 +389,8 @@ sub check_options { - -community => $o_community, - -port => $o_port, - -retries => 10, -- -timeout => $o_timeout -+ -timeout => $o_timeout, -+ -domain => $o_domain - ); - } else { - # SNMPV1 login -@@ -389,7 +400,8 @@ sub check_options { - -community => $o_community, - -port => $o_port, - -retries => 10, -- -timeout => $o_timeout -+ -timeout => $o_timeout, -+ -domain => $o_domain - ); - } - } --- -1.8.5.5 - diff --git a/debian/patches/18_check_snmp_process_tmp_file b/debian/patches/18_check_snmp_process_tmp_file deleted file mode 100644 index 81d2091..0000000 --- a/debian/patches/18_check_snmp_process_tmp_file +++ /dev/null @@ -1,32 +0,0 @@ -## 18_check_snmp_process_tmp_file by S.Bay -## -## DP: Fix tmp file check_snmp_process - -## From 88c3bfd626a531e7da1c3e3c694f6fd1d4a70692 Mon Sep 17 00:00:00 2001 -## From: "S.Bay" -## Date: Tue, 17 Dec 2013 09:32:15 +0100 -## Subject: [PATCH] Fix error writing tmp file using plugin with remote unix -## system - ---- - check_snmp_process.pl | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/check_snmp_process.pl b/plugins/check_snmp_process.pl -index 7a83432..11f2d96 100755 ---- a/check_snmp_process.pl -+++ b/check_snmp_process.pl -@@ -640,6 +640,10 @@ sub check_options { - #### Read file - $temp_file_name=$o_descr; - $temp_file_name =~ s/ /_/g; -+ $temp_file_name =~ s/\//_/g; -+ $temp_file_name =~ s/-//g; -+ $temp_file_name =~ s/=//g; -+ $temp_file_name = substr($temp_file_name,0,40); - $temp_file_name = $o_base_dir . $o_host ."." . $temp_file_name; - # First, read entire file - my @ret_array=read_file($temp_file_name,$n_items_check); --- -1.8.5.5 - diff --git a/debian/patches/19_check_snmp_load_n5k b/debian/patches/19_check_snmp_load_n5k deleted file mode 100644 index 85b9fba..0000000 --- a/debian/patches/19_check_snmp_load_n5k +++ /dev/null @@ -1,97 +0,0 @@ -## 19_check_snmp_load_n5k by Luis I. Perez Villota -## -## DP: Add support for n5k to check_snmp_load.pl - -## From de5ca289b5a696d17bdf0343f53b06ab7f7bbb9b Mon Sep 17 00:00:00 2001 -## From: "Luis I. Perez Villota" -## Date: Wed, 8 Apr 2015 14:18:37 +0200 -## Subject: [PATCH] Add Cisco Nexus Devices capability for load - - Adding CPU Check for Cisco Nexus Devices ---- - check_snmp_load.pl | 50 ++++++++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 48 insertions(+), 2 deletions(-) - -diff --git a/check_snmp_load.pl b/check_snmp_load.pl -index 6487bde..fd13f71 100755 ---- a/check_snmp_load.pl -+++ b/check_snmp_load.pl -@@ -55,6 +55,9 @@ - - my $as400_cpu = "1.3.6.1.4.1.2.6.4.5.1.0"; # AS400 CPU load (10000=100%); - -+# N5K CPU -+my $n5k_cpu = "1.3.6.1.4.1.9.9.305.1.1.1.0"; # N5K CPU load (%) -+ - # Net-SNMP CPU - - my $ns_cpu_idle = "1.3.6.1.4.1.2021.11.11.0"; # Net-snmp cpu idle -@@ -85,9 +88,9 @@ - my $hpux_load_15_min="1.3.6.1.4.1.11.2.3.1.1.5.0"; - - # valid values --my @valid_types = ("stand","netsc","netsl","as400","cisco","cata","nsc","fg","bc","nokia","hp","lp","hpux"); -+my @valid_types = ("stand","netsc","netsl","as400","cisco","cata","nsc","fg","bc","nokia","hp","lp","hpux","n5k"); - # CPU OID array --my %cpu_oid = ("netsc",$ns_cpu_idle,"as400",$as400_cpu,"bc",$bluecoat_cpu,"nokia",$nokia_cpu,"hp",$procurve_cpu,"lp",$linkproof_cpu,"fg",$fortigate_cpu); -+my %cpu_oid = ("netsc",$ns_cpu_idle,"as400",$as400_cpu,"bc",$bluecoat_cpu,"nokia",$nokia_cpu,"hp",$procurve_cpu,"lp",$linkproof_cpu,"fg",$fortigate_cpu, "n5k",$n5k_cpu); - - # Globals - -@@ -179,6 +182,7 @@ sub help { - netsc : cpu usage given by net-snmp (100-idle) - as400 : as400 CPU usage - cisco : Cisco CPU usage -+ n5k : Cisco Nexus CPU Usage - cata : Cisco catalyst CPU usage - nsc : NetScreen CPU usage - fg : Fortigate CPU usage -@@ -475,6 +479,48 @@ sub check_options { - exit $exit_val; - } - -+############## Cisco N5K CPU Check ################### -+if ($o_check_type eq "n5k") { -+my @oidlists = ($n5k_cpu); -+my $resultat = (Net::SNMP->VERSION lt 4) ? -+ $session->get_request(@oidlists) -+ : $session->get_request(-varbindlist => \@oidlists); -+if (!defined($resultat)) { -+ printf("ERROR: Description table : %s.\n", $session->error); -+ $session->close; -+ exit $ERRORS{"UNKNOWN"}; -+} -+ -+$session->close; -+if (!defined ($$resultat{$n5k_cpu})) { -+ print "No CPU information : UNKNOWN\n"; -+ exit $ERRORS{"UNKNOWN"}; -+} -+ -+my $n5k_load = $$resultat{$n5k_cpu}; -+if ($n5k_load > $o_crit ) { -+ print "$n5k_load% > $o_crit% : CRITICAL"; -+ $exit_val=$ERRORS{"CRITICAL"}; -+} -+elsif ($n5k_load > $o_warn) { -+ print "$n5k_load% > $o_warn% : WARNING"; -+ $exit_val=$ERRORS{"WARNING"}; -+} -+else{ -+ print "CPU: $n5k_load%"; -+ $exit_val=$ERRORS{"OK"}; -+} -+if (defined($o_perf)) { -+ print " | n5k_load=$n5k_load%"; -+} -+print "\n"; -+exit $exit_val; -+ -+ -+ -+ -+ -+} - ############## Cisco Catalyst CPU check ################ - - if ($o_check_type eq "cata") { diff --git a/debian/patches/20_check_snmp_load_multiple_cpus b/debian/patches/20_check_snmp_load_multiple_cpus deleted file mode 100644 index e1a9ce4..0000000 --- a/debian/patches/20_check_snmp_load_multiple_cpus +++ /dev/null @@ -1,64 +0,0 @@ -## 19_check_snmp_load_n5k by Luis I. Perez Villota -## -## DP: Add support for n5k to check_snmp_load.pl - -## From 1fcf4f4220edb886fb85931792542d962cf02ecb Mon Sep 17 00:00:00 2001 -## From: Michael Friedrich -## Date: Sat, 25 Apr 2015 15:20:32 +0200 -## Subject: [PATCH] check_snmp_load.pl - Linux load multiple CPUs - -## Linux load doesn't handle multiple CPUs properly. Here is a patch that makes -## the plugin to get the number of CPUs for a particular system and multiply -## warning and critical limits by this number. - -fixes #6 ---- -check_snmp_load.pl | 19 ++++++++++++++++++- - 1 file changed, 18 insertions(+), 1 deletion(-) - ---- a/check_snmp_load.pl -+++ b/check_snmp_load.pl -@@ -363,11 +363,25 @@ - if ($o_check_type eq "netsl") { - - verb("Checking linux load"); -+ -+# Get number of CPUs -+my $resultat = (Net::SNMP->VERSION < 4) ? -+ $session->get_table($proc_id) -+ : $session->get_table(Baseoid => $proc_id); -+ -+if (!defined($resultat)) { -+ printf("ERROR: Description table : %s.\n", $session->error); -+ $session->close; -+ exit $ERRORS{"UNKNOWN"}; -+} -+ -+my $ncpu = keys %$resultat; -+ - # Get load table --my $resultat = (Net::SNMP->VERSION lt 4) ? -+$resultat = (Net::SNMP->VERSION lt 4) ? - $session->get_table($linload_table) -- : $session->get_table(Baseoid => $linload_table); -- -+ : $session->get_table(Baseoid => $linload_table); -+ - if (!defined($resultat)) { - printf("ERROR: Description table : %s.\n", $session->error); - $session->close; -@@ -397,10 +411,13 @@ - - for (my $i=0;$i<3;$i++) { $load[$i] = $$resultat{$linload_load . "." . $iload[$i]}}; - --print "Load : $load[0] $load[1] $load[2] :"; -+print "Load (CPUs: $ncpu) : $load[0] $load[1] $load[2] :"; - - $exit_val=$ERRORS{"OK"}; - for (my $i=0;$i<3;$i++) { -+ # Multiply warning and critical levels by the number of CPUs -+ $o_warnL[$i] *= $ncpu; -+ $o_critL[$i] *= $ncpu; - if ( $load[$i] > $o_critL[$i] ) { - print " $load[$i] > $o_critL[$i] : CRITICAL"; - $exit_val=$ERRORS{"CRITICAL"}; diff --git a/debian/patches/21_check_snmp_load_abstract_snmp_version_check b/debian/patches/21_check_snmp_load_abstract_snmp_version_check deleted file mode 100644 index 21b43e1..0000000 --- a/debian/patches/21_check_snmp_load_abstract_snmp_version_check +++ /dev/null @@ -1,121 +0,0 @@ -From 846165c880793a97a2e727f4d13e23df40e8f1a4 Mon Sep 17 00:00:00 2001 -From: morgajel -Date: Wed, 13 May 2015 12:33:21 -0400 -Subject: [PATCH] Abstracted snmp version check to circumvent error and bug - -There are two issues: -1) Net::SNMP changed it's VERSION to be a quoted string rather than a bare mess. This caused -Argument "v6.0.1" isn't numeric in numeric lt (<) at /opt/manubulon/plugins/check_snmp_load.pl line 368. - -2) the rest of the file used lt rather than <, which means they were using ascii sorting rather than digit comparison - -Both of these issues have now been resolved; This fix has only been applied to this one script, but it may -need to be implemented in the other scripts. ---- - check_snmp_load.pl | 30 +++++++++++++++++++++--------- - 1 file changed, 21 insertions(+), 9 deletions(-) - -diff --git a/check_snmp_load.pl b/check_snmp_load.pl -index c8661aa..751c6ec 100755 ---- a/check_snmp_load.pl -+++ b/check_snmp_load.pl -@@ -280,6 +280,18 @@ sub check_options { - } - } - -+# This is required to get around all of the silly historical methods of -+# versioning with Net::SNMP. -+sub is_legacy_snmp_version { -+ my $version=Net::SNMP->VERSION; #using a variable for easier testing -+ if ($version=~/^\D*(\d)/ and $1 < 4){ -+ print "$1 wee"; -+ return 1; -+ }else{ -+ return 0; -+ } -+} -+ - ########## MAIN ####### - - check_options(); -@@ -365,7 +377,7 @@ sub check_options { - verb("Checking linux load"); - - # Get number of CPUs --my $resultat = (Net::SNMP->VERSION < 4) ? -+my $resultat = (is_legacy_snmp_version()) ? - $session->get_table($proc_id) - : $session->get_table(Baseoid => $proc_id); - -@@ -378,7 +390,7 @@ sub check_options { - my $ncpu = keys %$resultat; - - # Get load table --$resultat = (Net::SNMP->VERSION lt 4) ? -+$resultat = (is_legacy_snmp_version()) ? - $session->get_table($linload_table) - : $session->get_table(Baseoid => $linload_table); - -@@ -445,7 +457,7 @@ sub check_options { - - if ($o_check_type eq "cisco") { - my @oidlists = ($cisco_cpu_5m, $cisco_cpu_1m, $cisco_cpu_5s); --my $resultat = (Net::SNMP->VERSION lt 4) ? -+my $resultat = (is_legacy_snmp_version()) ? - $session->get_request(@oidlists) - : $session->get_request(-varbindlist => \@oidlists); - -@@ -499,7 +511,7 @@ sub check_options { - ############## Cisco N5K CPU Check ################### - if ($o_check_type eq "n5k") { - my @oidlists = ($n5k_cpu); --my $resultat = (Net::SNMP->VERSION lt 4) ? -+my $resultat = (is_legacy_snmp_version()) ? - $session->get_request(@oidlists) - : $session->get_request(-varbindlist => \@oidlists); - if (!defined($resultat)) { -@@ -542,7 +554,7 @@ sub check_options { - - if ($o_check_type eq "cata") { - my @oidlists = ($ciscocata_cpu_5m, $ciscocata_cpu_1m, $ciscocata_cpu_5s); --my $resultat = (Net::SNMP->VERSION lt 4) ? -+my $resultat = (is_legacy_snmp_version()) ? - $session->get_request(@oidlists) - : $session->get_request(-varbindlist => \@oidlists); - -@@ -597,7 +609,7 @@ sub check_options { - - if ($o_check_type eq "nsc") { - my @oidlists = ($nsc_cpu_5m, $nsc_cpu_1m, $nsc_cpu_5s); --my $resultat = (Net::SNMP->VERSION lt 4) ? -+my $resultat = (is_legacy_snmp_version()) ? - $session->get_request(@oidlists) - : $session->get_request(-varbindlist => \@oidlists); - -@@ -654,7 +666,7 @@ sub check_options { - # Get load table - my @oidlist = $cpu_oid{$o_check_type}; - verb("Checking OID : @oidlist"); --my $resultat = (Net::SNMP->VERSION lt 4) ? -+my $resultat = (is_legacy_snmp_version()) ? - $session->get_request(@oidlist) - : $session->get_request(-varbindlist => \@oidlist); - if (!defined($resultat)) { -@@ -702,7 +714,7 @@ sub check_options { - verb("Checking hpux load"); - - my @oidlists = ($hpux_load_1_min, $hpux_load_5_min, $hpux_load_15_min); --my $resultat = (Net::SNMP->VERSION lt 4) ? -+my $resultat = (is_legacy_snmp_version()) ? - $session->get_request(@oidlists) - : $session->get_request(-varbindlist => \@oidlists); - -@@ -755,7 +767,7 @@ sub check_options { - - ########## Standard cpu usage check ############ - # Get desctiption table --my $resultat = (Net::SNMP->VERSION lt 4) ? -+my $resultat = (is_legacy_snmp_version()) ? - $session->get_table($base_proc) - : $session->get_table(Baseoid => $base_proc); - diff --git a/debian/patches/22_remove_utils_pm b/debian/patches/22_remove_utils_pm deleted file mode 100644 index ce4617d..0000000 --- a/debian/patches/22_remove_utils_pm +++ /dev/null @@ -1,509 +0,0 @@ -From 83795bee374466b865a99af479d7cfa0e1ed1e08 Mon Sep 17 00:00:00 2001 -From: Michael Friedrich -Date: Mon, 25 May 2015 14:35:53 +0200 -Subject: [PATCH] Get rid of utils.pm entirely - -It's only used for $TIMEOUT and %ERRORS which have -been implemented partly inside the plugins already. - -This commit removes the file, the plugin dir lib -inclusion as well as the install.sh checks entirely. - -Documentation has been updated as well. - -fix #10 ---- - check_snmp_boostedge.pl | 8 ++- - check_snmp_cpfw.pl | 3 +- - check_snmp_css.pl | 9 ++-- - check_snmp_css_main.pl | 9 ++-- - check_snmp_env.pl | 9 ++-- - check_snmp_int.pl | 3 +- - check_snmp_linkproof_nhr.pl | 9 ++-- - check_snmp_load.pl | 3 +- - check_snmp_mem.pl | 3 +- - check_snmp_nsbox.pl | 9 ++-- - check_snmp_process.pl | 3 +- - check_snmp_storage.pl | 9 ++-- - check_snmp_vrrp.pl | 3 +- - check_snmp_win.pl | 5 +- - install.sh | 105 +++++++++++++++--------------------- - utils.pm | 67 ----------------------- - 17 files changed, 75 insertions(+), 192 deletions(-) - delete mode 100644 plugins/utils.pm - ---- a/check_snmp_boostedge.pl -+++ b/check_snmp_boostedge.pl -@@ -16,12 +16,10 @@ - use Net::SNMP; - use Getopt::Long; - --# Nagios specific -+# Icinga specific - --use lib "/usr/local/nagios/libexec"; --use utils qw(%ERRORS $TIMEOUT); --#my $TIMEOUT = 15; --#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); -+my $TIMEOUT = 15; -+my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - - # SNMP Datas - ---- a/check_snmp_cpfw.pl -+++ b/check_snmp_cpfw.pl -@@ -17,8 +17,7 @@ - use Net::SNMP; - use Getopt::Long; - --# Nagios specific -- -+# Icinga specific - my $TIMEOUT = 15; - my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - ---- a/check_snmp_css.pl -+++ b/check_snmp_css.pl -@@ -16,12 +16,9 @@ - use Net::SNMP; - use Getopt::Long; - --# Nagios specific -- --use lib "/usr/local/nagios/libexec"; --use utils qw(%ERRORS $TIMEOUT); --#my $TIMEOUT = 15; --#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); -+# Icinga specific -+my $TIMEOUT = 15; -+my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - - # SNMP Datas - ---- a/check_snmp_css_main.pl -+++ b/check_snmp_css_main.pl -@@ -16,12 +16,9 @@ - use Net::SNMP; - use Getopt::Long; - --# Nagios specific -- --use lib "/usr/local/nagios/libexec"; --use utils qw(%ERRORS $TIMEOUT); --#my $TIMEOUT = 15; --#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); -+# Icinga specific -+my $TIMEOUT = 15; -+my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - - # SNMP Datas - ---- a/check_snmp_env.pl -+++ b/check_snmp_env.pl -@@ -16,12 +16,9 @@ - use Net::SNMP; - use Getopt::Long; - --# Nagios specific -- --use lib "/usr/local/nagios/libexec"; --use utils qw(%ERRORS $TIMEOUT); --#my $TIMEOUT = 15; --#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); -+# Icinga specific -+my $TIMEOUT = 15; -+my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - - - my @Nagios_state = ("UNKNOWN","OK","WARNING","CRITICAL"); # Nagios states coding ---- a/check_snmp_int.pl -+++ b/check_snmp_int.pl -@@ -20,8 +20,7 @@ - my $o_base_dir="/tmp/tmp_Nagios_int."; - my $file_history=200; # number of data to keep in files. - --# Nagios specific -- -+# Icinga specific - my $TIMEOUT = 15; - my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - ---- a/check_snmp_linkproof_nhr.pl -+++ b/check_snmp_linkproof_nhr.pl -@@ -16,12 +16,9 @@ - use Net::SNMP; - use Getopt::Long; - --# Nagios specific -- --use lib "/usr/local/nagios/libexec"; --use utils qw(%ERRORS $TIMEOUT); --#my $TIMEOUT = 15; --#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); -+# Icinga specific -+my $TIMEOUT = 15; -+my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - - # SNMP Datas - ---- a/check_snmp_load.pl -+++ b/check_snmp_load.pl -@@ -15,8 +15,7 @@ - use Net::SNMP; - use Getopt::Long; - --# Nagios specific -- -+# Icinga specific - my $TIMEOUT = 15; - my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - ---- a/check_snmp_mem.pl -+++ b/check_snmp_mem.pl -@@ -16,8 +16,7 @@ - use Net::SNMP; - use Getopt::Long; - --# Nagios specific -- -+# Icinga specific - my $TIMEOUT = 15; - my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - ---- a/check_snmp_nsbox.pl -+++ b/check_snmp_nsbox.pl -@@ -16,12 +16,9 @@ - use Net::SNMP; - use Getopt::Long; - --# Nagios specific -- --use lib "/usr/local/nagios/libexec"; --use utils qw(%ERRORS $TIMEOUT); --#my $TIMEOUT = 15; --#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); -+# Icinga specific -+my $TIMEOUT = 15; -+my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - - # SNMP Datas - my $ns_service_status= "1.3.6.1.4.1.14020.2.2.1.3.0"; # service status 1= ok ?? ---- a/check_snmp_process.pl -+++ b/check_snmp_process.pl -@@ -21,8 +21,7 @@ - my $file_history=200; # number of data to keep in files. - my $delta_of_time_to_make_average=300; # 5minutes by default - --# Nagios specific -- -+# Icinga specific - my $TIMEOUT = 15; - my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - ---- a/check_snmp_storage.pl -+++ b/check_snmp_storage.pl -@@ -15,12 +15,9 @@ - use Net::SNMP; - use Getopt::Long; - --# Nagios specific -- --use lib "/usr/local/nagios/libexec"; --use utils qw(%ERRORS $TIMEOUT); --#my $TIMEOUT = 15; --#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); -+# Icinga specific -+my $TIMEOUT = 15; -+my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - - # SNMP Datas - my $storage_table= '1.3.6.1.2.1.25.2.3.1'; ---- a/check_snmp_vrrp.pl -+++ b/check_snmp_vrrp.pl -@@ -15,8 +15,7 @@ - use Net::SNMP; - use Getopt::Long; - --# Nagios specific -- -+# Icinga specific - my $TIMEOUT = 15; - my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - ---- a/check_snmp_win.pl -+++ b/check_snmp_win.pl -@@ -15,10 +15,7 @@ - use Net::SNMP; - use Getopt::Long; - --# Nagios specific -- --#use lib "/usr/local/nagios/libexec"; --#use utils qw(%ERRORS $TIMEOUT); -+# Icinga specific - my $TIMEOUT = 15; - my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - ---- a/install.sh -+++ b/install.sh -@@ -12,13 +12,13 @@ - # USAGE : ./install [ | AUTO [] ] - # USAGE : by default all scripts will be installed - # --# REQUIREMENTS : /bin/bash and sed -+# REQUIREMENTS : /bin/bash and sed - # --# This script will : -+# This script will: - # - Check perl binary (and asks for path) --# - Ask for nagios plugin path and checks for file "utils.pm" in it (default /usr/local/nagios/libexec) -+# - Ask for monitoring plugin path (default /usr/local/icinga/libexec) - # - Ask for temporary file location (default /tmp) --# - Check Net::SNMP version -+# - Check Net::SNMP version - # - Install plugins in the plugins directory and modify paths if necessary. - - ############################ script list -@@ -27,11 +27,11 @@ - - if [ $# -gt 0 ] ; then INSTSCRIPT=$1 ; else INSTSCRIPT="all" ; fi - --if [ $INSTSCRIPT != "AUTO" ] ; then -+if [ $INSTSCRIPT != "AUTO" ] ; then - ############################ Manual installation -- echo -- echo "###### Nagios snmp scripts installer ######" -- echo -+ echo -+ echo "###### Manubulon snmp scripts installer ######" -+ echo - echo "Will install $INSTSCRIPT script(s)" - echo - -@@ -41,7 +41,7 @@ - PERLHOME=`which perl 2>&1` - if [ $? -ne 0 ]; then PERLHOME="" ; fi - -- PLUGHOME=/usr/local/nagios/libexec -+ PLUGHOME=/usr/local/icinga/libexec - TMPDATA=/tmp - ############################ Checking Perl - -@@ -49,24 +49,24 @@ - read USERPERL - if [ "ZZ$USERPERL" != "ZZ" ]; then PERLHOME=$USERPERL ; fi - -- if [ "z$PERLHOME" == "z" ]; then -+ if [ "z$PERLHOME" == "z" ]; then - echo "Can't find perl binary... exiting" - echo "######### ERROR ########" - exit 1 - fi - - NETSNMP=`$PERLHOME -e 'if (eval "require Net::SNMP") { print "Yes" ;}'` -- if [ $? -ne 0 ] ; then -+ if [ $? -ne 0 ] ; then - echo "Error while checking Net::SNMP module" - echo "######### ERROR ########" -- exit 1; -+ exit 1; - fi - - if [ "zz$NETSNMP" != "zzYes" ]; then - echo "Module Net::SNMP not found!" - echo "Install it with CPAN or manually : http://www.manubulon.com/nagios/faq.html#FAQ2" - echo "######### ERROR ########" -- exit 1; -+ exit 1; - fi - - SNMPVER=`$PERLHOME -e 'require Net::SNMP;print Net::SNMP->VERSION'` -@@ -77,35 +77,28 @@ - echo "Module Getopt::Long not found!" - echo "Install it with CPAN or manually" - echo "######### ERROR ########" -- exit 1; -+ exit 1; - fi - echo "Module Getopt::Long found [OK]" - -- ############################ Check nagios plugin directory and utils.pm -+ ############################ Check monitoring plugin directory - - echo -- echo "What is your nagios plugin location ? " -- echo -n "Note : file utils.pm must be present in it [$PLUGHOME] " -+ echo "What is your monitoring plugin location ? " - read USERPLUG - - if [ "z$USERPLUG" != "z" ]; then PLUGHOME=$USERPLUG ; fi -- if [ ! -d $PLUGHOME ] ; then -+ if [ ! -d $PLUGHOME ] ; then - echo "Directory $PLUGHOME does not exist !" - echo "######### ERROR ########" - exit 1 - fi -- if [ ! -f $PLUGHOME/utils.pm ] ; then -- echo "File $PLUGHOME/utils.pm does not exist !" -- echo "Install it from nagios plugins" -- echo "######### ERROR ########" -- exit 1 -- fi - - ############################ Asking for temp directory - - echo - echo "Where do you want the plugins to put temporary data (only used by some plugins) ? " -- echo -n "Nagios user must be able to write files in it [$TMPDATA] " -+ echo -n "Icinga user must be able to write files in it [$TMPDATA] " - read USERTMP - - if [ "z$USERTMP" != "z" ]; then TMPDATA=$USERTMP ; fi -@@ -119,17 +112,11 @@ - ############################ Looks OK, copying with changes if necessary - - TRANS="" -- # Change '#!/usr/bin/perl -w' -+ # Change '#!/usr/bin/perl -w' - if [ $PERLHOME != "/usr/bin/perl" ] ; then - TRANS="-r -e s#/usr/bin/perl#$PERLHOME#" - fi - -- # Change 'use lib "/usr/local/nagios/libexec";' -- if [ $PLUGHOME != "/usr/local/nagios/libexec" ] ; then -- if [ "z$TRANS" == "z" ]; then TRANS="-r -e s#/usr/local/nagios/libexec#$PLUGHOME#" -- else TRANS="$TRANS -e s#/usr/local/nagios/libexec#$PLUGHOME#";fi -- fi -- - # Change 'my $o_base_dir="/tmp/tmp_Nagios_' - if [ $TMPDATA != "/tmp" ] ; then - if [ "z$TRANS" == "z" ]; then TRANS="-r -e s#/tmp/tmp_Nagios#$TMPDATA/tmp_Nagios#" -@@ -143,11 +130,11 @@ - echo "in directory : $PLUGHOME" - echo "perl : $PERLHOME" - echo "temp directory : $TMPDATA" -- echo -+ echo - echo -n "OK ? [Y/n]" - read INSTOK - -- if [ "$INSTOK" == "n" ]; then -+ if [ "$INSTOK" == "n" ]; then - echo "Aborting....." - echo "######### ERROR ########" - exit 1 -@@ -155,24 +142,24 @@ - - ERROR=0 - -- if [ $INSTSCRIPT == "all" ] ; then -+ if [ $INSTSCRIPT == "all" ] ; then - for i in $PLUGINS ; do -- echo -- if [ ! -f $i ] ; then -+ echo -+ if [ ! -f $i ] ; then - echo "Can't find source file $i : ##### ERROR #####" - else - echo -n "Installing $i : " -- if [ "z$TRANS" == "z" ] ; then -+ if [ "z$TRANS" == "z" ] ; then - cp $i $PLUGHOME/$i 2>&1 - else - sed $TRANS $i > $PLUGHOME/$i 2>&1 - fi -- if [ $? -ne 0 ] ; then -- echo "##### ERROR #####"; -- rm -f $PLUGHOME/$i -+ if [ $? -ne 0 ] ; then -+ echo "##### ERROR #####"; -+ rm -f $PLUGHOME/$i - ERROR=1 -- else -- echo "OK" -+ else -+ echo "OK" - chmod 755 $PLUGHOME/$i 2>&1 - fi - fi -@@ -183,7 +170,7 @@ - echo "Can't find source file $INSTSCRIPT : ##### ERROR #####" - else - echo -n "Installing $INSTSCRIPT : " -- if [ "z$TRANS" == "z" ] ; then -+ if [ "z$TRANS" == "z" ] ; then - cp $INSTSCRIPT > $PLUGHOME/$INSTSCRIPT - else - sed $TRANS $INSTSCRIPT > $PLUGHOME/$INSTSCRIPT 2>&1 -@@ -193,10 +180,10 @@ - rm -f $PLUGHOME/$INSTSCRIPT - ERROR=1 - exit 1; -- else -- echo "OK" -+ else -+ echo "OK" - chmod 755 $PLUGHOME/$INSTSCRIPT 2>&1 -- fi -+ fi - fi - fi - -@@ -208,9 +195,9 @@ - - echo "Installation completed OK" - echo "You can delete all the source files and directory" -- echo "Remember to look for informtation at http://www.manubulon.com/nagios/" -+ echo "Remember to look for informtation at http://www.manubulon.com/nagios/" - exit 0; -- -+ - else - ####################### Silent install with parameters ############ - # PARAM AUTO [] -@@ -221,19 +208,13 @@ - PLUGHOME=$2 - TMPDATA=$3 - INSTALLDIR=$5 -- -+ - TRANS="" -- # Change '#!/usr/bin/perl -w' -+ # Change '#!/usr/bin/perl -w' - if [ $PERLHOME != "/usr/bin/perl" ] ; then - TRANS="-r -e s#/usr/bin/perl#$PERLHOME#" - fi - -- # Change 'use lib "/usr/local/nagios/libexec";' -- if [ $PLUGHOME != "/usr/local/nagios/libexec" ] ; then -- if [ "z$TRANS" == "z" ]; then TRANS="-r -e s#/usr/local/nagios/libexec#$PLUGHOME#" -- else TRANS="$TRANS -e s#/usr/local/nagios/libexec#$PLUGHOME#";fi -- fi -- - # Change 'my $o_base_dir="/tmp/tmp_Nagios_' - if [ $TMPDATA != "/tmp" ] ; then - if [ "z$TRANS" == "z" ]; then TRANS="-r -e s#/tmp/tmp_Nagios#$TMPDATA/tmp_Nagios#" -@@ -246,18 +227,18 @@ - PLUGHOME=$INSTALLDIR - fi - for i in $PLUGINS ; do -- if [ ! -f $i ] ; then -+ if [ ! -f $i ] ; then - ERROR=1 - else -- if [ "z$TRANS" == "z" ] ; then -+ if [ "z$TRANS" == "z" ] ; then - cp $i $PLUGHOME/$i 2>&1 - else - sed $TRANS $i > $PLUGHOME/$i 2>&1 - fi -- if [ $? -ne 0 ] ; then -- rm -f $PLUGHOME/$i -+ if [ $? -ne 0 ] ; then -+ rm -f $PLUGHOME/$i - ERROR=1 -- else -+ else - chmod 755 $PLUGHOME/$i 2>&1 - fi - fi diff --git a/debian/patches/23_check_snmp_load_drop_debugging b/debian/patches/23_check_snmp_load_drop_debugging deleted file mode 100644 index 3f39c90..0000000 --- a/debian/patches/23_check_snmp_load_drop_debugging +++ /dev/null @@ -1,22 +0,0 @@ -From ee92d55bb36208a088a08864cc241e362134e711 Mon Sep 17 00:00:00 2001 -From: casvcasv -Date: Thu, 3 Sep 2015 11:39:44 -0400 -Subject: [PATCH] remove print "$1 wee" from check_snmp_load, apparently used - to test the SNMP version fix - ---- - check_snmp_load.pl | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/check_snmp_load.pl b/check_snmp_load.pl -index d2c49e3..a2a618c 100755 ---- a/check_snmp_load.pl -+++ b/check_snmp_load.pl -@@ -284,7 +284,6 @@ sub check_options { - sub is_legacy_snmp_version { - my $version=Net::SNMP->VERSION; #using a variable for easier testing - if ($version=~/^\D*(\d)/ and $1 < 4){ -- print "$1 wee"; - return 1; - }else{ - return 0; diff --git a/debian/patches/24_check_snmp_int_use_ifname b/debian/patches/24_check_snmp_int_use_ifname deleted file mode 100644 index 35a5393..0000000 --- a/debian/patches/24_check_snmp_int_use_ifname +++ /dev/null @@ -1,63 +0,0 @@ -From e684d56ab83e86d037403478c7245087e17f63b7 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?St=C3=A9phane=20Lapie?= -Date: Wed, 27 Jan 2016 21:47:01 +0900 -Subject: [PATCH] Add the -N/--use-ifname option to switch name lookup from - ifDescr to ifName - ---- - check_snmp_int.pl | 13 +++++++++++-- - 1 file changed, 11 insertions(+), 2 deletions(-) - -diff --git a/check_snmp_int.pl b/check_snmp_int.pl -index 4847fd2..a92d6d1 100755 ---- a/check_snmp_int.pl -+++ b/check_snmp_int.pl -@@ -29,6 +29,7 @@ - my $inter_table= '.1.3.6.1.2.1.2.2.1'; - my $index_table = '1.3.6.1.2.1.2.2.1.1'; - my $descr_table = '1.3.6.1.2.1.2.2.1.2'; -+my $name_table = '1.3.6.1.2.1.31.1.1.1.1'; - my $oper_table = '1.3.6.1.2.1.2.2.1.8.'; - my $admin_table = '1.3.6.1.2.1.2.2.1.7.'; - my $speed_table = '1.3.6.1.2.1.2.2.1.5.'; -@@ -79,6 +80,7 @@ - my $o_meg= undef; # output in MBytes or Mbits (-M) - my $o_gig= undef; # output in GBytes or Gbits (-G) - my $o_prct= undef; # output in % of max speed (-u) -+my $o_use_ifname= undef; # use IF-MIB::ifName instead of IF-MIB::ifDescr - - my $o_timeout= undef; # Timeout (Default 5) - # SNMP Message size parameter (Makina Corpus contrib) -@@ -188,6 +190,8 @@ sub help { - Test it before, because there are known bugs (ex : trailling /) - -r, --noregexp - Do not use regexp to match NAME in description OID -+-N, --use-ifname -+ Use IF-MIB::ifName as source for NIC name instead of IF-MIB::ifDescr - -i, --inverse - Make critical when up - -a, --admin -@@ -255,6 +259,7 @@ sub check_options { - 'H:s' => \$o_host, 'hostname:s' => \$o_host, - 'p:i' => \$o_port, 'port:i' => \$o_port, - 'n:s' => \$o_descr, 'name:s' => \$o_descr, -+ 'N' => \$o_use_ifname, 'use-ifname' => \$o_use_ifname, - 'C:s' => \$o_community, 'community:s' => \$o_community, - '2' => \$o_version2, 'v2c' => \$o_version2, - 'l:s' => \$o_login, 'login:s' => \$o_login, -@@ -444,9 +449,13 @@ sub check_options { - verb(" new max octets:: $oct_test"); - } - --# Get desctiption table -+# Get description table -+my $query_table = $descr_table; -+if (defined($o_use_ifname)) { -+ $query_table = $name_table; -+} - my $resultat = $session->get_table( -- Baseoid => $descr_table -+ Baseoid => $query_table - ); - - if (!defined($resultat)) { diff --git a/debian/patches/series b/debian/patches/series index 15a3e5f..d738d0c 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,14 +1,2 @@ -#01_update_pre_1.1.2 -#10_fix_net_snmp_version -#15_check_snmp_storage_64bit -#16_perfdata -#17_protocol_fam -#18_check_snmp_process_tmp_file -#19_check_snmp_load_n5k -#20_check_snmp_load_multiple_cpus -#21_check_snmp_load_abstract_snmp_version_check -#22_remove_utils_pm -#23_check_snmp_load_drop_debugging -#24_check_snmp_int_use_ifname 50_disable_epn 51_fix_privacy_doc From bcc13b46d0f79da630848b13fa0838ff529e2eea Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 23 Jan 2019 20:09:54 +0100 Subject: [PATCH 138/205] Adding d/p/10_check_snmp_storage_error_handling --- .../10_check_snmp_storage_error_handling | 42 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 43 insertions(+) create mode 100644 debian/patches/10_check_snmp_storage_error_handling diff --git a/debian/patches/10_check_snmp_storage_error_handling b/debian/patches/10_check_snmp_storage_error_handling new file mode 100644 index 0000000..86a0515 --- /dev/null +++ b/debian/patches/10_check_snmp_storage_error_handling @@ -0,0 +1,42 @@ +From e7472bfb2a39f3536350642b177e5f9e17c5c369 Mon Sep 17 00:00:00 2001 +From: Louis Sautier +Date: Mon, 29 Jan 2018 09:17:25 +0100 +Subject: [PATCH] check_snmp_storage: fix SNMP error handling, see #33 + +--- + plugins/check_snmp_storage.pl | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/plugins/check_snmp_storage.pl b/plugins/check_snmp_storage.pl +index 2325acc..3593f79 100755 +--- a/plugins/check_snmp_storage.pl ++++ b/plugins/check_snmp_storage.pl +@@ -598,6 +598,15 @@ sub check_options { + $result = $session->get_request(@oids); + } else { + $result = $session->get_request(Varbindlist => \@oids); ++} ++ ++if (!defined($result)) { ++ printf("ERROR getting OIDs: %s.\n", $session->error); ++ $session->close; ++ exit $ERRORS{"UNKNOWN"}; ++} ++ ++if (version->parse(Net::SNMP->VERSION) >= 4) { + foreach my $key (sort keys %$result) { + + # Fix for filesystems larger 2 TB. More than 2 TB will cause an error because +@@ -613,12 +622,6 @@ sub check_options { + } + } + +-if (!defined($result)) { +- printf("ERROR: Size table :%s.\n", $session->error); +- $session->close; +- exit $ERRORS{"UNKNOWN"}; +-} +- + $session->close; + + # Only a few ms left... diff --git a/debian/patches/series b/debian/patches/series index d738d0c..d2cca2f 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,2 +1,3 @@ +10_check_snmp_storage_error_handling 50_disable_epn 51_fix_privacy_doc From af07b7cbc4dab9cebe7869d7bff10bf1487bb618 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 23 Jan 2019 20:15:25 +0100 Subject: [PATCH 139/205] Adding d/p/11_check_snmp_int_agent_workaround --- .../11_check_snmp_int_agent_workaround | 83 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 84 insertions(+) create mode 100644 debian/patches/11_check_snmp_int_agent_workaround diff --git a/debian/patches/11_check_snmp_int_agent_workaround b/debian/patches/11_check_snmp_int_agent_workaround new file mode 100644 index 0000000..450eb41 --- /dev/null +++ b/debian/patches/11_check_snmp_int_agent_workaround @@ -0,0 +1,83 @@ +From ed1da1396f3ca3337a4ebe3f0cf610a30e6c5775 Mon Sep 17 00:00:00 2001 +From: Jochen Friedrich +Date: Wed, 14 Mar 2018 15:31:00 +0100 +Subject: [PATCH] Workaround for buggy SNMP agents not removing deleted + interfaces. + +If exact match is requested, only use the interface with the highest index. +Some buggy SNMP agents forget to delete interfaces which are gone (like ppp +or tunnel interfaces). +--- + plugins/check_snmp_int.pl | 57 ++++++++++++++++++++------------------- + 1 file changed, 30 insertions(+), 27 deletions(-) + +diff --git a/plugins/check_snmp_int.pl b/plugins/check_snmp_int.pl +index 9d4a2a5..e938131 100755 +--- a/plugins/check_snmp_int.pl ++++ b/plugins/check_snmp_int.pl +@@ -632,35 +632,38 @@ sub check_options { + + # get the index number of the interface + my @oid_list = split(/\./, $key); +- $tindex[$num_int] = pop(@oid_list); +- +- # get the full description +- $descr[$num_int] = $$resultat{$key}; +- +- # Get rid of special caracters (specially for Windows) +- $descr[$num_int] =~ s/[[:cntrl:]]//g; +- +- # put the admin or oper oid in an array +- $oids[$num_int] +- = defined($o_admin) +- ? $admin_table . $tindex[$num_int] +- : $oper_table . $tindex[$num_int]; +- +- # Put the performance oid +- if (defined($o_perf) || defined($o_checkperf)) { +- $oid_perf_inoct[$num_int] = $in_octet_table . $tindex[$num_int]; +- $oid_perf_outoct[$num_int] = $out_octet_table . $tindex[$num_int]; +- $oid_speed[$num_int] = $speed_table . $tindex[$num_int]; +- $oid_speed_high[$num_int] = $speed_table_64 . $tindex[$num_int]; +- if (defined($o_ext_checkperf) || defined($o_perfe)) { +- $oid_perf_indisc[$num_int] = $in_discard_table . $tindex[$num_int]; +- $oid_perf_outdisc[$num_int] = $out_discard_table . $tindex[$num_int]; +- $oid_perf_inerr[$num_int] = $in_error_table . $tindex[$num_int]; +- $oid_perf_outerr[$num_int] = $out_error_table . $tindex[$num_int]; ++ my $int_index = pop(@oid_list); ++ if (defined($o_noreg) && ($num_int > 0)) { ++ if ($tindex[$num_int-1] < $int_index) { ++ $num_int = 0; + } + } +- verb("Name : $descr[$num_int], Index : $tindex[$num_int]"); +- $num_int++; ++ if (!defined($o_noreg) || ($num_int == 0)) { ++ $tindex[$num_int] = $int_index; ++ # get the full description ++ $descr[$num_int]=$$resultat{$key}; ++ # Get rid of special caracters (specially for Windows) ++ $descr[$num_int] =~ s/[[:cntrl:]]//g; ++ # put the admin or oper oid in an array ++ $oids[$num_int]= defined ($o_admin) ? $admin_table . $tindex[$num_int] ++ : $oper_table . $tindex[$num_int]; ++ ++ # Put the performance oid ++ if (defined($o_perf) || defined($o_checkperf)) { ++ $oid_perf_inoct[$num_int]= $in_octet_table . $tindex[$num_int]; ++ $oid_perf_outoct[$num_int]= $out_octet_table . $tindex[$num_int]; ++ $oid_speed[$num_int]=$speed_table . $tindex[$num_int]; ++ $oid_speed_high[$num_int]=$speed_table_64 . $tindex[$num_int]; ++ if (defined($o_ext_checkperf) || defined($o_perfe)) { ++ $oid_perf_indisc[$num_int]= $in_discard_table . $tindex[$num_int]; ++ $oid_perf_outdisc[$num_int]= $out_discard_table . $tindex[$num_int]; ++ $oid_perf_inerr[$num_int]= $in_error_table . $tindex[$num_int]; ++ $oid_perf_outerr[$num_int]= $out_error_table . $tindex[$num_int]; ++ } ++ } ++ verb("Name : $descr[$num_int], Index : $tindex[$num_int]"); ++ $num_int++; ++ } + } + } + diff --git a/debian/patches/series b/debian/patches/series index d2cca2f..9a563e9 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,4 @@ 10_check_snmp_storage_error_handling +11_check_snmp_int_agent_workaround 50_disable_epn 51_fix_privacy_doc From 890a780886f7c4bc84d857477cf6cfc6a56a8816 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 23 Jan 2019 20:18:03 +0100 Subject: [PATCH 140/205] Adding d/p/12_check_snmp_mem_perf --- debian/patches/12_check_snmp_mem_perf | 85 +++++++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 86 insertions(+) create mode 100644 debian/patches/12_check_snmp_mem_perf diff --git a/debian/patches/12_check_snmp_mem_perf b/debian/patches/12_check_snmp_mem_perf new file mode 100644 index 0000000..3e5c7c8 --- /dev/null +++ b/debian/patches/12_check_snmp_mem_perf @@ -0,0 +1,85 @@ +From 8855b778e5a4aa53667baaad3863112fd93aee64 Mon Sep 17 00:00:00 2001 +From: jimbobmcgee +Date: Tue, 20 Mar 2018 23:22:09 +0000 +Subject: [PATCH] Better support for buffered/cached memory in Linux + +Exclude buffered memory from perfdata output, if `-b` option is specified +-------------------------------------------------------------------------- + +Status output show RAM usage as percentage, while perfdata output shows total literal ram usage. If `-N -m` options are given, cached memory is included in both the plugin status output and the perfdata. If `-N -b` options are given, buffered memory is *excluded* from the status output, but remains *included* in the perfdata. + +This patch alters the behaviour of the `-N -b` option combination so that, if supplied, buffered memory is also excluded from the perfdata. + + +Add separate perfdata counters for cached and buffered memory, if `-ff` options is specified +--------------------------------------------------------------------------------------------- + +Changed `Getopt` behaviour for `-f` so it can be specified more than once. If it is specified twice, perfdata is extended to include buffered and cached memory readings as separate perfdata values, e.g. `ram_used=12345 buffered=1234 cached=1234`. If using `-ff`, neither buffered nor cached memory are included in the perfdata value for RAM used. +--- + plugins/check_snmp_mem.pl | 24 +++++++++++++----------- + 1 file changed, 13 insertions(+), 11 deletions(-) + +diff --git a/plugins/check_snmp_mem.pl b/plugins/check_snmp_mem.pl +index 2ac7ec9..3f93a20 100755 +--- a/plugins/check_snmp_mem.pl ++++ b/plugins/check_snmp_mem.pl +@@ -95,7 +95,7 @@ + + sub print_usage { + print +-"Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] [-P ] -w -c [-I|-N|-E] [-f] [-m -b] [-t ] [-V]\n"; ++"Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] [-P ] -w -c [-I|-N|-E] [-f[f]] [-m -b] [-t ] [-V]\n"; + } + + sub isnnum { # Return true if arg is not a number +@@ -218,8 +218,8 @@ sub check_options { + 'memcache' => \$o_cache, + 'b' => \$o_buffer, + 'membuffer' => \$o_buffer, +- 'f' => \$o_perf, +- 'perfdata' => \$o_perf ++ 'f+' => \$o_perf, ++ 'perfdata+' => \$o_perf + ); + if (defined($o_help)) { help(); exit $ERRORS{"UNKNOWN"} } + if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"} } +@@ -578,9 +578,7 @@ sub check_options { + + $realused = ($$resultat{$nets_ram_total} - ($$resultat{$nets_ram_free} + $totalcachedbuffered)) + / $$resultat{$nets_ram_total}; +- + if ($$resultat{$nets_ram_total} == 0) { $realused = 0; } +- + $swapused + = ($$resultat{$nets_swap_total} == 0) + ? 0 +@@ -605,12 +603,11 @@ sub check_options { + } + $n_output .= " ; " . $n_status; + if (defined($o_perf)) { +- if (defined($o_cache)) { +- $n_output .= " | ram_used=" . ($$resultat{$nets_ram_total} - $$resultat{$nets_ram_free}) . ";"; +- } else { +- $n_output .= " | ram_used=" +- . ($$resultat{$nets_ram_total} - $$resultat{$nets_ram_free} - $$resultat{$nets_ram_cache}) . ";"; +- } ++ my $perf_ramused = ($$resultat{$nets_ram_total} - $$resultat{$nets_ram_free}); ++ $perf_ramused -= $$resultat{$nets_ram_cache} if $o_perf > 1 or !defined($o_cache); ++ $perf_ramused -= $$resultat{$nets_ram_buffer} if $o_perf > 1 or defined($o_buffer); ++ ++ $n_output .= " | ram_used=$perf_ramused;"; + $n_output .= ($o_warnR == 0) ? ";" : round($o_warnR * $$resultat{$nets_ram_total} / 100, 0) . ";"; + $n_output .= ($o_critR == 0) ? ";" : round($o_critR * $$resultat{$nets_ram_total} / 100, 0) . ";"; + $n_output .= "0;" . $$resultat{$nets_ram_total} . " "; +@@ -618,6 +615,11 @@ sub check_options { + $n_output .= ($o_warnS == 0) ? ";" : round($o_warnS * $$resultat{$nets_swap_total} / 100, 0) . ";"; + $n_output .= ($o_critS == 0) ? ";" : round($o_critS * $$resultat{$nets_swap_total} / 100, 0) . ";"; + $n_output .= "0;" . $$resultat{$nets_swap_total}; ++ ++ if ($o_perf > 1) { ++ $n_output .= " buffered=" . $$resultat{$nets_ram_buffer} . ';;;0;' . $$resultat{$nets_ram_total}; ++ $n_output .= " cached=" . $$resultat{$nets_ram_cache} . ';;;0;' . $$resultat{$nets_ram_total}; ++ } + } + $session->close; + print "$n_output \n"; diff --git a/debian/patches/series b/debian/patches/series index 9a563e9..59501c0 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,4 +1,5 @@ 10_check_snmp_storage_error_handling 11_check_snmp_int_agent_workaround +12_check_snmp_mem_perf 50_disable_epn 51_fix_privacy_doc From f45e77a9e18a189f01851f829a4738eb03278e0f Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 23 Jan 2019 20:20:51 +0100 Subject: [PATCH 141/205] Adding d/p/13_check_snmp_process_new_features --- .../13_check_snmp_process_new_features | 348 ++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 349 insertions(+) create mode 100644 debian/patches/13_check_snmp_process_new_features diff --git a/debian/patches/13_check_snmp_process_new_features b/debian/patches/13_check_snmp_process_new_features new file mode 100644 index 0000000..7210566 --- /dev/null +++ b/debian/patches/13_check_snmp_process_new_features @@ -0,0 +1,348 @@ +From 9ceabfc974d4d9bfd0731bbedfa12a035a662466 Mon Sep 17 00:00:00 2001 +From: jimbobmcgee +Date: Tue, 20 Mar 2018 23:28:12 +0000 +Subject: [PATCH] Minor feature updates to check_snmp_process.pl + +The following features are included: + 1. Added new `-T` option, to report/check against the total RAM of all matched processes, rather than the highest value + 2. Warn/Crit values are now optional for `-m` and `-u` options, allowing for capture of these in perfdata without requiring thresholds + 3. Perfdata is now always written if `-F` is supplied, even if there were no matched process (i.e. `num_process=0 memory_usage=0 cpu_usage=0`). +--- + plugins/check_snmp_process.pl | 201 +++++++++++++++++++++------------- + 1 file changed, 125 insertions(+), 76 deletions(-) + +diff --git a/plugins/check_snmp_process.pl b/plugins/check_snmp_process.pl +index 49a8cd7..2d2f72e 100755 +--- a/plugins/check_snmp_process.pl ++++ b/plugins/check_snmp_process.pl +@@ -44,9 +44,9 @@ + my $o_domain = 'udp/ipv4'; # Default to UDP over IPv4 + my $o_version2 = undef; #use snmp v2c + my $o_descr = undef; # description filter +-my $o_warn = 0; # warning limit ++my $o_warn = undef; # warning limit + my @o_warnL = undef; # warning limits (min,max) +-my $o_crit = 0; # critical limit ++my $o_crit = undef; # critical limit + my @o_critL = undef; # critical limits (min,max) + my $o_help = undef; # wan't some help ? + my $o_verb = undef; # verbose mode +@@ -74,17 +74,22 @@ + my $o_mem = undef; # checks memory (max) + my @o_memL = undef; # warn and crit level for mem + my $o_mem_avg = undef; # cheks memory average ++my $o_mem_sum = undef; # checks memory total + my $o_cpu = undef; # checks CPU usage + my @o_cpuL = undef; # warn and crit level for cpu +-my $o_delta = $delta_of_time_to_make_average; # delta time for CPU check ++my $o_delta = undef; # delta time for CPU check + + # functions + + sub p_version { print "check_snmp_process version : $VERSION\n"; } + + sub print_usage { +- print +-"Usage: $0 [-v] -H -C [-2] | (-l login -x passwd) [-p ] [-P ] -n [-w [,] -c [,max_proc] ] [-m, -a -u, -d ] [-t ] [-o ] [-f -A -F ] [-r] [-V] [-g]\n"; ++ print "Usage: $0 [-v] -H [-p ] [-P ] " ++ . "((-C [-2]) | (-l login -x passwd)) " ++ . "-n [-f] [-A] [-r] [-w [,] -c [,]] " ++ . "[-m [,] [-a|-T]] " ++ . "[-u [,] -d] " ++ . "[-t ] [-o ] [-F] [-V] [-g]\n"; + } + + sub isnotnum { # Return true if arg is not a number +@@ -186,7 +191,7 @@ sub help { + ex : "named.*-t /var/named/chroot" will only select named process with this parameter + -F, --perfout + Add performance output +- outputs : memory_usage, num_process, cpu_usage ++ outputs: num_processes, memory_usage (if -m), cpu_usage (if -u) + -w, --warn=MIN[,MAX] + Number of process that will cause a warning + -1 for no warning, MAX must be >0. Ex : -w-1,50 +@@ -197,15 +202,21 @@ sub help { + with the following options : -w m1,x1 -c m2,x2 + you must have : m2 <= m1 < x1 <= x2 + you can omit x1 or x2 or both +--m, --memory=WARN,CRIT ++-m, --memory[=WARN,CRIT] + checks memory usage (default max of all process) +- values are warning and critical values in Mb ++ WARN,CRIT values are warning and critical values in MB ++ if WARN,CRIT values are not given, just report + -a, --average + makes an average of memory used by process instead of max +--u, --cpu=WARN,CRIT ++ (implies -m, cannot be used with -T) ++-T, --total ++ checks the total memory used by processes instead of max ++ (implies -m, cannot be used with -a) ++-u, --cpu[=WARN,CRIT] + checks cpu usage of all process + values are warning and critical values in % of CPU usage + if more than one CPU, value can be > 100% : 100%=1 CPU ++ if WARN,CRIT values are not given, just report + -d, --delta=seconds + make an average of seconds for CPU (default 300=5min) + -g, --getall +@@ -272,6 +283,8 @@ sub check_options { + 'memory:s' => \$o_mem, + 'a' => \$o_mem_avg, + 'average' => \$o_mem_avg, ++ 'T' => \$o_mem_sum, ++ 'total' => \$o_mem_sum, + 'u:s' => \$o_cpu, + 'cpu' => \$o_cpu, + '2' => \$o_version2, +@@ -327,9 +340,11 @@ sub check_options { + + # Check compulsory attributes + if (!defined($o_descr) || !defined($o_host)) { print_usage(); exit $ERRORS{"UNKNOWN"} } +- @o_warnL = split(/,/, $o_warn); +- @o_critL = split(/,/, $o_crit); +- verb("$o_warn $o_crit $#o_warnL $#o_critL"); ++ ++ # Check warn/crit values ++ @o_warnL = split(/,/, ($o_warn // "0")); ++ @o_critL = split(/,/, ($o_crit // "0")); ++ verb("Warn: " . ($o_warn // "undef") . "; Crit: " . ($o_crit // "undef") . "; #Warn: " . $#o_warnL . "; #Crit: " . $#o_critL); + if (isnotnum($o_warnL[0]) || isnotnum($o_critL[0])) { + print "Numerical values for warning and critical\n"; + print_usage(); +@@ -348,7 +363,6 @@ sub check_options { + exit $ERRORS{"UNKNOWN"}; + } + +- # Check min_crit < min warn < max warn < crit warn + if ($o_warnL[0] < $o_critL[0]) { + print " warn minimum must be >= crit minimum\n"; + print_usage(); +@@ -371,7 +385,15 @@ sub check_options { + exit $ERRORS{"UNKNOWN"}; + } + #### Memory checks +- if (defined($o_mem)) { ++ if (defined($o_mem_sum) && defined($o_mem_avg)) { ++ print "cannot test memory average and memory total\n"; ++ print_usage(); ++ exit $ERRORS{"UNKNOWN"}; ++ } ++ if (defined($o_mem_sum) || defined($o_mem_avg)) { ++ $o_mem = $o_mem // ""; ++ } ++ if (defined($o_mem) && length($o_mem)) { + @o_memL = split(/,/, $o_mem); + if ($#o_memL != 1) { print "2 values (warning,critical) for memory\n"; print_usage(); exit $ERRORS{"UNKNOWN"} } + if (isnotnum($o_memL[0]) || isnotnum($o_memL[1])) { +@@ -386,7 +408,16 @@ sub check_options { + } + } + #### CPU checks +- if (defined($o_cpu)) { ++ if (defined($o_delta)) { ++ if (isnotnum($o_delta)) { ++ print "Numeric values for delta!\n"; ++ print_usage(); ++ exit $ERRORS{"UNKNOWN"}; ++ } ++ $o_cpu = $o_cpu // ""; ++ } ++ if (defined($o_cpu) && length($o_cpu)) { ++ $o_delta = $o_delta // $delta_of_time_to_make_average; + @o_cpuL = split(/,/, $o_cpu); + if ($#o_cpuL != 1) { print "2 values (warning,critical) for cpu\n"; print_usage(); exit $ERRORS{"UNKNOWN"} } + if (isnotnum($o_cpuL[0]) || isnotnum($o_cpuL[1])) { +@@ -619,24 +650,11 @@ sub check_options { + } + } + +-if ($num_int == 0) { +- print "No process ", (defined($o_noreg)) ? "named " : "matching ", $o_descr, " found : "; +- if ($o_critL[0] >= 0) { +- print "CRITICAL\n"; +- exit $ERRORS{"CRITICAL"}; +- } elsif ($o_warnL[0] >= 0) { +- print "WARNING\n"; +- exit $ERRORS{"WARNING"}; +- } +- print "YOU told me it was : OK\n"; +- exit $ERRORS{"OK"}; +-} +- + my $result = undef; + my $num_int_ok = 0; + + # Splitting snmp request because can't use get_bulk_request with v1 protocol +-if (!defined($o_get_all)) { ++if ($num_int != 0 && !defined($o_get_all)) { + if ($count_oid >= 50) { + my @toid = undef; + my $tmp_num = 0; +@@ -697,13 +715,21 @@ sub check_options { + my ($res_memory, $res_cpu) = (0, 0); + my $memory_print = ""; + my $cpu_print = ""; ++ + ###### Checks memory usage + + if (defined($o_mem)) { +- if (defined($o_mem_avg)) { +- for (my $i = 0; $i < $num_int; $i++) { $res_memory += $result_cons{ $proc_mem_table . "." . $tindex[$i] }; } +- $res_memory /= ($num_int_ok * 1024); +- verb("Memory average : $res_memory"); ++ if (defined($o_mem_avg) || defined($o_mem_sum)) { ++ verb("Check average: " . ($o_mem_avg // 0) . "; total: " . ($o_mem_sum // 0)); ++ for (my $i = 0; $i < $num_int; $i++) { ++ $res_memory += $result_cons{ $proc_mem_table . "." . $tindex[$i] }; ++ } ++ $res_memory /= 1024; # to Mbytes ++ verb("Memory total : $res_memory MB"); ++ if (defined($o_mem_avg)) { ++ $res_memory /= $num_int_ok; ++ verb("Memory average : $res_memory MB"); ++ } + } else { + for (my $i = 0; $i < $num_int; $i++) { + $res_memory +@@ -714,17 +740,22 @@ sub check_options { + $res_memory /= 1024; + verb("Memory max : $res_memory"); + } +- if ($res_memory > $o_memL[1]) { +- $final_status = 2; +- $memory_print = ", Mem : " . sprintf("%.1f", $res_memory) . "Mb > " . $o_memL[1] . " CRITICAL"; +- } elsif ($res_memory > $o_memL[0]) { +- $final_status = 1; +- $memory_print = ", Mem : " . sprintf("%.1f", $res_memory) . "Mb > " . $o_memL[0] . " WARNING"; +- } else { +- $memory_print = ", Mem : " . sprintf("%.1f", $res_memory) . "Mb OK"; +- } + if (defined($o_perf)) { +- $perf_output = "'memory_usage'=" . sprintf("%.1f", $res_memory) . "MB;" . $o_memL[0] . ";" . $o_memL[1]; ++ $perf_output = "'memory_usage'=" . sprintf("%.1f", $res_memory) . "MB"; ++ } ++ if (length($o_mem)) { ++ if ($res_memory > $o_memL[1]) { ++ $final_status = 2; ++ $memory_print = ", Mem : " . sprintf("%.1f", $res_memory) . "MB > " . $o_memL[1] . " CRITICAL"; ++ } elsif ($res_memory > $o_memL[0]) { ++ $final_status = 1; ++ $memory_print = ", Mem : " . sprintf("%.1f", $res_memory) . "MB > " . $o_memL[0] . " WARNING"; ++ } else { ++ $memory_print = ", Mem : " . sprintf("%.1f", $res_memory) . "MB OK"; ++ } ++ if (defined($o_perf)) { ++ $perf_output .= ";" . $o_memL[0] . ";" . $o_memL[1]; ++ } + } + } + +@@ -789,19 +820,24 @@ sub check_options { + if ($return != 0) { $cpu_print .= "! ERROR writing file $temp_file_name !"; $final_status = 3; } + ##### Check values (if something to check...) + if (defined($found_value)) { +- if ($found_value > $o_cpuL[1]) { +- $final_status = 2; +- $cpu_print .= ", Cpu : " . sprintf("%.0f", $found_value) . "% > " . $o_cpuL[1] . " CRITICAL"; +- } elsif ($found_value > $o_cpuL[0]) { +- $final_status = ($final_status == 2) ? 2 : 1; +- $cpu_print .= ", Cpu : " . sprintf("%.0f", $found_value) . "% > " . $o_cpuL[0] . " WARNING"; +- } else { +- $cpu_print .= ", Cpu : " . sprintf("%.0f", $found_value) . "% OK"; +- } + if (defined($o_perf)) { + if (!defined($perf_output)) { $perf_output = ""; } + else { $perf_output .= " "; } +- $perf_output .= "'cpu_usage'=" . sprintf("%.0f", $found_value) . "%;" . $o_cpuL[0] . ";" . $o_cpuL[1]; ++ $perf_output .= "'cpu_usage'=" . sprintf("%.0f", $found_value) . "%"; ++ } ++ if (length($o_cpu)) { ++ if ($found_value > $o_cpuL[1]) { ++ $final_status = 2; ++ $cpu_print .= ", CPU : " . sprintf("%.0f", $found_value) . "% > " . $o_cpuL[1] . " CRITICAL"; ++ } elsif ($found_value > $o_cpuL[0]) { ++ $final_status = ($final_status == 2) ? 2 : 1; ++ $cpu_print .= ", CPU : " . sprintf("%.0f", $found_value) . "% > " . $o_cpuL[0] . " WARNING"; ++ } else { ++ $cpu_print .= ", CPU : " . sprintf("%.0f", $found_value) . "% OK"; ++ } ++ if (defined($o_perf)) { ++ $perf_output .= ";" . $o_cpuL[0] . ";" . $o_cpuL[1]; ++ } + } + } else { + if ($final_status == 0) { $final_status = 3 } +@@ -809,35 +845,48 @@ sub check_options { + } + } + +-print $num_int_ok, " process ", (defined($o_noreg)) ? "named " : "matching ", $o_descr, " "; +- +-#### Check for min and max number of process +-if ($num_int_ok <= $o_critL[0]) { +- print "(<= ", $o_critL[0], " : CRITICAL)"; +- $final_status = 2; +-} elsif ($num_int_ok <= $o_warnL[0]) { +- print "(<= ", $o_warnL[0], " : WARNING)"; +- $final_status = ($final_status == 2) ? 2 : 1; +-} else { +- print "(> ", $o_warnL[0], ")"; ++if ($num_int == 0) { ++ print "No processes ", (defined($o_noreg) ? "named " : "matching "), $o_descr, " found : "; ++ if ($o_critL[0] >= 0) { ++ print "CRITICAL"; ++ $final_status = 2; ++ } elsif ($o_warnL[0] >= 0) { ++ print "WARNING"; ++ $final_status = ($final_status == 2) ? 2 : 1; ++ } + } +-if (defined($o_critL[1]) && ($num_int_ok > $o_critL[1])) { +- print " (> ", $o_critL[1], " : CRITICAL)"; +- $final_status = 2; +-} elsif (defined($o_warnL[1]) && ($num_int_ok > $o_warnL[1])) { +- print " (> ", $o_warnL[1], " : WARNING)"; +- $final_status = ($final_status == 2) ? 2 : 1; +-} elsif (defined($o_warnL[1])) { +- print " (<= ", $o_warnL[1], "):OK"; ++else { ++ print $num_int_ok, " process", ($num_int_ok == 1 ? " " : "es "), (defined($o_noreg) ? "named " : "matching "), $o_descr, " "; ++ ++ #### Check for min and max number of process ++ if ($num_int_ok <= $o_critL[0]) { ++ print "(<= ", $o_critL[0], " : CRITICAL)"; ++ $final_status = 2; ++ } elsif ($num_int_ok <= $o_warnL[0]) { ++ print "(<= ", $o_warnL[0], " : WARNING)"; ++ $final_status = ($final_status == 2) ? 2 : 1; ++ } else { ++ print "(> ", $o_warnL[0], ")"; ++ } ++ if (defined($o_critL[1]) && ($num_int_ok > $o_critL[1])) { ++ print " (> ", $o_critL[1], " : CRITICAL)"; ++ $final_status = 2; ++ } elsif (defined($o_warnL[1]) && ($num_int_ok > $o_warnL[1])) { ++ print " (> ", $o_warnL[1], " : WARNING)"; ++ $final_status = ($final_status == 2) ? 2 : 1; ++ } elsif (defined($o_warnL[1])) { ++ print " (<= ", $o_warnL[1], "):OK"; ++ } + } + + print $memory_print, $cpu_print; + + if (defined($o_perf)) { +- if (!defined($perf_output)) { $perf_output = ""; } +- else { $perf_output .= " "; } +- $perf_output .= "'num_process'=" . $num_int_ok . ";" . $o_warnL[0] . ";" . $o_critL[0]; +- print " | ", $perf_output; ++ print " | 'num_process'=" . $num_int_ok; ++ print ";" . $o_warnL[0] if defined($o_warn); ++ print ";" if defined($o_crit) && !defined($o_warn); ++ print ";" . $o_critL[0] if defined($o_crit); ++ print " " . $perf_output if length($perf_output // ""); + } + print "\n"; + diff --git a/debian/patches/series b/debian/patches/series index 59501c0..96038d7 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,5 +1,6 @@ 10_check_snmp_storage_error_handling 11_check_snmp_int_agent_workaround 12_check_snmp_mem_perf +13_check_snmp_process_new_features 50_disable_epn 51_fix_privacy_doc From cb17d7e4a2bfe025527ae48e00018c9492d7b6f2 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 23 Jan 2019 20:35:58 +0100 Subject: [PATCH 142/205] d/control: Updating Homepage-field to https://github.com/dnsmichi/manubulon-snmp --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 485ef3b..61b4656 100644 --- a/debian/control +++ b/debian/control @@ -4,7 +4,7 @@ Priority: optional Maintainer: Debian Nagios Maintainer Group Uploaders: Jan Wagner Build-Depends: debhelper (>= 5) -Homepage: http://www.manubulon.com/nagios/index_snmp.html +Homepage: https://github.com/dnsmichi/manubulon-snmp Vcs-Browser: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins Vcs-Git: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins.git Standards-Version: 4.3.0 From 85645deb8046bcb61577c570729870fc6cc6185f Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 23 Jan 2019 20:45:32 +0100 Subject: [PATCH 143/205] Prepare release --- debian/changelog | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 608731d..6cb61eb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,32 @@ -nagios-snmp-plugins (2.1.0-1~1.gbp0ced9d) UNRELEASED; urgency=medium +nagios-snmp-plugins (2.1.0-1) unstable; urgency=medium - * UNRELEASED + [ Jan Wagner ] * [75687e0] New upstream version 2.1.0 - * Bump Standards-Version to 4.3.0, no changes. + * [181c319] Refresh patches + * [568042e] d/rules: Adjust new documentation source path + * [ea34bcb] d/patches/51_fix_privacy_doc: Remove more potential privacy + breach + * [117e400] d/control: Bump Standards-Version to 4.1.1, no changes needed + * [f2e8ac9] d/docs: Fix location of the README + * [c0535e4] Adding .travis-ci.yml + * [019d443] d/control: Update VCS-headers - -- Jan Wagner Wed, 29 Nov 2017 16:30:09 +0100 + [ Bas Couwenberg ] + * [c07faf2] Bump Standards-Version to 4.1.5, no changes. + * [53cdb54] Bump Standards-Version to 4.2.0, no changes. + * [70b7138] Bump Standards-Version to 4.2.1, no changes. + * [3d095b1] Bump Standards-Version to 4.3.0, no changes. + + [ Jan Wagner ] + * [cb66729] Delete old unused patches + * [bcc13b4] Adding d/p/10_check_snmp_storage_error_handling + * [af07b7c] Adding d/p/11_check_snmp_int_agent_workaround + * [890a780] Adding d/p/12_check_snmp_mem_perf + * [f45e77a] Adding d/p/13_check_snmp_process_new_features + * [cb17d7e] d/control: Updating Homepage-field to + https://github.com/dnsmichi/manubulon-snmp + + -- Jan Wagner Wed, 23 Jan 2019 20:44:01 +0100 nagios-snmp-plugins (2.0.0-1) unstable; urgency=medium From 19b6944241949357a0ae983ad18cd94ae9ab089a Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 23 Jan 2019 22:35:02 +0100 Subject: [PATCH 144/205] New changelog entry --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 6cb61eb..8a27002 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +nagios-snmp-plugins (2.1.0-2) UNRELEASED; urgency=medium + + * + + -- Jan Wagner Wed, 23 Jan 2019 22:34:43 +0100 + nagios-snmp-plugins (2.1.0-1) unstable; urgency=medium [ Jan Wagner ] From 56eccb39233bae2bf37b9662475fb34aae063125 Mon Sep 17 00:00:00 2001 From: Debian Janitor Date: Mon, 4 May 2020 16:22:14 +0000 Subject: [PATCH 145/205] Trim trailing whitespace. Fixes: lintian: file-contains-trailing-whitespace See-also: https://lintian.debian.org/tags/file-contains-trailing-whitespace.html --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 8a27002..9176f0d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,6 @@ nagios-snmp-plugins (2.1.0-2) UNRELEASED; urgency=medium - * + * -- Jan Wagner Wed, 23 Jan 2019 22:34:43 +0100 From 23c46884d1d9e1b202824300a9b3f985425b2285 Mon Sep 17 00:00:00 2001 From: Debian Janitor Date: Mon, 4 May 2020 16:22:49 +0000 Subject: [PATCH 146/205] Use secure copyright file specification URI. Fixes: lintian: insecure-copyright-format-uri See-also: https://lintian.debian.org/tags/insecure-copyright-format-uri.html --- debian/changelog | 4 ++++ debian/copyright | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 9176f0d..ef4ed2d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,11 @@ nagios-snmp-plugins (2.1.0-2) UNRELEASED; urgency=medium + [ Jan Wagner ] * + [ Debian Janitor ] + * Use secure copyright file specification URI. + -- Jan Wagner Wed, 23 Jan 2019 22:34:43 +0100 nagios-snmp-plugins (2.1.0-1) unstable; urgency=medium diff --git a/debian/copyright b/debian/copyright index 0eb246b..4663e5d 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,4 +1,4 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Nagios SNMP Plugins Upstream-Contact: Patrick Proy (nagios at proy.org) Source: http://www.manubulon.com/nagios From f58977803d726867f7dbec08a92a503d5bc286d0 Mon Sep 17 00:00:00 2001 From: Debian Janitor Date: Mon, 4 May 2020 16:23:25 +0000 Subject: [PATCH 147/205] debian/copyright: use spaces rather than tabs to start continuation lines. Fixes: lintian: tab-in-license-text See-also: https://lintian.debian.org/tags/tab-in-license-text.html --- debian/changelog | 2 ++ debian/copyright | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/debian/changelog b/debian/changelog index ef4ed2d..755b7e9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,8 @@ nagios-snmp-plugins (2.1.0-2) UNRELEASED; urgency=medium [ Debian Janitor ] * Use secure copyright file specification URI. + * debian/copyright: use spaces rather than tabs to start continuation + lines. -- Jan Wagner Wed, 23 Jan 2019 22:34:43 +0100 diff --git a/debian/copyright b/debian/copyright index 4663e5d..6f45dc7 100644 --- a/debian/copyright +++ b/debian/copyright @@ -36,18 +36,18 @@ License: Expat SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. License: GPL-2 - 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. + 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. . - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. . - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA License: GPL-2+ This program is free software; you can redistribute it and/or modify From f84a199744aa357884d661c8f7740db0ec9e16a8 Mon Sep 17 00:00:00 2001 From: Debian Janitor Date: Mon, 4 May 2020 16:24:01 +0000 Subject: [PATCH 148/205] Bump debhelper from deprecated 5 to 12. Fixes: lintian: package-uses-deprecated-debhelper-compat-version See-also: https://lintian.debian.org/tags/package-uses-deprecated-debhelper-compat-version.html --- debian/changelog | 1 + debian/compat | 2 +- debian/control | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 755b7e9..113959a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,7 @@ nagios-snmp-plugins (2.1.0-2) UNRELEASED; urgency=medium * Use secure copyright file specification URI. * debian/copyright: use spaces rather than tabs to start continuation lines. + * Bump debhelper from deprecated 5 to 12. -- Jan Wagner Wed, 23 Jan 2019 22:34:43 +0100 diff --git a/debian/compat b/debian/compat index 7ed6ff8..48082f7 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -5 +12 diff --git a/debian/control b/debian/control index 61b4656..f36df34 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: net Priority: optional Maintainer: Debian Nagios Maintainer Group Uploaders: Jan Wagner -Build-Depends: debhelper (>= 5) +Build-Depends: debhelper (>= 12~) Homepage: https://github.com/dnsmichi/manubulon-snmp Vcs-Browser: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins Vcs-Git: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins.git From 6abd503b953926871696453141606ff076483368 Mon Sep 17 00:00:00 2001 From: Debian Janitor Date: Mon, 4 May 2020 16:24:37 +0000 Subject: [PATCH 149/205] Set debhelper-compat version in Build-Depends. Fixes: lintian: uses-debhelper-compat-file See-also: https://lintian.debian.org/tags/uses-debhelper-compat-file.html --- debian/changelog | 1 + debian/compat | 1 - debian/control | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 debian/compat diff --git a/debian/changelog b/debian/changelog index 113959a..f77df3a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,7 @@ nagios-snmp-plugins (2.1.0-2) UNRELEASED; urgency=medium * debian/copyright: use spaces rather than tabs to start continuation lines. * Bump debhelper from deprecated 5 to 12. + * Set debhelper-compat version in Build-Depends. -- Jan Wagner Wed, 23 Jan 2019 22:34:43 +0100 diff --git a/debian/compat b/debian/compat deleted file mode 100644 index 48082f7..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/debian/control b/debian/control index f36df34..bb40019 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: net Priority: optional Maintainer: Debian Nagios Maintainer Group Uploaders: Jan Wagner -Build-Depends: debhelper (>= 12~) +Build-Depends: debhelper-compat (= 12) Homepage: https://github.com/dnsmichi/manubulon-snmp Vcs-Browser: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins Vcs-Git: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins.git From 7e46f8e6b3510711e7a5bf248e4951ede8655e64 Mon Sep 17 00:00:00 2001 From: Debian Janitor Date: Mon, 4 May 2020 16:25:13 +0000 Subject: [PATCH 150/205] Update standards version to 4.5.0, no changes needed. Fixes: lintian: out-of-date-standards-version See-also: https://lintian.debian.org/tags/out-of-date-standards-version.html --- debian/changelog | 1 + debian/control | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index f77df3a..d4e2279 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,7 @@ nagios-snmp-plugins (2.1.0-2) UNRELEASED; urgency=medium lines. * Bump debhelper from deprecated 5 to 12. * Set debhelper-compat version in Build-Depends. + * Update standards version to 4.5.0, no changes needed. -- Jan Wagner Wed, 23 Jan 2019 22:34:43 +0100 diff --git a/debian/control b/debian/control index bb40019..c723beb 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Build-Depends: debhelper-compat (= 12) Homepage: https://github.com/dnsmichi/manubulon-snmp Vcs-Browser: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins Vcs-Git: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins.git -Standards-Version: 4.3.0 +Standards-Version: 4.5.0 Package: nagios-snmp-plugins Architecture: all From a75e780e44028a09bbf29855b7ee9be9374a33c3 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Thu, 28 May 2020 18:42:11 +0200 Subject: [PATCH 151/205] Removing .travis.yml and adding .gitlab-ci.yml --- .travis.yml | 20 -------------------- debian/.gitlab-ci.yml | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 20 deletions(-) delete mode 100644 .travis.yml create mode 100644 debian/.gitlab-ci.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7f8109c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,20 +0,0 @@ -sudo: required - -env: - - TRAVIS_DEBIAN_DISTRIBUTION=unstable - - TRAVIS_DEBIAN_DISTRIBUTION=testing - - TRAVIS_DEBIAN_DISTRIBUTION=stable - -services: - - docker - -script: - # build the debian package - - wget -O- http://travis.debian.net/script.sh | sh - - -#notifications: -# email: false - -branches: - except: - - /^debian\/\d/ diff --git a/debian/.gitlab-ci.yml b/debian/.gitlab-ci.yml new file mode 100644 index 0000000..62767c1 --- /dev/null +++ b/debian/.gitlab-ci.yml @@ -0,0 +1,14 @@ +include: + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml + +variables: + RELEASE: 'unstable' + SALSA_CI_DISABLE_APTLY: 0 + SALSA_CI_DISABLE_AUTOPKGTEST: 0 + SALSA_CI_DISABLE_BLHC: 0 + SALSA_CI_DISABLE_LINTIAN: 0 + SALSA_CI_DISABLE_PIUPARTS: 0 + SALSA_CI_DISABLE_REPROTEST: 0 + SALSA_CI_DISABLE_BUILD_PACKAGE_ALL: 0 + SALSA_CI_DISABLE_BUILD_PACKAGE_ANY: 0 From e989ff93650e8bba2a06fc9d8e3bc0f4f443efeb Mon Sep 17 00:00:00 2001 From: Bas Couwenberg Date: Fri, 6 Nov 2020 20:06:06 +0100 Subject: [PATCH 152/205] Bump watch file version to 4. --- debian/watch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/watch b/debian/watch index 6852cab..8856955 100644 --- a/debian/watch +++ b/debian/watch @@ -1,3 +1,3 @@ -version=3 +version=4 opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/nagios-snmp-plugins-$1\.tar\.gz/,uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha)\d*)$/$1-$2/ \ https://github.com/dnsmichi/manubulon-snmp/releases .*/v?(\d\S*)\.tar\.gz From b345ea5557877bfd40e74d0fd04824285a8dc6b0 Mon Sep 17 00:00:00 2001 From: Bas Couwenberg Date: Sat, 28 Nov 2020 14:36:02 +0100 Subject: [PATCH 153/205] Bump Standards-Version to 4.5.1, no changes. --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index c723beb..189d12a 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Build-Depends: debhelper-compat (= 12) Homepage: https://github.com/dnsmichi/manubulon-snmp Vcs-Browser: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins Vcs-Git: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins.git -Standards-Version: 4.5.0 +Standards-Version: 4.5.1 Package: nagios-snmp-plugins Architecture: all From a815051cc6cdf2359d092d5ab470a300bdb4c0cf Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 7 Dec 2020 15:28:22 +0100 Subject: [PATCH 154/205] check_snmp_int.pl: added ign-admindown, ign-emptyalias options. fixed unitialized variable warning by adding d/p/14_check_snmp_int_ign from upstream --- debian/patches/14_check_snmp_int_ign | 187 +++++++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 188 insertions(+) create mode 100644 debian/patches/14_check_snmp_int_ign diff --git a/debian/patches/14_check_snmp_int_ign b/debian/patches/14_check_snmp_int_ign new file mode 100644 index 0000000..2798118 --- /dev/null +++ b/debian/patches/14_check_snmp_int_ign @@ -0,0 +1,187 @@ +From 2d11bcf5c884793eb21a946fdd04cf87baf57ad3 Mon Sep 17 00:00:00 2001 +From: Stanislav Datskevych +Date: Wed, 9 Jan 2019 11:25:39 +0100 +Subject: [PATCH] added ign-admindown, ign-emptyalias options. fixed + unitialized variable warning + +--- + plugins/check_snmp_int.pl | 98 +++++++++++++++++++++++++++++++-------- + 1 file changed, 79 insertions(+), 19 deletions(-) + +diff --git a/plugins/check_snmp_int.pl b/plugins/check_snmp_int.pl +index e938131..721c3b2 100755 +--- a/plugins/check_snmp_int.pl ++++ b/plugins/check_snmp_int.pl +@@ -35,7 +35,7 @@ + my $name_table = '1.3.6.1.2.1.31.1.1.1.1'; + my $alias_table = '.1.3.6.1.2.1.31.1.1.1.18'; + my $oper_table = '1.3.6.1.2.1.2.2.1.8.'; +-my $admin_table = '1.3.6.1.2.1.2.2.1.7.'; ++my $admin_table = '1.3.6.1.2.1.2.2.1.7'; + my $speed_table = '1.3.6.1.2.1.2.2.1.5.'; + my $speed_table_64 = '1.3.6.1.2.1.31.1.1.1.15.'; + my $in_octet_table = '1.3.6.1.2.1.2.2.1.10.'; +@@ -60,20 +60,22 @@ + # Globals + + # Standard options +-my $o_host = undef; # hostname +-my $o_port = 161; # port +-my $o_descr = undef; # description filter +-my $o_help = undef; # wan't some help ? +-my $o_admin = undef; # admin status instead of oper +-my $o_inverse = undef; # Critical when up +-my $o_dormant = undef; # Dormant state is OK +-my $o_down = undef; # Down state is OK +-my $o_verb = undef; # verbose mode +-my $o_version = undef; # print version +-my $o_noreg = undef; # Do not use Regexp for name +-my $o_short = undef; # set maximum of n chars to be displayed +-my $o_label = undef; # add label before speed (in, out, etc...). +-my $o_weather = undef; # output "weathermap" data for NagVis ++my $o_host = undef; # hostname ++my $o_port = 161; # port ++my $o_descr = undef; # description filter ++my $o_help = undef; # wan't some help ? ++my $o_admin = undef; # admin status instead of oper ++my $o_inverse = undef; # Critical when up ++my $o_dormant = undef; # Dormant state is OK ++my $o_down = undef; # Down state is OK ++my $o_ignore_admindown = undef; # Ignore interfaces in admin down state ++my $o_ignore_emptyalias = undef; # ignore interfaces with empty alias (interface description string) ++my $o_verb = undef; # verbose mode ++my $o_version = undef; # print version ++my $o_noreg = undef; # Do not use Regexp for name ++my $o_short = undef; # set maximum of n chars to be displayed ++my $o_label = undef; # add label before speed (in, out, etc...). ++my $o_weather = undef; # output "weathermap" data for NagVis + + # Performance data options + my $o_perf = undef; # Output performance data +@@ -224,6 +226,10 @@ sub help { + Dormant state is an OK state + --down + Down state is an OK state ++--ign-admindown ++ Ignore interfaces in Admin down state ++--ign-emptyalias ++ Ignore interfaces having empty alias (port description) + -o, --octetlength=INTEGER + max-size of the SNMP message, usefull in case of Too Long responses. + Be carefull with network filters. Range 484 - 65535, default are +@@ -358,7 +364,9 @@ sub check_options { + 'dormant' => \$o_dormant, + 'down' => \$o_down, + 'W' => \$o_weather, +- 'weather' => \$o_weather ++ 'weather' => \$o_weather, ++ 'ign-admindown' => \$o_ignore_admindown, ++ 'ign-emptyalias' => \$o_ignore_emptyalias, + ); + if (defined($o_help)) { help(); exit $ERRORS{"UNKNOWN"} } + if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"} } +@@ -489,6 +497,14 @@ sub check_options { + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } ++ ++ #### check if --admin and --ign-admindown are put together. ++ #### --ign-admindown expects the open_state of the port to be used ++ if (defined($o_ignore_admindown) && defined($o_admin)) { ++ print "ERROR: --ign-admindown and -a are mutually exclusive. Please select only one.\n\n"; ++ print_usage(); ++ exit $ERRORS{"UNKNOWN"}; ++ } + } + + ########## MAIN ####### +@@ -616,6 +632,31 @@ sub check_options { + $in_octet_table = $in_octet_table_64; + } + ++# If --ign-admindown is set, we need to have admin status table ++my $admin_status_table; ++if (defined($o_ignore_admindown)) { ++ $admin_status_table = $session->get_table(Baseoid => $admin_table); ++ ++ if (!defined($admin_status_table)) { ++ printf("ERROR: Admin status table : %s.\n", $session->error); ++ $session->close; ++ exit $ERRORS{"UNKNOWN"}; ++ } ++} ++ ++# If --ign-emptyalias is set, we need to have aliases table ++my $interfaces_aliases; ++if (defined($o_ignore_emptyalias)) { ++ $interfaces_aliases = $session->get_table(Baseoid => $alias_table); ++ ++ if (!defined($interfaces_aliases)) { ++ printf("ERROR: Alias status table : %s.\n", $session->error); ++ $session->close; ++ exit $ERRORS{"UNKNOWN"}; ++ } ++} ++ ++ + # Select interface by regexp of exact match + # and put the oid to query in an array + +@@ -623,12 +664,30 @@ sub check_options { + foreach my $key (sort { $$resultat{$a} cmp $$resultat{$b} } keys %$resultat) { + verb("OID : $key, Desc : $$resultat{$key}"); + ++ my $ignore = 0; ++ my $prefix = $query_table . "."; ++ my ($ifindex) = $key =~ /$prefix(\d+)$/; ++ ++ # if ign-admindown is set, check the ifIndex against admin status ++ if (defined($o_ignore_admindown)) { ++ my $index = $admin_table . "." . $ifindex; ++ my $admstatus = $$admin_status_table{$index}; ++ $ignore = 1 if ($admstatus == 2); ++ } ++ ++ # if ign-emptyalias is set, check the ifIndex against alias string ++ if (defined($o_ignore_emptyalias)) { ++ my $index = $alias_table . "." . $ifindex; ++ my $alias = $$interfaces_aliases{$index}; ++ $ignore = 1 if ($alias eq ""); ++ } ++ + # test by regexp or exact match + my $test + = defined($o_noreg) + ? $$resultat{$key} eq $o_descr + : $$resultat{$key} =~ /$o_descr/; +- if ($test) { ++ if ($test && !$ignore) { + + # get the index number of the interface + my @oid_list = split(/\./, $key); +@@ -645,7 +704,7 @@ sub check_options { + # Get rid of special caracters (specially for Windows) + $descr[$num_int] =~ s/[[:cntrl:]]//g; + # put the admin or oper oid in an array +- $oids[$num_int]= defined ($o_admin) ? $admin_table . $tindex[$num_int] ++ $oids[$num_int]= defined ($o_admin) ? $admin_table . "." . $tindex[$num_int] + : $oper_table . $tindex[$num_int]; + + # Put the performance oid +@@ -724,7 +783,7 @@ sub check_options { + # Get the status of the current interface + my $int_status + = defined($o_admin) +- ? $$result{ $admin_table . $tindex[$i] } ++ ? $$result{ $admin_table . "." . $tindex[$i] } + : $$result{ $oper_table . $tindex[$i] }; + + # Make the bandwith & error checks if necessary +@@ -976,6 +1035,7 @@ sub check_options { + $perf_out .= "'" . $descr[$i] =~ s/\./_/r . "_out_discard'=" . $$result{ $oid_perf_outdisc[$i] } . "c "; + } + if (defined($o_perfs)) { ++ my $speed_real = "" unless (defined($speed_real)); + $perf_out .= "'" . $descr[$i] =~ s/\./_/r . "_speed_bps'=" . $speed_real . " "; + } + if (defined($o_weather) && $usable_data == 1) { diff --git a/debian/patches/series b/debian/patches/series index 96038d7..a7168c6 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -2,5 +2,6 @@ 11_check_snmp_int_agent_workaround 12_check_snmp_mem_perf 13_check_snmp_process_new_features +14_check_snmp_int_ign 50_disable_epn 51_fix_privacy_doc From c1ffe3e1b63f3eb5941ac398f262b64eabbfc09c Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 7 Dec 2020 15:31:48 +0100 Subject: [PATCH 155/205] check_snmp_int.pl: Add spaces only if necessary by adding d/p/15_check_snmp_int_spaces from upstream --- debian/patches/15_check_snmp_int_spaces | 34 +++++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 35 insertions(+) create mode 100644 debian/patches/15_check_snmp_int_spaces diff --git a/debian/patches/15_check_snmp_int_spaces b/debian/patches/15_check_snmp_int_spaces new file mode 100644 index 0000000..22fdac1 --- /dev/null +++ b/debian/patches/15_check_snmp_int_spaces @@ -0,0 +1,34 @@ +From 8f1c304b82c7bd9f5d1b23faa91ba86b0f99c4e2 Mon Sep 17 00:00:00 2001 +From: PGranado +Date: Fri, 22 Mar 2019 15:05:32 +0100 +Subject: [PATCH] Add spaces only if necessary, resolving bug #32 + +--- + plugins/check_snmp_int.pl | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/plugins/check_snmp_int.pl b/plugins/check_snmp_int.pl +index e938131..6e42163 100755 +--- a/plugins/check_snmp_int.pl ++++ b/plugins/check_snmp_int.pl +@@ -718,7 +718,7 @@ sub check_options { + # make all checks and output for all interfaces + for (my $i = 0; $i < $num_int; $i++) { + $print_out .= ", " if (defined($print_out)); +- $perf_out .= " " if (defined($perf_out)); ++ + my $usable_data = 1; + + # Get the status of the current interface +@@ -726,7 +726,10 @@ sub check_options { + = defined($o_admin) + ? $$result{ $admin_table . $tindex[$i] } + : $$result{ $oper_table . $tindex[$i] }; +- ++ ++ # Add spaces only if necessary ++ $perf_out .= " " if (defined ($perf_out) && $int_status==2 ) ; ++ + # Make the bandwith & error checks if necessary + if (defined($o_checkperf) && $int_status == 1) { + $temp_file_name = $descr[$i]; diff --git a/debian/patches/series b/debian/patches/series index a7168c6..0f83823 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -3,5 +3,6 @@ 12_check_snmp_mem_perf 13_check_snmp_process_new_features 14_check_snmp_int_ign +15_check_snmp_int_spaces 50_disable_epn 51_fix_privacy_doc From ef233ba6df87102ba3d7a1d156effcf32d0d5767 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 7 Dec 2020 15:34:21 +0100 Subject: [PATCH 156/205] check_snmp_win.pl: Add -o option (max message size) by adding d/p/16_check_snmp_win_max_message_size from upstream --- .../16_check_snmp_win_max_message_size | 178 ++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 179 insertions(+) create mode 100644 debian/patches/16_check_snmp_win_max_message_size diff --git a/debian/patches/16_check_snmp_win_max_message_size b/debian/patches/16_check_snmp_win_max_message_size new file mode 100644 index 0000000..a7f7f19 --- /dev/null +++ b/debian/patches/16_check_snmp_win_max_message_size @@ -0,0 +1,178 @@ +From dc67e601453a564db68d7921f16fb6ea875f68be Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Mathias=20V=C3=A9drines?= +Date: Fri, 21 Feb 2020 12:18:53 +0100 +Subject: [PATCH] Add -o option (max message size) in check_snmp_win + +--- + plugins/check_snmp_win.pl | 121 +++++++++++++++++++++++--------------- + 1 file changed, 72 insertions(+), 49 deletions(-) + +diff --git a/plugins/check_snmp_win.pl b/plugins/check_snmp_win.pl +index 148d6eb..c5cb573 100755 +--- a/plugins/check_snmp_win.pl ++++ b/plugins/check_snmp_win.pl +@@ -47,24 +47,25 @@ + + my $Name = 'check_snmp_win'; + +-my $o_host = undef; # hostname +-my $o_community = undef; # community +-my $o_port = 161; # port +-my $o_version2 = undef; #use snmp v2c +-my $o_descr = undef; # description filter +-my @o_descrL = undef; # Service descriprion list. +-my $o_showall = undef; # Show all services even if OK +-my $o_type = "service"; # Check type (service, ...) +-my $o_number = undef; # Number of service for warn and crit levels +-my $o_help = undef; # wan't some help ? +-my $o_verb = undef; # verbose mode +-my $o_version = undef; # print version +-my $o_noreg = undef; # Do not use Regexp for name +-my $o_timeout = 5; # Default 5s Timeout ++my $o_host = undef; # hostname ++my $o_community = undef; # community ++my $o_port = 161; # port ++my $o_version2 = undef; # use snmp v2c ++my $o_descr = undef; # description filter ++my @o_descrL = undef; # Service descriprion list. ++my $o_showall = undef; # Show all services even if OK ++my $o_type = "service"; # Check type (service, ...) ++my $o_number = undef; # Number of service for warn and crit levels ++my $o_help = undef; # wan't some help ? ++my $o_verb = undef; # verbose mode ++my $o_version = undef; # print version ++my $o_noreg = undef; # Do not use Regexp for name ++my $o_timeout = 5; # Default 5s Timeout ++my $o_octetlength = undef; # SNMP max message size + + # SNMP V3 specific +-my $o_login = undef; # snmp v3 login +-my $o_passwd = undef; # snmp v3 passwd ++my $o_login = undef; # snmp v3 login ++my $o_passwd = undef; # snmp v3 passwd + + # functions + +@@ -72,7 +73,7 @@ + + sub print_usage { + print +-"Usage: $Name [-v] -H -C [-2] | (-l login -x passwd) [-p ] -n [,] [-t ] [-V]\n"; ++"Usage: $Name [-v] -H -C [-2] | (-l login -x passwd) [-p ] -n [,] [-t ] [-o ] [-V]\n"; + } + + sub isnotnum { # Return true if arg is not a number +@@ -128,6 +129,8 @@ sub help { + Do not use regexp to match NAME in service description. + -t, --timeout=INTEGER + timeout for SNMP in seconds (Default: 5) ++-o, --octetlength=INTEGER ++ SNMP max message size (484-65535) + -V, --version + prints version number + Note : +@@ -162,36 +165,38 @@ sub decode_utf8 { # just replaces UFT8 caracters by "." + sub check_options { + Getopt::Long::Configure("bundling"); + GetOptions( +- 'v' => \$o_verb, +- 'verbose' => \$o_verb, +- 'h' => \$o_help, +- 'help' => \$o_help, +- 'H:s' => \$o_host, +- 'hostname:s' => \$o_host, +- 'p:i' => \$o_port, +- 'port:i' => \$o_port, +- 'C:s' => \$o_community, +- 'community:s' => \$o_community, +- 'l:s' => \$o_login, +- 'login:s' => \$o_login, +- 'x:s' => \$o_passwd, +- 'passwd:s' => \$o_passwd, +- 't:i' => \$o_timeout, +- 'timeout:i' => \$o_timeout, +- 'n:s' => \$o_descr, +- 'name:s' => \$o_descr, +- 'r' => \$o_noreg, +- 'noregexp' => \$o_noreg, +- 'T:s' => \$o_type, +- 'type:s' => \$o_type, +- 'N:i' => \$o_number, +- 'number:i' => \$o_number, +- '2' => \$o_version2, +- 'v2c' => \$o_version2, +- 's' => \$o_showall, +- 'showall' => \$o_showall, +- 'V' => \$o_version, +- 'version' => \$o_version ++ 'v' => \$o_verb, ++ 'verbose' => \$o_verb, ++ 'h' => \$o_help, ++ 'help' => \$o_help, ++ 'H:s' => \$o_host, ++ 'hostname:s' => \$o_host, ++ 'p:i' => \$o_port, ++ 'port:i' => \$o_port, ++ 'C:s' => \$o_community, ++ 'community:s' => \$o_community, ++ 'l:s' => \$o_login, ++ 'login:s' => \$o_login, ++ 'x:s' => \$o_passwd, ++ 'passwd:s' => \$o_passwd, ++ 't:i' => \$o_timeout, ++ 'timeout:i' => \$o_timeout, ++ 'n:s' => \$o_descr, ++ 'name:s' => \$o_descr, ++ 'r' => \$o_noreg, ++ 'noregexp' => \$o_noreg, ++ 'T:s' => \$o_type, ++ 'type:s' => \$o_type, ++ 'N:i' => \$o_number, ++ 'number:i' => \$o_number, ++ '2' => \$o_version2, ++ 'v2c' => \$o_version2, ++ 'o:i' => \$o_octetlength, ++ 'octetlength:i' => \$o_octetlength, ++ 's' => \$o_showall, ++ 'showall' => \$o_showall, ++ 'V' => \$o_version, ++ 'version' => \$o_version + ); + if (defined($o_help)) { help(); exit $ERRORS{"UNKNOWN"} } + if (defined($o_version)) { p_version(); exit $ERRORS{"UNKNOWN"} } +@@ -222,6 +227,13 @@ sub check_options { + } + } + ++ # Octet length check ++ if (defined($o_octetlength) && (isnotnum($o_octetlength) || $o_octetlength > 65535 || $o_octetlength < 484)) { ++ print "octet length must be in range 484 .. 65535\n"; ++ print_usage(); ++ exit $ERRORS{'UNKNOWN'}; ++ } ++ + } + + ########## MAIN ####### +@@ -283,8 +295,19 @@ sub check_options { + exit $ERRORS{"UNKNOWN"}; + } + +-$session->max_msg_size(5000); +-verb($session->max_msg_size); ++if (defined($o_octetlength)) { ++ my $oct_resultat = undef; ++ my $oct_test = $session->max_msg_size(); ++ verb(" actual max octets:: $oct_test"); ++ $oct_resultat = $session->max_msg_size($o_octetlength); ++ if (!defined($oct_resultat)) { ++ printf("ERROR: Session settings : %s.\n", $session->error); ++ $session->close; ++ exit $ERRORS{"UNKNOWN"}; ++ } ++ $oct_test = $session->max_msg_size(); ++ verb(" new max octets:: $oct_test"); ++} + + # Look for process in name or path name table + my $resultat = undef; diff --git a/debian/patches/series b/debian/patches/series index 0f83823..ad269ae 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -4,5 +4,6 @@ 13_check_snmp_process_new_features 14_check_snmp_int_ign 15_check_snmp_int_spaces +16_check_snmp_win_max_message_size 50_disable_epn 51_fix_privacy_doc From 085ba7e17cda7a24dc081b86c7b5cc5c1b6764c6 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 7 Dec 2020 15:36:51 +0100 Subject: [PATCH 157/205] check_snmp_storage.pl: add support for allowing considering OK if no storage found matching given criteria by adding d/p/17_check_snmp_storage_okifempty from upstream --- .../patches/17_check_snmp_storage_okifempty | 61 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 62 insertions(+) create mode 100644 debian/patches/17_check_snmp_storage_okifempty diff --git a/debian/patches/17_check_snmp_storage_okifempty b/debian/patches/17_check_snmp_storage_okifempty new file mode 100644 index 0000000..8dffde8 --- /dev/null +++ b/debian/patches/17_check_snmp_storage_okifempty @@ -0,0 +1,61 @@ +From fd5ae19315a26530159f8ab221a190ac52de3195 Mon Sep 17 00:00:00 2001 +From: roa +Date: Mon, 9 Mar 2020 11:56:04 +0000 +Subject: [PATCH] check_snmp_storage.pl: add support for allowing considering + OK if no storage found matching given criteria + +--- + plugins/check_snmp_storage.pl | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/plugins/check_snmp_storage.pl b/plugins/check_snmp_storage.pl +index 3593f79..887800a 100755 +--- a/plugins/check_snmp_storage.pl ++++ b/plugins/check_snmp_storage.pl +@@ -73,6 +73,7 @@ + my $o_sum = undef; # add all storage before testing + my $o_index = undef; # Parse index instead of description + my $o_negate = undef; # Negate the regexp if set ++my $o_okifempty = undef; # Consider OK if no disks found + my $o_timeout = 5; # Default 5s Timeout + my $o_perf = undef; # Output performance data + my $o_short = undef; # Short output parameters +@@ -98,7 +99,7 @@ + + sub print_usage { + print +-"Usage: $Name [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] [-P ] -m [-q storagetype] -w -c [-t ] [-T pl|pu|bl|bu ] [-r -s -i -G] [-e] [-S 0|1[,1,]] [-o ] [-R <% reserved>]\n"; ++"Usage: $Name [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] [-P ] -m [-q storagetype] -w -c [-t ] [-T pl|pu|bl|bu ] [-r -s -i -G] [-e] [-O] [-S 0|1[,1,]] [-o ] [-R <% reserved>]\n"; + } + + sub round ($$) { +@@ -180,6 +181,8 @@ sub help { + -e, --exclude + Select all storages except the one(s) selected by -m + No action on storage type selection ++-O, --okifempty ++ Consider OK instead of UNKNOWN if no storage found with given criteria + -T, --type=TYPE + pl : calculate percent left + pu : calculate percent used (Default) +@@ -279,6 +282,8 @@ sub check_options { + 'index' => \$o_index, + 'e' => \$o_negate, + 'exclude' => \$o_negate, ++ 'O' => \$o_okifempty, ++ 'okifempty' => \$o_okifempty, + 'V' => \$o_version, + 'version' => \$o_version, + 'q:s' => \$o_storagetype, +@@ -590,7 +595,10 @@ sub check_options { + } + } + verb("storages selected : $num_int"); +-if ($num_int == 0) { print "Unknown storage : $o_descr : ERROR\n"; exit $ERRORS{"UNKNOWN"}; } ++if ($num_int == 0) { ++ if ($o_okifempty) { print "No storage found matching given criteria, but future new disks will be monitored\n"; exit $ERRORS{"OK"}; } ++ else { print "Unknown storage : $o_descr : ERROR\n"; exit $ERRORS{"UNKNOWN"}; } ++} + + my $result = undef; + diff --git a/debian/patches/series b/debian/patches/series index ad269ae..421df72 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -5,5 +5,6 @@ 14_check_snmp_int_ign 15_check_snmp_int_spaces 16_check_snmp_win_max_message_size +17_check_snmp_storage_okifempty 50_disable_epn 51_fix_privacy_doc From 84561d3e52de2f41714e56fe0abe687cf6e62423 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 7 Dec 2020 15:38:56 +0100 Subject: [PATCH 158/205] check_snmp_int.pl: fix perf_out not defined error by adding d/p/18_check_snmp_int_fix_perf_out --- debian/patches/18_check_snmp_int_fix_perf_out | 43 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 44 insertions(+) create mode 100644 debian/patches/18_check_snmp_int_fix_perf_out diff --git a/debian/patches/18_check_snmp_int_fix_perf_out b/debian/patches/18_check_snmp_int_fix_perf_out new file mode 100644 index 0000000..59bc9c7 --- /dev/null +++ b/debian/patches/18_check_snmp_int_fix_perf_out @@ -0,0 +1,43 @@ +From effd196f76c4f4e9505b0955b020f8f65f1700a2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pawe=C5=82=20Szafer?= +Date: Mon, 16 Mar 2020 18:41:49 +0100 +Subject: [PATCH] fix perf_out not defined error + +--- + plugins/check_snmp_int.pl | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/plugins/check_snmp_int.pl b/plugins/check_snmp_int.pl +index 6e42163..1f0cdc2 100755 +--- a/plugins/check_snmp_int.pl ++++ b/plugins/check_snmp_int.pl +@@ -993,24 +993,25 @@ sub check_options { + + # Check if all interface are OK + if ($num_ok == $num_int) { ++ my $is_perf_defined = defined($perf_out) && defined($o_perf); + if ($final_status == 0) { + print $print_out, ":", $num_ok, " UP: OK"; +- if (defined($o_perf)) { print " | ", $perf_out; } ++ if ($is_perf_defined) { print " | ", $perf_out; } + print "\n"; + exit $ERRORS{"OK"}; + } elsif ($final_status == 1) { + print $print_out, ":(", $num_ok, " UP): WARNING"; +- if (defined($o_perf)) { print " | ", $perf_out; } ++ if ($is_perf_defined) { print " | ", $perf_out; } + print "\n"; + exit $ERRORS{"WARNING"}; + } elsif ($final_status == 2) { + print $print_out, ":(", $num_ok, " UP): CRITICAL"; +- if (defined($o_perf)) { print " | ", $perf_out; } ++ if ($is_perf_defined) { print " | ", $perf_out; } + print "\n"; + exit $ERRORS{"CRITICAL"}; + } else { + print $print_out, ":(", $num_ok, " UP): UNKNOWN"; +- if (defined($perf_out)) { print " | ", $perf_out; } ++ if ($is_perf_defined) { print " | ", $perf_out; } + print "\n"; + exit $ERRORS{"UNKNOWN"}; + } diff --git a/debian/patches/series b/debian/patches/series index 421df72..82505fe 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -6,5 +6,6 @@ 15_check_snmp_int_spaces 16_check_snmp_win_max_message_size 17_check_snmp_storage_okifempty +18_check_snmp_int_fix_perf_out 50_disable_epn 51_fix_privacy_doc From 45b2b11b48c328a494d18d2709e8b1a0e650777e Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 7 Dec 2020 15:41:28 +0100 Subject: [PATCH 159/205] d/control: Updating upstream to https://github.com/SteScho/manubulon-snmp --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 189d12a..43eb57a 100644 --- a/debian/control +++ b/debian/control @@ -4,7 +4,7 @@ Priority: optional Maintainer: Debian Nagios Maintainer Group Uploaders: Jan Wagner Build-Depends: debhelper-compat (= 12) -Homepage: https://github.com/dnsmichi/manubulon-snmp +Homepage: https://github.com/SteScho/manubulon-snmp Vcs-Browser: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins Vcs-Git: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins.git Standards-Version: 4.5.1 From f9bf22008d2c3113e6d90aa0da6daead279754e7 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 7 Dec 2020 15:41:43 +0100 Subject: [PATCH 160/205] d/watch: Updating upstream to https://github.com/SteScho/manubulon-snmp --- debian/watch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/watch b/debian/watch index 8856955..240eddb 100644 --- a/debian/watch +++ b/debian/watch @@ -1,3 +1,3 @@ version=4 opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/nagios-snmp-plugins-$1\.tar\.gz/,uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha)\d*)$/$1-$2/ \ - https://github.com/dnsmichi/manubulon-snmp/releases .*/v?(\d\S*)\.tar\.gz + https://github.com/SteScho/manubulon-snmp/releases .*/v?(\d\S*)\.tar\.gz From 8f6cd11fd1e6126cd621cfee1b830e4258d2efbb Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 7 Dec 2020 15:46:28 +0100 Subject: [PATCH 161/205] Refreshing patches --- debian/patches/15_check_snmp_int_spaces | 8 +++----- debian/patches/18_check_snmp_int_fix_perf_out | 4 +--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/debian/patches/15_check_snmp_int_spaces b/debian/patches/15_check_snmp_int_spaces index 22fdac1..bc0cc7a 100644 --- a/debian/patches/15_check_snmp_int_spaces +++ b/debian/patches/15_check_snmp_int_spaces @@ -7,11 +7,9 @@ Subject: [PATCH] Add spaces only if necessary, resolving bug #32 plugins/check_snmp_int.pl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) -diff --git a/plugins/check_snmp_int.pl b/plugins/check_snmp_int.pl -index e938131..6e42163 100755 --- a/plugins/check_snmp_int.pl +++ b/plugins/check_snmp_int.pl -@@ -718,7 +718,7 @@ sub check_options { +@@ -777,7 +777,7 @@ # make all checks and output for all interfaces for (my $i = 0; $i < $num_int; $i++) { $print_out .= ", " if (defined($print_out)); @@ -20,9 +18,9 @@ index e938131..6e42163 100755 my $usable_data = 1; # Get the status of the current interface -@@ -726,7 +726,10 @@ sub check_options { +@@ -785,7 +785,10 @@ = defined($o_admin) - ? $$result{ $admin_table . $tindex[$i] } + ? $$result{ $admin_table . "." . $tindex[$i] } : $$result{ $oper_table . $tindex[$i] }; - + diff --git a/debian/patches/18_check_snmp_int_fix_perf_out b/debian/patches/18_check_snmp_int_fix_perf_out index 59bc9c7..08bc256 100644 --- a/debian/patches/18_check_snmp_int_fix_perf_out +++ b/debian/patches/18_check_snmp_int_fix_perf_out @@ -7,11 +7,9 @@ Subject: [PATCH] fix perf_out not defined error plugins/check_snmp_int.pl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) -diff --git a/plugins/check_snmp_int.pl b/plugins/check_snmp_int.pl -index 6e42163..1f0cdc2 100755 --- a/plugins/check_snmp_int.pl +++ b/plugins/check_snmp_int.pl -@@ -993,24 +993,25 @@ sub check_options { +@@ -1053,24 +1053,25 @@ # Check if all interface are OK if ($num_ok == $num_int) { From c1f1d2574f69ad550480c7d1fc6f10adcfaed47b Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 7 Dec 2020 15:48:36 +0100 Subject: [PATCH 162/205] d/copyright: Removing tabs --- debian/copyright | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/debian/copyright b/debian/copyright index 6f45dc7..d90354a 100644 --- a/debian/copyright +++ b/debian/copyright @@ -36,9 +36,9 @@ License: Expat SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. License: GPL-2 - 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. + 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. . This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of From fce5c7b8486f65de76b015cfecaaab74fecaef17 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 7 Dec 2020 15:54:42 +0100 Subject: [PATCH 163/205] Prepare release --- debian/changelog | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/debian/changelog b/debian/changelog index d4e2279..adf147f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,17 +1,41 @@ -nagios-snmp-plugins (2.1.0-2) UNRELEASED; urgency=medium - - [ Jan Wagner ] - * +nagios-snmp-plugins (2.1.0-2) unstable; urgency=medium [ Debian Janitor ] * Use secure copyright file specification URI. * debian/copyright: use spaces rather than tabs to start continuation lines. - * Bump debhelper from deprecated 5 to 12. + * Bump debhelper from deprecated 5 to 12. (Closes: #965745) * Set debhelper-compat version in Build-Depends. * Update standards version to 4.5.0, no changes needed. - -- Jan Wagner Wed, 23 Jan 2019 22:34:43 +0100 + [ Jan Wagner ] + * [a75e780] Removing .travis.yml and adding .gitlab-ci.yml + + [ Bas Couwenberg ] + * [e989ff9] Bump watch file version to 4. + * [b345ea5] Bump Standards-Version to 4.5.1, no changes. + + [ Jan Wagner ] + * [a815051] check_snmp_int.pl: added ign-admindown, ign-emptyalias options. + fixed unitialized variable warning by adding d/p/14_check_snmp_int_ign + from upstream + * [c1ffe3e] check_snmp_int.pl: Add spaces only if necessary by adding + d/p/15_check_snmp_int_spaces from upstream + * [ef233ba] check_snmp_win.pl: Add -o option (max message size) by adding + d/p/16_check_snmp_win_max_message_size from upstream + * [085ba7e] check_snmp_storage.pl: add support for allowing considering OK if + no storage found matching given criteria by adding + d/p/17_check_snmp_storage_okifempty from upstream + * [84561d3] check_snmp_int.pl: fix perf_out not defined error by adding + d/p/18_check_snmp_int_fix_perf_out + * [45b2b11] d/control: Updating upstream to + https://github.com/SteScho/manubulon-snmp + * [f9bf220] d/watch: Updating upstream to + https://github.com/SteScho/manubulon-snmp + * [8f6cd11] Refreshing patches + * [c1f1d25] d/copyright: Removing tabs + + -- Jan Wagner Mon, 07 Dec 2020 15:50:39 +0100 nagios-snmp-plugins (2.1.0-1) unstable; urgency=medium From 5579d164c7cc51c5b00db307b78086973eefd2fc Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 7 Dec 2020 17:03:28 +0100 Subject: [PATCH 164/205] New changelog --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index adf147f..59c78ab 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +nagios-snmp-plugins (2.1.0-3) UNRELEASED; urgency=medium + + * NOT RELEASED YET + + -- Jan Wagner Mon, 07 Dec 2020 17:03:12 +0100 + nagios-snmp-plugins (2.1.0-2) unstable; urgency=medium [ Debian Janitor ] From 4ffef4124ab82b0c9844e684470168a27453fd99 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 27 Dec 2020 23:42:17 +0100 Subject: [PATCH 165/205] Adding Github CI --- .github/workflows/packaging_test.yml | 35 ++++++++++++++ .github/workflows/release.yml | 70 ++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 .github/workflows/packaging_test.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/packaging_test.yml b/.github/workflows/packaging_test.yml new file mode 100644 index 0000000..f844a58 --- /dev/null +++ b/.github/workflows/packaging_test.yml @@ -0,0 +1,35 @@ +name: Packaging Test + +on: + push: + branches: + - $default-branch + - development + - master + # Run tests for any PRs + pull_request: + +env: + SOURCE_DIR: ./ + ARTIFACTS_DIR: debian/build/release/ + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + env: + DEBIAN_FRONTEND: "noninteractive" + - name: Remove github artefacts + run: | + rm -rf .git* + - name: Adjust distibution in changelog file + run: | + sed -i '0,/restricted/s//stable/' debian/changelog + - name: Build Debian package + uses: dawidd6/action-debian-package@v1 + with: + artifacts_directory: debian/build/release/ + - name: Debug + run: | + ls -la diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..49663cf --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,70 @@ +on: + push: + # Sequence of patterns matched against refs/tags + tags: + - 'debian/*' # Push events to matching debian/*, i.e. debian/1.0-2, debian/20.15.10, debian/23.20020326 + +name: Release Process + +env: + SOURCE_DIR: ./ + ARTIFACTS_DIR: debian/build/release/ + +jobs: + create-release: + name: Create Release + runs-on: ubuntu-latest + outputs: + release-id: ${{ steps.create_release.outputs.id }} + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Install needed packages + run: | + if [ $(dpkg -l | grep -c dpkg-dev) -ne 1 ]; then sudo apt-get update && sudo apt-get install -y dpkg-dev; fi + - name: Gather changelog + run: | + ls -la + dpkg-parsechangelog | tail -n +9 > debian.changelog + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + body_path: debian.changelog + draft: false + prerelease: false + + build: + name: Build and upload packages + needs: create-release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + env: + DEBIAN_FRONTEND: "noninteractive" + - name: Remove github artefacts + run: | + rm -rf .git* + - name: Adjust distibution in changelog file + run: | + sed -i '0,/restricted/s//stable/' debian/changelog + - name: Build Debian package + uses: dawidd6/action-debian-package@v1 + with: + artifacts_directory: debian/build/release/ +# - name: Build Debian package +# uses: pi-top/action-debian-package@v0.2.0 +# with: +# artifacts_directory: debian/build/release/ +# target_architectures: "amd64,i386" + - name: Upload the artifacts + uses: skx/github-action-publish-binaries@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + releaseId: ${{ needs.create-release.outputs.release-id }} + args: debian/build/release/* From 071a540a61970a79cfef82bebd96b6911703e0ad Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Thu, 4 Feb 2021 21:31:03 +0100 Subject: [PATCH 166/205] Set upstream metadata fields: Bug-Database, Bug-Submit, Repository, Repository-Browse. Changes-By: lintian-brush Fixes: lintian: upstream-metadata-file-is-missing See-also: https://lintian.debian.org/tags/upstream-metadata-file-is-missing.html Fixes: lintian: upstream-metadata-missing-bug-tracking See-also: https://lintian.debian.org/tags/upstream-metadata-missing-bug-tracking.html Fixes: lintian: upstream-metadata-missing-repository See-also: https://lintian.debian.org/tags/upstream-metadata-missing-repository.html --- debian/upstream/metadata | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 debian/upstream/metadata diff --git a/debian/upstream/metadata b/debian/upstream/metadata new file mode 100644 index 0000000..9661d77 --- /dev/null +++ b/debian/upstream/metadata @@ -0,0 +1,5 @@ +--- +Bug-Database: https://github.com/SteScho/manubulon-snmp/issues +Bug-Submit: https://github.com/SteScho/manubulon-snmp/issues/new +Repository: https://github.com/SteScho/manubulon-snmp.git +Repository-Browse: https://github.com/SteScho/manubulon-snmp From 56b1ad412b6398e7e9085e79eb84f36477c5efc9 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 5 Feb 2021 12:37:40 +0100 Subject: [PATCH 167/205] d/source/options: Adding .github to diff ignore --- debian/source/options | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/source/options b/debian/source/options index f9deab5..91d4b10 100644 --- a/debian/source/options +++ b/debian/source/options @@ -1 +1 @@ -extend-diff-ignore = '(^|/)(\.travis\.yml|\.git|\.gitgnore|config\.sub|config\.guess)$' +extend-diff-ignore = '(^|/)(\.travis\.yml|\.git|\.github|\.gitgnore|config\.sub|config\.guess)$' From 731359eeb29ef83d6a728015621f78d05e190d85 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 5 Feb 2021 16:30:53 +0100 Subject: [PATCH 168/205] d/source/options: Fixing github ignore --- debian/source/options | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/source/options b/debian/source/options index 91d4b10..b746363 100644 --- a/debian/source/options +++ b/debian/source/options @@ -1 +1 @@ -extend-diff-ignore = '(^|/)(\.travis\.yml|\.git|\.github|\.gitgnore|config\.sub|config\.guess)$' +extend-diff-ignore = '(^|/)(\.travis\.yml|\.git|\.github|\.gitgnore|config\.sub|config\.guess)' From 9e269571fe2c53c0fd422c5056a2105d5f4ee46f Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 16 Jul 2021 23:09:12 +0200 Subject: [PATCH 169/205] Adding Dependabot config --- .github/dependabot.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..b3fa1e0 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: daily + time: "04:00" + reviewers: + - "waja" + pull-request-branch-name: + separator: "-" + open-pull-requests-limit: 10 From 8e8f3679fcc842dadd55951bb97029c7adb76268 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 16 Jul 2021 23:27:01 +0200 Subject: [PATCH 170/205] Do not remove .git* anymore --- .github/workflows/packaging_test.yml | 3 --- .github/workflows/release.yml | 3 --- 2 files changed, 6 deletions(-) diff --git a/.github/workflows/packaging_test.yml b/.github/workflows/packaging_test.yml index f844a58..f915b53 100644 --- a/.github/workflows/packaging_test.yml +++ b/.github/workflows/packaging_test.yml @@ -20,9 +20,6 @@ jobs: - uses: actions/checkout@v2 env: DEBIAN_FRONTEND: "noninteractive" - - name: Remove github artefacts - run: | - rm -rf .git* - name: Adjust distibution in changelog file run: | sed -i '0,/restricted/s//stable/' debian/changelog diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 49663cf..4c6c31f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -46,9 +46,6 @@ jobs: - uses: actions/checkout@v2 env: DEBIAN_FRONTEND: "noninteractive" - - name: Remove github artefacts - run: | - rm -rf .git* - name: Adjust distibution in changelog file run: | sed -i '0,/restricted/s//stable/' debian/changelog From b710d08727ebf39ed646c90c8cd807d392ff8a3f Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 21 Jul 2021 15:39:14 +0200 Subject: [PATCH 171/205] ci: pin action versions --- .github/workflows/packaging_test.yml | 2 +- .github/workflows/release.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/packaging_test.yml b/.github/workflows/packaging_test.yml index f915b53..507c150 100644 --- a/.github/workflows/packaging_test.yml +++ b/.github/workflows/packaging_test.yml @@ -24,7 +24,7 @@ jobs: run: | sed -i '0,/restricted/s//stable/' debian/changelog - name: Build Debian package - uses: dawidd6/action-debian-package@v1 + uses: dawidd6/action-debian-package@v1.4.0 with: artifacts_directory: debian/build/release/ - name: Debug diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4c6c31f..de5de2f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -50,7 +50,7 @@ jobs: run: | sed -i '0,/restricted/s//stable/' debian/changelog - name: Build Debian package - uses: dawidd6/action-debian-package@v1 + uses: dawidd6/action-debian-package@v1.4.0 with: artifacts_directory: debian/build/release/ # - name: Build Debian package @@ -59,7 +59,7 @@ jobs: # artifacts_directory: debian/build/release/ # target_architectures: "amd64,i386" - name: Upload the artifacts - uses: skx/github-action-publish-binaries@master + uses: skx/github-action-publish-binaries@release-0.15 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: From 9f8c9978ba690d4945e9450ef4e3e7d68bf2e853 Mon Sep 17 00:00:00 2001 From: Bas Couwenberg Date: Wed, 8 Sep 2021 17:56:04 +0200 Subject: [PATCH 172/205] Bump Standards-Version to 4.6.0, no changes. --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 43eb57a..bc313d0 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Build-Depends: debhelper-compat (= 12) Homepage: https://github.com/SteScho/manubulon-snmp Vcs-Browser: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins Vcs-Git: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins.git -Standards-Version: 4.5.1 +Standards-Version: 4.6.0 Package: nagios-snmp-plugins Architecture: all From 4aab014f0ec4d2af22eb722a1fa6d07cdc43a76b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Oct 2021 04:23:19 +0000 Subject: [PATCH 173/205] build(deps): bump skx/github-action-publish-binaries Bumps [skx/github-action-publish-binaries](https://github.com/skx/github-action-publish-binaries) from release-0.15 to 2.0. This release includes the previously tagged commit. - [Release notes](https://github.com/skx/github-action-publish-binaries/releases) - [Commits](https://github.com/skx/github-action-publish-binaries/compare/release-0.15...release-2.0) --- updated-dependencies: - dependency-name: skx/github-action-publish-binaries dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index de5de2f..6147fb2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -59,7 +59,7 @@ jobs: # artifacts_directory: debian/build/release/ # target_architectures: "amd64,i386" - name: Upload the artifacts - uses: skx/github-action-publish-binaries@release-0.15 + uses: skx/github-action-publish-binaries@release-2.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: From 547ca5d155a0fcffff4b781b768758c53da43715 Mon Sep 17 00:00:00 2001 From: Bas Couwenberg Date: Sat, 23 Oct 2021 19:33:02 +0200 Subject: [PATCH 174/205] Update watch file to use tags instead of releases. --- debian/watch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/watch b/debian/watch index 240eddb..0b5aa2e 100644 --- a/debian/watch +++ b/debian/watch @@ -1,3 +1,3 @@ version=4 opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/nagios-snmp-plugins-$1\.tar\.gz/,uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha)\d*)$/$1-$2/ \ - https://github.com/SteScho/manubulon-snmp/releases .*/v?(\d\S*)\.tar\.gz + https://github.com/SteScho/manubulon-snmp/tags .*/v?(\d\S*)\.tar\.gz From 9b63fc71c877f2963a47b5cfaf267329e684e3cc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Mar 2022 04:24:47 +0000 Subject: [PATCH 175/205] build(deps): bump actions/checkout from 2 to 3 Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/packaging_test.yml | 2 +- .github/workflows/release.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/packaging_test.yml b/.github/workflows/packaging_test.yml index 507c150..c13804f 100644 --- a/.github/workflows/packaging_test.yml +++ b/.github/workflows/packaging_test.yml @@ -17,7 +17,7 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 env: DEBIAN_FRONTEND: "noninteractive" - name: Adjust distibution in changelog file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6147fb2..65fb751 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ jobs: release-id: ${{ steps.create_release.outputs.id }} steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install needed packages run: | if [ $(dpkg -l | grep -c dpkg-dev) -ne 1 ]; then sudo apt-get update && sudo apt-get install -y dpkg-dev; fi @@ -43,7 +43,7 @@ jobs: needs: create-release runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 env: DEBIAN_FRONTEND: "noninteractive" - name: Adjust distibution in changelog file From 0fef6a8d275e9842aeb940e76ff1b5df21921078 Mon Sep 17 00:00:00 2001 From: Bas Couwenberg Date: Tue, 21 Jun 2022 07:28:40 +0200 Subject: [PATCH 176/205] Bump Standards-Version to 4.6.1, no changes. --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index bc313d0..6c63e3c 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Build-Depends: debhelper-compat (= 12) Homepage: https://github.com/SteScho/manubulon-snmp Vcs-Browser: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins Vcs-Git: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins.git -Standards-Version: 4.6.0 +Standards-Version: 4.6.1 Package: nagios-snmp-plugins Architecture: all From c1b122a000fa5fdcaeba4979a0f396be13a3aad0 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Thu, 20 Oct 2022 13:00:33 +0200 Subject: [PATCH 177/205] Updating build pipelines --- .github/workflows/packaging_test.yml | 6 +++++- .github/workflows/release.yml | 10 +++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/packaging_test.yml b/.github/workflows/packaging_test.yml index 507c150..17ee0cd 100644 --- a/.github/workflows/packaging_test.yml +++ b/.github/workflows/packaging_test.yml @@ -17,9 +17,12 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 env: DEBIAN_FRONTEND: "noninteractive" + - name: Remove github artefacts + run: | + rm -rf .github* - name: Adjust distibution in changelog file run: | sed -i '0,/restricted/s//stable/' debian/changelog @@ -27,6 +30,7 @@ jobs: uses: dawidd6/action-debian-package@v1.4.0 with: artifacts_directory: debian/build/release/ + os_distribution: testing - name: Debug run: | ls -la diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index de5de2f..855b57d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ jobs: release-id: ${{ steps.create_release.outputs.id }} steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install needed packages run: | if [ $(dpkg -l | grep -c dpkg-dev) -ne 1 ]; then sudo apt-get update && sudo apt-get install -y dpkg-dev; fi @@ -43,9 +43,12 @@ jobs: needs: create-release runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 env: DEBIAN_FRONTEND: "noninteractive" + - name: Remove github artefacts + run: | + rm -rf .github* - name: Adjust distibution in changelog file run: | sed -i '0,/restricted/s//stable/' debian/changelog @@ -53,13 +56,14 @@ jobs: uses: dawidd6/action-debian-package@v1.4.0 with: artifacts_directory: debian/build/release/ + os_distribution: testing # - name: Build Debian package # uses: pi-top/action-debian-package@v0.2.0 # with: # artifacts_directory: debian/build/release/ # target_architectures: "amd64,i386" - name: Upload the artifacts - uses: skx/github-action-publish-binaries@release-0.15 + uses: skx/github-action-publish-binaries@release-2.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: From f3c51609ef01b36c967d86478cf2eae8bd965a46 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Nov 2022 04:04:04 +0000 Subject: [PATCH 178/205] build(deps): bump dawidd6/action-debian-package from 1.4.0 to 1.4.4 Bumps [dawidd6/action-debian-package](https://github.com/dawidd6/action-debian-package) from 1.4.0 to 1.4.4. - [Release notes](https://github.com/dawidd6/action-debian-package/releases) - [Commits](https://github.com/dawidd6/action-debian-package/compare/v1.4.0...v1.4.4) --- updated-dependencies: - dependency-name: dawidd6/action-debian-package dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/packaging_test.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/packaging_test.yml b/.github/workflows/packaging_test.yml index c13804f..d6c6471 100644 --- a/.github/workflows/packaging_test.yml +++ b/.github/workflows/packaging_test.yml @@ -24,7 +24,7 @@ jobs: run: | sed -i '0,/restricted/s//stable/' debian/changelog - name: Build Debian package - uses: dawidd6/action-debian-package@v1.4.0 + uses: dawidd6/action-debian-package@v1.4.4 with: artifacts_directory: debian/build/release/ - name: Debug diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 65fb751..a5a0854 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -50,7 +50,7 @@ jobs: run: | sed -i '0,/restricted/s//stable/' debian/changelog - name: Build Debian package - uses: dawidd6/action-debian-package@v1.4.0 + uses: dawidd6/action-debian-package@v1.4.4 with: artifacts_directory: debian/build/release/ # - name: Build Debian package From 36ad1226bc1327bcd83182c1853471a8f6ae9278 Mon Sep 17 00:00:00 2001 From: Bas Couwenberg Date: Wed, 30 Nov 2022 09:10:01 +0100 Subject: [PATCH 179/205] Add Rules-Requires-Root to control file. --- debian/control | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/debian/control b/debian/control index 6c63e3c..b029918 100644 --- a/debian/control +++ b/debian/control @@ -4,10 +4,11 @@ Priority: optional Maintainer: Debian Nagios Maintainer Group Uploaders: Jan Wagner Build-Depends: debhelper-compat (= 12) -Homepage: https://github.com/SteScho/manubulon-snmp +Standards-Version: 4.6.1 Vcs-Browser: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins Vcs-Git: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins.git -Standards-Version: 4.6.1 +Homepage: https://github.com/SteScho/manubulon-snmp +Rules-Requires-Root: no Package: nagios-snmp-plugins Architecture: all From 465be3fd0f74fd0edb05f899295474c49f3d6ace Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 14 Dec 2022 08:44:16 +0000 Subject: [PATCH 180/205] d/control: Drop 'pkg-' from Vcs-Headers --- debian/control | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/control b/debian/control index b029918..f3ca9cc 100644 --- a/debian/control +++ b/debian/control @@ -5,8 +5,8 @@ Maintainer: Debian Nagios Maintainer Group Build-Depends: debhelper-compat (= 12) Standards-Version: 4.6.1 -Vcs-Browser: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins -Vcs-Git: https://salsa.debian.org/nagios-team/pkg-nagios-snmp-plugins.git +Vcs-Browser: https://salsa.debian.org/nagios-team/nagios-snmp-plugins +Vcs-Git: https://salsa.debian.org/nagios-team/nagios-snmp-plugins.git Homepage: https://github.com/SteScho/manubulon-snmp Rules-Requires-Root: no From 8bb199837f807247d38b4565dad381b986be0546 Mon Sep 17 00:00:00 2001 From: Debian Janitor Date: Wed, 30 Nov 2022 14:22:29 +0000 Subject: [PATCH 181/205] Remove constraints unnecessary since buster (oldstable) * nagios-snmp-plugins: Drop dependency on essential package perl-base (>= 5.8.4-8) in Depends. Changes-By: deb-scrub-obsolete --- debian/control | 1 - 1 file changed, 1 deletion(-) diff --git a/debian/control b/debian/control index b029918..9c999e5 100644 --- a/debian/control +++ b/debian/control @@ -14,7 +14,6 @@ Package: nagios-snmp-plugins Architecture: all Depends: libnet-snmp-perl, monitoring-plugins-common | nagios-plugins-basic (>= 1.4.5-2), - perl-base (>= 5.8.4-8), ucf, ${misc:Depends}, ${perl:Depends} From 16004b91a9b041989b393b50a03ea5a82e7058dd Mon Sep 17 00:00:00 2001 From: Debian Janitor Date: Wed, 30 Nov 2022 14:22:29 +0000 Subject: [PATCH 182/205] Remove constraints unnecessary since buster (oldstable) * nagios-snmp-plugins: Drop dependency on essential package perl-base (>= 5.8.4-8) in Depends. Changes-By: deb-scrub-obsolete --- debian/control | 1 - 1 file changed, 1 deletion(-) diff --git a/debian/control b/debian/control index f3ca9cc..e2ace60 100644 --- a/debian/control +++ b/debian/control @@ -14,7 +14,6 @@ Package: nagios-snmp-plugins Architecture: all Depends: libnet-snmp-perl, monitoring-plugins-common | nagios-plugins-basic (>= 1.4.5-2), - perl-base (>= 5.8.4-8), ucf, ${misc:Depends}, ${perl:Depends} From ea50f546213af87262d261b23406ba81bbce931b Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 13 Jan 2023 10:28:25 +0000 Subject: [PATCH 183/205] Bump debhelper from old 12 to 13. Changes-By: lintian-brush Fixes: lintian: package-uses-old-debhelper-compat-version See-also: https://lintian.debian.org/tags/package-uses-old-debhelper-compat-version.html --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index e2ace60..b8b9388 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: net Priority: optional Maintainer: Debian Nagios Maintainer Group Uploaders: Jan Wagner -Build-Depends: debhelper-compat (= 12) +Build-Depends: debhelper-compat (= 13) Standards-Version: 4.6.1 Vcs-Browser: https://salsa.debian.org/nagios-team/nagios-snmp-plugins Vcs-Git: https://salsa.debian.org/nagios-team/nagios-snmp-plugins.git From 4f38dec72094c7414fe9d10e739994841765ce0a Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 13 Jan 2023 10:28:28 +0000 Subject: [PATCH 184/205] Update standards version to 4.6.2, no changes needed. Changes-By: lintian-brush Fixes: lintian: out-of-date-standards-version See-also: https://lintian.debian.org/tags/out-of-date-standards-version.html --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index b8b9388..c0ad87c 100644 --- a/debian/control +++ b/debian/control @@ -4,7 +4,7 @@ Priority: optional Maintainer: Debian Nagios Maintainer Group Uploaders: Jan Wagner Build-Depends: debhelper-compat (= 13) -Standards-Version: 4.6.1 +Standards-Version: 4.6.2 Vcs-Browser: https://salsa.debian.org/nagios-team/nagios-snmp-plugins Vcs-Git: https://salsa.debian.org/nagios-team/nagios-snmp-plugins.git Homepage: https://github.com/SteScho/manubulon-snmp From a193b79f09513511e5d0651c4dc8422bea1f74a7 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 13 Jan 2023 10:46:13 +0000 Subject: [PATCH 185/205] Adding d/p/19_check_snmp_int_remove_unneeded_my from upstream --- .../19_check_snmp_int_remove_unneeded_my | 23 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 24 insertions(+) create mode 100644 debian/patches/19_check_snmp_int_remove_unneeded_my diff --git a/debian/patches/19_check_snmp_int_remove_unneeded_my b/debian/patches/19_check_snmp_int_remove_unneeded_my new file mode 100644 index 0000000..ecd7b66 --- /dev/null +++ b/debian/patches/19_check_snmp_int_remove_unneeded_my @@ -0,0 +1,23 @@ +From 524e0eec7407bb0f650e28aa3d26e16028b86e54 Mon Sep 17 00:00:00 2001 +From: Steffen Schoch +Date: Tue, 27 Apr 2021 06:14:34 +0200 +Subject: [PATCH] Update check_snmp_int.pl + +Removed unneeded my +--- + plugins/check_snmp_int.pl | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/plugins/check_snmp_int.pl b/plugins/check_snmp_int.pl +index 5fe752e..271cfbc 100755 +--- a/plugins/check_snmp_int.pl ++++ b/plugins/check_snmp_int.pl +@@ -1038,7 +1038,7 @@ sub check_options { + $perf_out .= "'" . $descr[$i] =~ s/\./_/r . "_out_discard'=" . $$result{ $oid_perf_outdisc[$i] } . "c "; + } + if (defined($o_perfs)) { +- my $speed_real = "" unless (defined($speed_real)); ++ $speed_real = "" unless (defined($speed_real)); + $perf_out .= "'" . $descr[$i] =~ s/\./_/r . "_speed_bps'=" . $speed_real . " "; + } + if (defined($o_weather) && $usable_data == 1) { diff --git a/debian/patches/series b/debian/patches/series index 82505fe..e354a10 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -7,5 +7,6 @@ 16_check_snmp_win_max_message_size 17_check_snmp_storage_okifempty 18_check_snmp_int_fix_perf_out +19_check_snmp_int_remove_unneeded_my 50_disable_epn 51_fix_privacy_doc From fdc0108a3b719ccf056f5d2b96ba96d8e11cb11f Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 13 Jan 2023 10:48:13 +0000 Subject: [PATCH 186/205] Adding d/p/20_check_snmp_int_avaid_huge_amount_of_regex from upstream --- ..._check_snmp_int_avaid_huge_amount_of_regex | 93 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 94 insertions(+) create mode 100644 debian/patches/20_check_snmp_int_avaid_huge_amount_of_regex diff --git a/debian/patches/20_check_snmp_int_avaid_huge_amount_of_regex b/debian/patches/20_check_snmp_int_avaid_huge_amount_of_regex new file mode 100644 index 0000000..2012207 --- /dev/null +++ b/debian/patches/20_check_snmp_int_avaid_huge_amount_of_regex @@ -0,0 +1,93 @@ +From c591f7d56378cbb40f1c3c23cbf23a8669a45730 Mon Sep 17 00:00:00 2001 +From: kwork-er <88452982+kwork-er@users.noreply.github.com> +Date: Thu, 5 Aug 2021 21:53:43 +0200 +Subject: [PATCH] Update check_snmp_int.pl + +Effectively reverting commit 9f9b15a926d8795935b54626dc3ab9e5becb2763 and doing it in a different way that avoids adding huge amounts of regex, that may not run on older systems. +Removed the added " =~ s/\./_/r ", instead replacing the dots (.) in the regex that was meant for it in the first place -> line 967. +--- + plugins/check_snmp_int.pl | 28 ++++++++++++++-------------- + 1 file changed, 14 insertions(+), 14 deletions(-) + +diff --git a/plugins/check_snmp_int.pl b/plugins/check_snmp_int.pl +index 271cfbc..71f8d14 100755 +--- a/plugins/check_snmp_int.pl ++++ b/plugins/check_snmp_int.pl +@@ -964,7 +964,7 @@ sub check_options { + } + + # Get rid of special caracters for performance in description +- $descr[$i] =~ s/'\/\(\)/_/g; ++ $descr[$i] =~ s/['\/\(\).]/_/g; + if (($int_status == $ok_val) || (defined($o_down) && $int_status == 2) || (defined($o_dormant) && $int_status == 5)) + { + $num_ok++; +@@ -979,12 +979,12 @@ sub check_options { + $warn_factor /= $speed_real; + $warn_factor *= 100; # now turn into displayed % : 0,1 = 10% + } +- $perf_out .= "'" . $descr[$i] =~ s/\./_/r . "_in_prct'="; ++ $perf_out .= "'" . $descr[$i] . "_in_prct'="; + $perf_out .= sprintf("%.0f", $checkperf_out_raw[0] * 800 / $speed_real) . "%;"; + $perf_out .= ($o_warn[0] != 0) ? sprintf("%.0f", $o_warn[0] * $warn_factor) . ";" : ";"; + $perf_out .= ($o_crit[0] != 0) ? sprintf("%.0f", $o_crit[0] * $warn_factor) . ";" : ";"; + $perf_out .= "0;100 "; +- $perf_out .= "'" . $descr[$i] =~ s/\./_/r . "_out_prct'="; ++ $perf_out .= "'" . $descr[$i] . "_out_prct'="; + $perf_out .= sprintf("%.0f", $checkperf_out_raw[1] * 800 / $speed_real) . "%;"; + $perf_out .= ($o_warn[1] != 0) ? sprintf("%.0f", $o_warn[1] * $warn_factor) . ";" : ";"; + $perf_out .= ($o_crit[1] != 0) ? sprintf("%.0f", $o_crit[1] * $warn_factor) . ";" : ";"; +@@ -1000,12 +1000,12 @@ sub check_options { + } else { # just convert from K|M|G bps + $warn_factor = (defined($o_meg)) ? 1000000 : (defined($o_gig)) ? 1000000000 : 1000; + } +- $perf_out .= "'" . $descr[$i] =~ s/\./_/r . "_in_bps'="; ++ $perf_out .= "'" . $descr[$i] . "_in_bps'="; + $perf_out .= sprintf("%.0f", $checkperf_out_raw[0] * 8) . ";"; + $perf_out .= ($o_warn[0] != 0) ? $o_warn[0] * $warn_factor . ";" : ";"; + $perf_out .= ($o_crit[0] != 0) ? $o_crit[0] * $warn_factor . ";" : ";"; + $perf_out .= "0;" . $speed_real . " "; +- $perf_out .= "'" . $descr[$i] =~ s/\./_/r . "_out_bps'="; ++ $perf_out .= "'" . $descr[$i] . "_out_bps'="; + $perf_out .= sprintf("%.0f", $checkperf_out_raw[1] * 8) . ";"; + $perf_out .= ($o_warn[1] != 0) ? $o_warn[1] * $warn_factor . ";" : ";"; + $perf_out .= ($o_crit[1] != 0) ? $o_crit[1] * $warn_factor . ";" : ";"; +@@ -1017,29 +1017,29 @@ sub check_options { + } else { # just convert from K|M|G bps + $warn_factor = (defined($o_meg)) ? 1048576 : (defined($o_gig)) ? 1073741824 : 1024; + } +- $perf_out .= "'" . $descr[$i] =~ s/\./_/r . "_in_Bps'=" . sprintf("%.0f", $checkperf_out_raw[0]) . ";"; ++ $perf_out .= "'" . $descr[$i] . "_in_Bps'=" . sprintf("%.0f", $checkperf_out_raw[0]) . ";"; + $perf_out .= ($o_warn[0] != 0) ? $o_warn[0] * $warn_factor . ";" : ";"; + $perf_out .= ($o_crit[0] != 0) ? $o_crit[0] * $warn_factor . ";" : ";"; + $perf_out .= "0;" . $speed_real / 8 . " "; +- $perf_out .= "'" . $descr[$i] =~ s/\./_/r . "_out_Bps'=" . sprintf("%.0f", $checkperf_out_raw[1]) . ";"; ++ $perf_out .= "'" . $descr[$i] . "_out_Bps'=" . sprintf("%.0f", $checkperf_out_raw[1]) . ";"; + $perf_out .= ($o_warn[1] != 0) ? $o_warn[1] * $warn_factor . ";" : ";"; + $perf_out .= ($o_crit[1] != 0) ? $o_crit[1] * $warn_factor . ";" : ";"; + $perf_out .= "0;" . $speed_real / 8 . " "; + } + } + } else { # output in octet counter +- $perf_out .= "'" . $descr[$i] =~ s/\./_/r . "_in_octet'=" . $$result{ $oid_perf_inoct[$i] } . "c "; +- $perf_out .= "'" . $descr[$i] =~ s/\./_/r . "_out_octet'=" . $$result{ $oid_perf_outoct[$i] } . "c "; ++ $perf_out .= "'" . $descr[$i] . "_in_octet'=" . $$result{ $oid_perf_inoct[$i] } . "c "; ++ $perf_out .= "'" . $descr[$i] . "_out_octet'=" . $$result{ $oid_perf_outoct[$i] } . "c "; + } + if (defined($o_perfe)) { +- $perf_out .= "'" . $descr[$i] =~ s/\./_/r . "_in_error'=" . $$result{ $oid_perf_inerr[$i] } . "c "; +- $perf_out .= "'" . $descr[$i] =~ s/\./_/r . "_in_discard'=" . $$result{ $oid_perf_indisc[$i] } . "c "; +- $perf_out .= "'" . $descr[$i] =~ s/\./_/r . "_out_error'=" . $$result{ $oid_perf_outerr[$i] } . "c "; +- $perf_out .= "'" . $descr[$i] =~ s/\./_/r . "_out_discard'=" . $$result{ $oid_perf_outdisc[$i] } . "c "; ++ $perf_out .= "'" . $descr[$i] . "_in_error'=" . $$result{ $oid_perf_inerr[$i] } . "c "; ++ $perf_out .= "'" . $descr[$i] . "_in_discard'=" . $$result{ $oid_perf_indisc[$i] } . "c "; ++ $perf_out .= "'" . $descr[$i] . "_out_error'=" . $$result{ $oid_perf_outerr[$i] } . "c "; ++ $perf_out .= "'" . $descr[$i] . "_out_discard'=" . $$result{ $oid_perf_outdisc[$i] } . "c "; + } + if (defined($o_perfs)) { + $speed_real = "" unless (defined($speed_real)); +- $perf_out .= "'" . $descr[$i] =~ s/\./_/r . "_speed_bps'=" . $speed_real . " "; ++ $perf_out .= "'" . $descr[$i] . "_speed_bps'=" . $speed_real . " "; + } + if (defined($o_weather) && $usable_data == 1) { + $perf_out .= "in=" . sprintf("%.0f", $checkperf_out_raw[0]) . ";;;0;" . sprintf("%.0f", $speed_real / 8) . " "; diff --git a/debian/patches/series b/debian/patches/series index e354a10..74089a9 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -8,5 +8,6 @@ 17_check_snmp_storage_okifempty 18_check_snmp_int_fix_perf_out 19_check_snmp_int_remove_unneeded_my +20_check_snmp_int_avaid_huge_amount_of_regex 50_disable_epn 51_fix_privacy_doc From d4bd9c980ea433593f3badd6018cb7b36637618d Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 13 Jan 2023 10:50:17 +0000 Subject: [PATCH 187/205] Adding d/p/21_check_snmp_load_update_fortiswitch_and_fortigate4.3 from upstream --- ...p_load_update_fortiswitch_and_fortigate4.3 | 90 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 91 insertions(+) create mode 100644 debian/patches/21_check_snmp_load_update_fortiswitch_and_fortigate4.3 diff --git a/debian/patches/21_check_snmp_load_update_fortiswitch_and_fortigate4.3 b/debian/patches/21_check_snmp_load_update_fortiswitch_and_fortigate4.3 new file mode 100644 index 0000000..cf0ffcb --- /dev/null +++ b/debian/patches/21_check_snmp_load_update_fortiswitch_and_fortigate4.3 @@ -0,0 +1,90 @@ +From 946bd37f5632fead9382f05a3600f0328dae53a1 Mon Sep 17 00:00:00 2001 +From: Martin Botka <16738302+Haxk20@users.noreply.github.com> +Date: Mon, 1 Aug 2022 12:14:37 +0200 +Subject: [PATCH] check_snmp_load.pl: Add Fortiswitch & 4.3+ firmware fortigate + +This commit adds support for checking the fortiswitch CPU usage +and also fortigate 4.3 and above firmware. This OID got changed but to keep +backwards compatibility and not to break already running platforms depending on this +the new OID was added as new type. + +Signed-off-by: Martin Botka +--- + plugins/check_snmp_load.pl | 21 ++++++++++++++------- + 1 file changed, 14 insertions(+), 7 deletions(-) + +diff --git a/plugins/check_snmp_load.pl b/plugins/check_snmp_load.pl +index 0959f6a..ecafb59 100755 +--- a/plugins/check_snmp_load.pl ++++ b/plugins/check_snmp_load.pl +@@ -81,6 +81,12 @@ + # Fortigate CPU + my $fortigate_cpu = ".1.3.6.1.4.1.12356.1.8.0"; # Fortigate CPU % usage + ++# Fortigate CPU ++my $fortigate43_cpu = "1.3.6.1.4.1.12356.101.4.1.3.0"; # Fortigate 4.3 firmware CPU % usage ++ ++# Fortigate CPU ++my $fortiswitch_cpu = ".1.3.6.1.4.1.12356.106.4.1.2.0"; # Fortiswitch CPU % usage ++ + # Linkproof Appliance + my $linkproof_cpu = "1.3.6.1.4.1.89.35.1.55.0"; # CPU RE (Routing Engine Tasks) + +@@ -95,12 +101,12 @@ + + # valid values + my @valid_types +- = ("stand", "netsc", "netsl", "as400", "cisco", "cata", "cisg", "nsc", "fg", "bc", "nokia", "hp", "lp", "hpux", "n5k"); ++ = ("stand", "netsc", "netsl", "as400", "cisco", "cata", "cisg", "nsc", "fg", "fg43", "fs", "bc", "nokia", "hp", "lp", "hpux", "n5k"); + + # CPU OID array + my %cpu_oid = ( + "netsc", $ns_cpu_idle, "as400", $as400_cpu, "bc", $bluecoat_cpu, "nokia", $nokia_cpu, +- "hp", $procurve_cpu, "lp", $linkproof_cpu, "fg", $fortigate_cpu, "n5k", $n5k_cpu ++ "hp", $procurve_cpu, "lp", $linkproof_cpu, "fg", $fortigate_cpu, "fg43", $fortigate43_cpu, "fs", $fortiswitch_cpu, "n5k", $n5k_cpu + ); + + # Globals +@@ -113,7 +119,7 @@ + my $o_verb = undef; # verbose mode + my $o_version = undef; # print version + +-# check type : stand | netsc | netsl | as400 | cisco | cata | cisg | nsc | fg | bc | nokia | hp | lp | hpux ++# check type : stand | netsc | netsl | as400 | cisco | cata | cisg | nsc | fg | fg43| fs | bc | nokia | hp | lp | hpux + my $o_check_type = "stand"; + + # End compatibility +@@ -139,7 +145,7 @@ + + sub print_usage { + print +-"Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] [-P ] -w -c -T=[stand|netsl|netsc|as400|cisco|cata|cisg|nsc|fg|bc|nokia|hp|lp|hpux] [-f] [-t ] [-V]\n"; ++"Usage: $0 [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] [-P ] -w -c -T=[stand|netsl|netsc|as400|cisco|cata|cisg|nsc|fg|fg43|fs|bc|nokia|hp|lp|hpux] [-f] [-t ] [-V]\n"; + } + + sub isnnum { # Return true if arg is not a number +@@ -201,6 +207,8 @@ sub help { + cisg : Cisco small business (SG500) CPU usage (1,5 & 15 minutes values) + nsc : NetScreen CPU usage + fg : Fortigate CPU usage ++ fg43 : Fortigate CPU usage for 4.3 firmware ++ fs : Fortiswitch CPU usage + bc : Bluecoat CPU usage + nokia : Nokia CPU usage + hp : HP procurve switch CPU usage +@@ -806,8 +814,8 @@ sub is_legacy_snmp_version { + exit $exit_val; + } + +-################## CPU for : AS/400 , Netsnmp, HP, Bluecoat, linkproof, fortigate ########### +-if ($o_check_type =~ /netsc|as400|bc|nokia|^hp$|lp|fg/) { ++################## CPU for : AS/400 , Netsnmp, HP, Bluecoat, linkproof, fortigate, fortigate43, fortiswitch ########### ++if ($o_check_type =~ /netsc|as400|bc|nokia|^hp$|lp|fg|fg43|fs/) { + + # Get load table + my @oidlist = $cpu_oid{$o_check_type}; +@@ -965,4 +973,3 @@ sub is_legacy_snmp_version { + ? print " | cpu_prct_used=$cpu_used%;$o_warn;$o_crit\n" + : print "\n"; + exit $exit_val; +- diff --git a/debian/patches/series b/debian/patches/series index 74089a9..fded68c 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -9,5 +9,6 @@ 18_check_snmp_int_fix_perf_out 19_check_snmp_int_remove_unneeded_my 20_check_snmp_int_avaid_huge_amount_of_regex +21_check_snmp_load_update_fortiswitch_and_fortigate4.3 50_disable_epn 51_fix_privacy_doc From e2bdf2d801864c3f12705ff88d335c8217a1b1e4 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 23 Jan 2023 11:19:52 +0000 Subject: [PATCH 188/205] Adding d/p/22_check_snmp_storage_fix_space_btrfs from upstream --- .../22_check_snmp_storage_fix_space_btrfs | 423 ++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 424 insertions(+) create mode 100644 debian/patches/22_check_snmp_storage_fix_space_btrfs diff --git a/debian/patches/22_check_snmp_storage_fix_space_btrfs b/debian/patches/22_check_snmp_storage_fix_space_btrfs new file mode 100644 index 0000000..698376b --- /dev/null +++ b/debian/patches/22_check_snmp_storage_fix_space_btrfs @@ -0,0 +1,423 @@ +From 42f4ebf23be504e448513a67faa99e02a3d5e3b5 Mon Sep 17 00:00:00 2001 +From: IB Development Team +Date: Thu, 19 Jan 2023 10:36:45 +0000 +Subject: [PATCH] No out of space check_snmp_storage warning on btrfs + +We've noticed out of space condition in one of btrfs filesystems +monitored with check_snmp_storage; problem was not detected by +check_snmp_storage. + +Filesystem status: + +root@mysrv:~# btrfs fi df -b /mnt +Data, single: total=2222194688, used=2222194688 +System, DUP: total=8388608, used=16384 +System, single: total=4194304, used=0 +Metadata, DUP: total=484835328, used=163921920 +Metadata, single: total=8388608, used=0 +GlobalReserve, single: total=16777216, used=0 + +root@mysrv:~# df -B1 /mnt +Filesystem 1B-blocks Used Available Use% Mounted on +/dev/mapper/myvg 3221225472 2566848512 0 100% /mnt + +Net-snmp snmp infos for this fs: + +hrStorageTable (used by check_snmp_storage): + +iso.3.6.1.2.1.25.2.3.1.1.69 = INTEGER: 69 // +hrStorageIndex +iso.3.6.1.2.1.25.2.3.1.2.69 = OID: iso.3.6.1.2.1.25.2.1.4 // +hrStorageType +iso.3.6.1.2.1.25.2.3.1.3.69 = STRING: "/mnt" // +hrStorageDescr +iso.3.6.1.2.1.25.2.3.1.4.69 = INTEGER: 4096 // +hrStorageAllocationUnits +iso.3.6.1.2.1.25.2.3.1.5.69 = INTEGER: 786432 // +hrStorageSize +iso.3.6.1.2.1.25.2.3.1.6.69 = INTEGER: 626672 // +hrStorageUsed + +dskTable (not used by check_snmp_storage): + +iso.3.6.1.4.1.2021.9.1.1.19 = INTEGER: +19 // dskIndex +iso.3.6.1.4.1.2021.9.1.2.19 = STRING: +"/mnt" // dskPath +iso.3.6.1.4.1.2021.9.1.3.19 = STRING: "/dev/mapper/myvg" // +dskDevice +iso.3.6.1.4.1.2021.9.1.4.19 = INTEGER: +-1 // dskMinimum +iso.3.6.1.4.1.2021.9.1.5.19 = INTEGER: +10 // dskMinPercent +iso.3.6.1.4.1.2021.9.1.6.19 = INTEGER: +3145728 // dskTotal (Total size of the +disk/partion (kBytes)) +iso.3.6.1.4.1.2021.9.1.7.19 = INTEGER: +0 // dskAvail (Available space on the +disk) +iso.3.6.1.4.1.2021.9.1.8.19 = INTEGER: +2506688 // dskUsed (Used space on the disk) +iso.3.6.1.4.1.2021.9.1.9.19 = INTEGER: +80 // dskPercent (Percentage of space +used on disk) +iso.3.6.1.4.1.2021.9.1.10.19 = INTEGER: +0 // dskPercentNode (Percentage of +inodes used on disk) +iso.3.6.1.4.1.2021.9.1.11.19 = Gauge32: +3145728 // dskTotalLow Total size of the +disk/partion (kBytes). Together with dskTotalHigh composes 64-bit +number) +iso.3.6.1.4.1.2021.9.1.12.19 = Gauge32: +0 // dskTotalHigh (Total size of the +disk/partion (kBytes). Together with dskTotalLow composes 64-bit +number.) +iso.3.6.1.4.1.2021.9.1.13.19 = Gauge32: +0 // dskAvailLow (Available space on +the disk (kBytes). Together with dskAvailHigh composes 64-bit number.) +iso.3.6.1.4.1.2021.9.1.14.19 = Gauge32: +0 // dskAvailHigh (Available space on +the disk (kBytes). Together with dskAvailLow composes 64-bit number.) +iso.3.6.1.4.1.2021.9.1.15.19 = Gauge32: +2506688 // dskUsedLow (Used space on the disk +(kBytes). Together with dskUsedHigh composes 64-bit number.) +iso.3.6.1.4.1.2021.9.1.16.19 = Gauge32: +0 // dskUsedHigh (Used space on the +disk (kBytes). Together with dskUsedLow composes 64-bit number.) +iso.3.6.1.4.1.2021.9.1.100.19 = INTEGER: +1 // dskErrorFlag (Error flag signaling +that the disk or partition is under the minimum required space +configured for it.) +iso.3.6.1.4.1.2021.9.1.101.19 = STRING: "/mnt: less than 10% free (= +0%)" // dskErrorMsg (A text description providing a warning and the +space left on the disk.) + +The cause of problem is that in btrfs free space may be less than +total-used and by default check_snmp_storage checks used space which +was in this case about 80% (with 0% available in the same time and OS +was throwing OOS errors on write). + +The solution is to configure warn/crit levels for %free not %used and +use avail from dskTable because hrStorageTable does not provide this +info (check_snmp_storage calculates free=total-used which is wrong for +btrfs as above). + +This patch works ok for us (this allows one to use new -u switch to use +dskTable and its avail info instead of default hrStorageTable and its +free=total-used calculation). This also adds a few spaces to plugin +output for better message readability. +--- + plugins/check_snmp_storage.pl | 145 ++++++++++++++++++++++++++-------- + 1 file changed, 110 insertions(+), 35 deletions(-) + +--- a/plugins/check_snmp_storage.pl ++++ b/plugins/check_snmp_storage.pl +@@ -19,13 +19,21 @@ + my %ERRORS = ('OK' => 0, 'WARNING' => 1, 'CRITICAL' => 2, 'UNKNOWN' => 3, 'DEPENDENT' => 4); + + # SNMP Datas +-my $storage_table = '1.3.6.1.2.1.25.2.3.1'; +-my $storagetype_table = '1.3.6.1.2.1.25.2.3.1.2'; +-my $index_table = '1.3.6.1.2.1.25.2.3.1.1'; +-my $descr_table = '1.3.6.1.2.1.25.2.3.1.3'; +-my $size_table = '1.3.6.1.2.1.25.2.3.1.5.'; +-my $used_table = '1.3.6.1.2.1.25.2.3.1.6.'; +-my $alloc_units = '1.3.6.1.2.1.25.2.3.1.4.'; ++ ++my $hrStorageTable_storage_table = '1.3.6.1.2.1.25.2.3.1'; ++my $hrStorageTable_storagetype_table = '1.3.6.1.2.1.25.2.3.1.2'; ++my $hrStorageTable_index_table = '1.3.6.1.2.1.25.2.3.1.1'; ++my $hrStorageTable_descr_table = '1.3.6.1.2.1.25.2.3.1.3'; ++my $hrStorageTable_size_table = '1.3.6.1.2.1.25.2.3.1.5.'; ++my $hrStorageTable_used_table = '1.3.6.1.2.1.25.2.3.1.6.'; ++my $hrStorageTable_alloc_units = '1.3.6.1.2.1.25.2.3.1.4.'; ++ ++my $dskTable_storage_table = '1.3.6.1.4.1.2021.9.1'; ++my $dskTable_index_table = '1.3.6.1.4.1.2021.9.1.1'; ++my $dskTable_descr_table = '1.3.6.1.4.1.2021.9.1.2'; ++my $dskTable_size_table = '1.3.6.1.4.1.2021.9.1.6.'; ++my $dskTable_avail_table = '1.3.6.1.4.1.2021.9.1.7.'; ++my $dskTable_used_table = '1.3.6.1.4.1.2021.9.1.8.'; + + #Storage types definition - from /usr/share/snmp/mibs/HOST-RESOURCES-TYPES.txt + my %hrStorage; +@@ -80,6 +88,8 @@ + my @o_shortL = undef; # output type,where,cut + my $o_reserve = 0; # % reserved blocks (A. Greiner-B\ufffdr patch) + my $o_giga = undef; # output and levels in gigabytes instead of megabytes ++my $o_dsktable = undef; # use dskTable instead of default hrStorageTable ++ + + # SNMPv3 specific + my $o_login = undef; # Login for snmpv3 +@@ -99,7 +109,7 @@ + + sub print_usage { + print +-"Usage: $Name [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] [-P ] -m [-q storagetype] -w -c [-t ] [-T pl|pu|bl|bu ] [-r -s -i -G] [-e] [-O] [-S 0|1[,1,]] [-o ] [-R <% reserved>]\n"; ++"Usage: $Name [-v] -H -C [-2] | (-l login -x passwd [-X pass -L ,]) [-p ] [-P ] [-u] -m [-q storagetype] -w -c [-t ] [-T pl|pu|bl|bu ] [-r -s -i -G] [-e] [-O] [-S 0|1[,1,]] [-o ] [-R <% reserved>]\n"; + } + + sub round ($$) { +@@ -145,13 +155,13 @@ + -2, --v2c + Use snmp v2c + -l, --login=LOGIN ; -x, --passwd=PASSWD +- Login and auth password for snmpv3 authentication +- If no priv password exists, implies AuthNoPriv ++ Login and auth password for snmpv3 authentication ++ If no priv password exists, implies AuthNoPriv + -X, --privpass=PASSWD + Priv password for snmpv3 (AuthPriv protocol) + -L, --protocols=, + : Authentication protocol (md5|sha : default md5) +- : Priv protocole (des|aes : default des) ++ : Priv protocole (des|aes : default des) + -x, --passwd=PASSWD + Password for snmpv3 authentication + -p, --port=PORT +@@ -162,6 +172,8 @@ + 'udp/ipv6' : UDP over IPv6 + 'tcp/ipv4' : TCP over IPv4 + 'tcp/ipv6' : TCP over IPv6 ++-u, --dsktable ++ use dskTable instead of default hrStorageTable; cannot be used with -q + -m, --name=NAME + Name in description OID (can be mounpoints '/home' or 'Swap Space'...) + This is treated as a regexp : -m /var will match /var , /var/log, /opt/var ... +@@ -190,10 +202,10 @@ + bu : calculate MegaBytes used + -w, --warn=INTEGER + percent / MB of disk used to generate WARNING state +- you can add the % sign ++ you can add the % sign + -c, --critical=INTEGER + percent / MB of disk used to generate CRITICAL state +- you can add the % sign ++ you can add the % sign + -R, --reserved=INTEGER + % reserved blocks for superuser + For ext2/3 filesystems, it is 5% by default +@@ -205,29 +217,29 @@ + : Make the output shorter : + 0 : only print the global result except the disk in warning or critical + ex: "< 80% : OK" +- 1 : Don't print all info for every disk ++ 1 : Don't print all info for every disk + ex : "/ : 66 %used (< 80) : OK" + : (optional) if = 1, put the OK/WARN/CRIT at the beginning + : take the first caracters or last if n<0 + -o, --octetlength=INTEGER + max-size of the SNMP message, usefull in case of Too Long responses. + Be carefull with network filters. Range 484 - 65535, default are +- usually 1472,1452,1460 or 1440. ++ usually 1472,1452,1460 or 1440. + -t, --timeout=INTEGER + timeout for SNMP in seconds (Default: 5) + -V, --version + prints version number +-Note : ++Note : + with T=pu or T=bu : OK < warn < crit + with T=pl ot T=bl : crit < warn < OK +- ++ + If multiple storage are selected, the worse condition will be returned + i.e if one disk is critical, the return is critical +- +- example : +- Browse storage list :