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