Adding d/p/23_check_snmp_int_interface_speed from upsgtream
This commit is contained in:
parent
05b203575a
commit
67af3233b6
2 changed files with 139 additions and 0 deletions
138
debian/patches/23_check_snmp_int_interface_speed
vendored
Normal file
138
debian/patches/23_check_snmp_int_interface_speed
vendored
Normal file
|
@ -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 <host> -C <snmp_community> [-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 <n> 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 @@
|
||||
<p class="SectionBody">When the extended checks are activated (-q
|
||||
option), the warning levels are <br>
|
||||
-w <i><In bytes></i>,<i><Out bytes></i>,<i><In error></i>,<i><Out
|
||||
- error>,<i><In disc></i>,<i><Out disc></i></i> -c
|
||||
+ error>,<i><In disc></i>,<i><Out disc></i>,<i><Interface speed></i></i> -c
|
||||
<i><In warn></i>,<i><Out warn></i>, .....<br>
|
||||
In error : warn/crit level in inboud <b>error/minute<br>
|
||||
</b>Out error : warn/crit level in outbound error/minute<b> </b><br>
|
||||
In disc : warn/crit level in inboud <b>discarded packets/minute<br>
|
||||
- </b>Out disc : warn/crit level in outbound discarded packets/minute<b>
|
||||
- </b><br>
|
||||
+ </b>Out disc : warn/crit level in outbound discarded packets/minute<b> </b><br>
|
||||
+ Interface speed : warn/crit level of Interface speed <b>discarded bits/second<br>
|
||||
+ </b>
|
||||
</p>
|
||||
<p class="SectionBody"><b>-k</b> : activates the standard usage feature<br>
|
||||
<b>-q</b> : activates the extended usage<br>
|
||||
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) . " ";
|
1
debian/patches/series
vendored
1
debian/patches/series
vendored
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue