Delete old unused patches

This commit is contained in:
Jan Wagner 2019-01-23 20:02:42 +01:00
parent 3d095b1adc
commit cb66729916
13 changed files with 0 additions and 3744 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,439 +0,0 @@
## 10_fix_net_snmp_version by Jan Wagner <waja@cyconet.org>
##
## 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);

View file

@ -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 <michael.friedrich@gmail.com>
## 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 "<I\s*[^>" 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

View file

@ -1,266 +0,0 @@
## 16_perfdata by Michael Friedrich
##
## DP: Add perfdata
## From 264a0b15dd69a7ab4133b351b9316e1b443da154 Mon Sep 17 00:00:00 2001
## From: Michael Friedrich <michael.friedrich@netways.de>
## 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 @@
<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
@@ -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 @@
<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
@@ -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=<type>[,<where>,<cut>]
<type>: 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)<br>
-c, --connexions=WARN,CRIT<br>
check warn and critical number of connexions (must have -w)<br>
- -f, --perfparse<br>
- perfparse output (only works with -c)<br>
+ -f, --perfparse, --perfdata<br>
+ performance data output (only works with -c)<br>
-P, --port=PORT<br>
SNMP port (Default 161)<br>
-t, --timeout=INTEGER<br>
--- a/doc/snmp_css.html
+++ b/doc/snmp_css.html
@@ -289,8 +289,8 @@
&lt;privproto&gt; : 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<br>
-c, --celcius=&lt;celcius&gt;<br>
Maximum temp in degree celcius<br>
- -f, --perfparse<br>
- Perfparse compatible output<br>
+ -f, --perfparse, --perfdata<br>
+ Performance data output<br>
-t, --timeout=INTEGER<br>
timeout for SNMP in seconds (Default: 5)<br>
-V, --version<br>
--- a/doc/snmp_int.html
+++ b/doc/snmp_int.html
@@ -594,8 +594,8 @@
Be carefull with network filters. Range 484 - 65535, default
are<br>
usually 1472,1452,1460 or 1440. <br>
- -f, --perfparse<br>
- Perfparse compatible output (no output when interface is down).<br>
+ -f, --perfparse, --perfdata<br>
+ Performance data output (no output when interface is down).<br>
-e, --error<br>
Add error &amp; discard to Perfparse output<br>
-S, --intspeed<br>
--- a/doc/snmp_load.html
+++ b/doc/snmp_load.html
@@ -357,8 +357,8 @@
nokia : Nokia CPU usage<br>
hp : HP procurve switch CPU usage<br>
lp : Linkproof CPU usage<br>
- -f, --perfparse<br>
- Perfparse compatible output<br>
+ -f, --perfparse, --perfdata<br>
+ Performance data output<br>
-t, --timeout=INTEGER<br>
timeout for SNMP in seconds (Default: 5)<br>
-V, --version<br>
--- a/doc/snmp_storage.html
+++ b/doc/snmp_storage.html
@@ -1211,8 +1211,8 @@
-c, --critical=INTEGER<br>
percent / MB of disk used to generate CRITICAL state<br>
you can add the % sign <br>
- -f, --perfparse<br>
- Perfparse compatible output<br>
+ -f, --perfparse, --perfdata<br>
+ Performance data output<br>
-S, --short=&lt;type&gt;[,&lt;where&gt;,&lt;cut&gt;]<br>
&lt;type&gt;: Make the output shorter :<br>
0 : only print the global result except the disk in warning

View file

@ -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 <michael.friedrich@netways.de>
## 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 <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>]) [-p <port>] -w <warn level> -c <crit level> -T=[stand|netsl|netsc|as400|cisco|cata|nsc|fg|bc|nokia|hp|lp|hpux] [-f] [-t <timeout>] [-V]\n";
+ print "Usage: $0 [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>]) [-p <port>] [-P <protocol>] -w <warn level> -c <crit level> -T=[stand|netsl|netsc|as400|cisco|cata|nsc|fg|bc|nokia|hp|lp|hpux] [-f] [-t <timeout>] [-V]\n";
}
sub isnnum { # Return true if arg is not a number
@@ -153,8 +154,16 @@ sub help {
-L, --protocols=<authproto>,<privproto>
<authproto> : Authentication protocol (md5|sha : default md5)
<privproto> : 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 <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>]) [-p <port>] -w <warn level> -c <crit level> [-I|-N|-E] [-f] [-m -b] [-t <timeout>] [-V]\n";
+ print "Usage: $0 [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>]) [-p <port>] [-P <protocol>] -w <warn level> -c <crit level> [-I|-N|-E] [-f] [-m -b] [-t <timeout>] [-V]\n";
}
sub isnnum { # Return true if arg is not a number
@@ -129,8 +130,14 @@ sub help {
-L, --protocols=<authproto>,<privproto>
<authproto> : Authentication protocol (md5|sha : default md5)
<privproto> : 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 <host> -C <snmp_community> [-2] | (-l login -x passwd) [-p <port>] -n <name> [-w <min_proc>[,<max_proc>] -c <min_proc>[,max_proc] ] [-m<warn Mb>,<crit Mb> -a -u<warn %>,<crit%> -d<delta> ] [-t <timeout>] [-o <octet_length>] [-f -A -F ] [-r] [-V] [-g]\n";
+ print "Usage: $0 [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd) [-p <port>] [-P <IP Protocol>] -n <name> [-w <min_proc>[,<max_proc>] -c <min_proc>[,max_proc] ] [-m<warn Mb>,<crit Mb> -a -u<warn %>,<crit%> -d<delta> ] [-t <timeout>] [-o <octet_length>] [-f -A -F ] [-r] [-V] [-g]\n";
}
sub isnotnum { # Return true if arg is not a number
@@ -166,6 +167,12 @@ sub help {
<privproto> : 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 <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>]) [-p <port>] -m <name in desc_oid> [-q storagetype] -w <warn_level> -c <crit_level> [-t <timeout>] [-T pl|pu|bl|bu ] [-r -s -i -G] [-e] [-S 0|1[,1,<car>]] [-o <octet_length>] [-R <% reserved>]\n";
+ print "Usage: $Name [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>]) [-p <port>] [-P <protocol>] -m <name in desc_oid> [-q storagetype] -w <warn_level> -c <crit_level> [-t <timeout>] [-T pl|pu|bl|bu ] [-r -s -i -G] [-e] [-S 0|1[,1,<car>]] [-o <octet_length>] [-R <% reserved>]\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

View file

@ -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" <info@space2place.de>
## 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

View file

@ -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" <chewieip@gmail.com>
## 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") {

View file

@ -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 <michael.friedrich@gmail.com>
## 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"};

View file

@ -1,121 +0,0 @@
From 846165c880793a97a2e727f4d13e23df40e8f1a4 Mon Sep 17 00:00:00 2001
From: morgajel <morgajel@gmail.com>
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);

View file

@ -1,509 +0,0 @@
From 83795bee374466b865a99af479d7cfa0e1ed1e08 Mon Sep 17 00:00:00 2001
From: Michael Friedrich <michael.friedrich@gmail.com>
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 [<perl script name> | AUTO <dir> <tmp_dir> <perl_dir> [<install_location>] ]
# 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 <dir> <tmp_dir> <perl_dir> [<install_location>]
@@ -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

View file

@ -1,22 +0,0 @@
From ee92d55bb36208a088a08864cc241e362134e711 Mon Sep 17 00:00:00 2001
From: casvcasv <carlosgrueso@gmail.com>
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;

View file

@ -1,63 +0,0 @@
From e684d56ab83e86d037403478c7245087e17f63b7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Lapie?= <darksoul@darkbsd.org>
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)) {

12
debian/patches/series vendored
View file

@ -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