Excellent plugin

Thank you for this excellent plugin !

You’ll find below a patch of my own, allowing to ignore warnings if ad_num is different from number of registered slave.
In most cases, people would prefer being warned, but in my case, the same 802.3ad is bound on 2 different switches, generating 2×2 802.3ad, with one being “master”, the 2 other links being “waiting” for a failure to become active.
This leads to being warned because 2 slaves over 4 seem to be missing in the active 802.3ad bonding, which is half true and half false.
I therefore don’t wan’t to be warned.

Regards,
Benjamin

— check_linux_bonding.orig 2012-07-24 10:52:55.973316334 +0200
+++ check_linux_bonding 2012-07-24 11:10:44.681319464 +0200
@@ -78,6 +78,7 @@
-n, –no-bonding Alert level if no bonding interfaces found [ok]
–slave-down Alert level if a slave is down [warning]
–disable-sysfs Don’t use sysfs (default), use procfs
+ –ignore-num-ad Don’t warn if num_ad_ports != num_slaves
-b, –blacklist Blacklist failed interfaces
-d, –debug Debug output, reports everything
-h, –help Display this help text
@@ -110,6 +111,7 @@
‘linebreak’ => undef,
‘verbose’ => 0,
‘disable_sysfs’ => 0,
+ ‘ignore_num_ad’ => 0,
‘slave_down’ => ‘warning’,
);

@@ -124,6 +126,7 @@
‘linebreak=s’ => $opt{linebreak},
‘v|verbose’ => $opt{verbose},
‘disable-sysfs’ => $opt{disable_sysfs},
+ ‘ignore-num-ad’ => $opt{ignore_num_ad},
‘slave-down=s’ => $opt{slave_down},
) or do { print $USAGE; exit $E_UNKNOWN };

@@ -490,7 +493,7 @@
$b, $bonding{$b}{mode};
report($msg, $E_CRITICAL);
}
– elsif (defined $bonding{$b}{ad_num} and $bonding{$b}{ad_num} != scalar keys %slave) {
+ elsif ($opt{ignore_num_ad} == 0 and defined $bonding{$b}{ad_num} and $bonding{$b}{ad_num} != scalar keys %slave) {
my $msg = sprintf ‘Bonding interface %s [%s]: Number of AD ports (%d) does not equal the number of slaves (%d)’,
$b, $bonding{$b}{mode}, $bonding{$b}{ad_num}, scalar keys %slave;
report($msg, $E_WARNING);