diff --git a/debian/patches/23_check_snmp_int_interface_speed b/debian/patches/23_check_snmp_int_interface_speed new file mode 100644 index 0000000..a6db7cf --- /dev/null +++ b/debian/patches/23_check_snmp_int_interface_speed @@ -0,0 +1,138 @@ +diff --git a/doc/04-Plugins.md b/doc/04-Plugins.md +index c08fe9c..bf2a593 100644 +--- a/doc/04-Plugins.md ++++ b/doc/04-Plugins.md +@@ -207,13 +207,13 @@ Usage: ./check_snmp_int.pl [-v] -H -C [-2] | (-l login - + -G : Make the warning and critical levels in Gbps (with -B) or GBps + -M : Make the warning and critical levels in Mbps (with -B) or MBps + -u : Make the warning and critical levels in % of reported interface speed. +--w, --warning=input,output[,error in,error out,discard in,discard out] ++-w, --warning=input,output[,error in,error out,discard in,discard out,interface speed] + warning level for input / output bandwidth (0 for no warning) +- unit depends on B,M,G,u options ++ unit depends on B,M,G,u options and interface speed is in bps + warning for error & discard input / output in error/min (need -q) +--c, --critical=input,output[,error in,error out,discard in,discard out] ++-c, --critical=input,output[,error in,error out,discard in,discard out,interface speed] + critical level for input / output bandwidth (0 for no critical) +- unit depends on B,M,G,u options ++ unit depends on B,M,G,u options and interface speed is in bps + critical for error & discard input / output in error/min (need -q) + -s, --short=int + Make the output shorter : only the first chars of the interface(s) +diff --git a/doc/html/nagios.manubulon.com/snmp_int.html b/doc/html/nagios.manubulon.com/snmp_int.html +index 8274a05..1c5f68f 100644 +--- a/doc/html/nagios.manubulon.com/snmp_int.html ++++ b/doc/html/nagios.manubulon.com/snmp_int.html +@@ -337,13 +337,14 @@ +

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

+

-k : activates the standard usage feature
+ -q : activates the extended usage
+diff --git a/plugins/check_snmp_int.pl b/plugins/check_snmp_int.pl +index 71f8d14..d978c66 100755 +--- a/plugins/check_snmp_int.pl ++++ b/plugins/check_snmp_int.pl +@@ -262,11 +262,11 @@ sub help { + -G : Make the warning and critical levels in Gbps (with -B) or GBps + -M : Make the warning and critical levels in Mbps (with -B) or MBps + -u : Make the warning and critical levels in % of reported interface speed. +--w, --warning=input,output[,error in,error out,discard in,discard out] ++-w, --warning=input,output[,error in,error out,discard in,discard out,interface speed] + warning level for input / output bandwidth (0 for no warning) + unit depends on B,M,G,u options + warning for error & discard input / output in error/min (need -q) +--c, --critical=input,output[,error in,error out,discard in,discard out] ++-c, --critical=input,output[,error in,error out,discard in,discard out,interface speed] + critical level for input / output bandwidth (0 for no critical) + unit depends on B,M,G,u options + critical for error & discard input / output in error/min (need -q) +@@ -452,8 +452,8 @@ sub check_options { + } + if (defined($o_checkperf)) { + @o_warn = split(/,/, $o_warn_opt); +- if (defined($o_ext_checkperf) && ($#o_warn != 5)) { +- print "6 warning levels for extended checks \n"; ++ if (defined($o_ext_checkperf) && (($#o_warn < 5) || ($#o_warn > 6))) { ++ print "6 or 7 warning levels for extended checks err val: $#o_warn \n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } +@@ -465,8 +465,8 @@ sub check_options { + @o_crit = split(/,/, $o_crit_opt); + + #verb(" $o_crit_opt :: $#o_crit : @o_crit"); +- if (defined($o_ext_checkperf) && ($#o_crit != 5)) { +- print "6 critical levels for extended checks \n"; ++ if (defined($o_ext_checkperf) && (($#o_crit < 5) || ($#o_crit > 6))) { ++ print "6 or 7 critical levels for extended checks err val: $#o_crit \n"; + print_usage(); + exit $ERRORS{"UNKNOWN"}; + } +@@ -476,10 +476,18 @@ sub check_options { + exit $ERRORS{"UNKNOWN"}; + } + for (my $i = 0; $i <= $#o_warn; $i++) { +- if (($o_crit[$i] != 0) && ($o_warn[$i] > $o_crit[$i])) { +- print "Warning must be < Critical level \n"; +- print_usage(); +- exit $ERRORS{"UNKNOWN"}; ++ if ($i != 6) { ++ if (($o_crit[$i] != 0) && ($o_warn[$i] > $o_crit[$i])) { ++ print "Warning must be < Critical level \n"; ++ print_usage(); ++ exit $ERRORS{"UNKNOWN"}; ++ } ++ } else { ++ if (($o_crit[$i] != 0) && ($o_warn[$i] < $o_crit[$i])) { ++ print "Warning must be > Critical level \n"; ++ print_usage(); ++ exit $ERRORS{"UNKNOWN"}; ++ } + } + } + if ( (defined($o_meg) && defined($o_gig)) +@@ -946,6 +954,18 @@ sub check_options { + } + if ($l == 0 || $l == 1) { $print_out .= $speed_unit; } + } ++ if (defined($o_perfs) && defined($o_ext_checkperf)) { ++ $print_out .= "/"; ++ if (defined($o_crit[6]) && ($o_crit[6] != 0) && ($speed_real < $o_crit[6])) { ++ $final_status = 2; ++ $print_out .= sprintf("CRIT %.0fbps", $speed_real); ++ } elsif (defined($o_warn[6]) && ($o_warn[6] != 0) && ($speed_real < $o_warn[6])) { ++ $final_status = ($final_status == 2) ? 2 : 1; ++ $print_out .= sprintf("WARN %.0fbps", $speed_real); ++ } else { ++ $print_out .= sprintf("%.0fbps", $speed_real); ++ } ++ } + $print_out .= ")"; + } else { # Return unknown when no data + $print_out .= " No usable data on file (" . $n_rows . " rows) "; +@@ -1039,7 +1059,10 @@ sub check_options { + } + if (defined($o_perfs)) { + $speed_real = "" unless (defined($speed_real)); +- $perf_out .= "'" . $descr[$i] . "_speed_bps'=" . $speed_real . " "; ++ $perf_out .= "'" . $descr[$i] . "_speed_bps'=" . $speed_real . ";"; ++ $perf_out .= defined($o_warn[6]) ? $o_warn[6] . ";" : ";"; ++ $perf_out .= defined($o_crit[6]) ? $o_crit[6] . ";" : ";"; ++ $perf_out .= "; "; + } + if (defined($o_weather) && $usable_data == 1) { + $perf_out .= "in=" . sprintf("%.0f", $checkperf_out_raw[0]) . ";;;0;" . sprintf("%.0f", $speed_real / 8) . " "; diff --git a/debian/patches/series b/debian/patches/series index 7d425b5..9aee06e 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -11,5 +11,6 @@ 20_check_snmp_int_avaid_huge_amount_of_regex 21_check_snmp_load_update_fortiswitch_and_fortigate4.3 22_check_snmp_storage_fix_space_btrfs +23_check_snmp_int_interface_speed 50_disable_epn 51_fix_privacy_doc