From cb6672991633766190b88fdb96d8e69ee748bd85 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 23 Jan 2019 20:02:42 +0100 Subject: [PATCH] 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