Random Project

Bonding driver changed in linux 3.13

Hi everyone,

Thank you for the nice Nagios plugin and the good work.
Here is my patch for version 1.3.2 after bonding driver changed in Linux 3.13.0.

Tested on Ubuntu (Linux 3.13.0-52-generic #86~precise1-Ubuntu SMP Tue May 5 18:08:21 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux):

I installed liblinux-kernelsort-perl to be able to compare kernel versions.

sudo apt-get install liblinux-kernelsort-perl

Then patch check_linux_bonding.

@@ -25,6 +25,7 @@ use strict;
use warnings;
use POSIX qw(isatty);
use Getopt::Long qw(:config no_ignore_case);
+use Linux::KernelSort;

# Global (package) variables used throughout the code
use vars qw( $NAME $VERSION $AUTHOR $CONTACT $E_OK $E_WARNING $E_CRITICAL
@@ -255,6 +256,15 @@ sub find_bonding_sysfs {
my $masters_file = “$sysdir/bonding_masters”;
my @bonds = ();
my %bonding = ();
+ my $device;
+ my $kernel = new Linux::KernelSort;
+ my ($kernver, @rest) = split(‘-‘, `uname -r`);
+ my $retcmp = $kernel->compare($kernver,”3.13.0″);
+ if ( $retcmp >= 0 ) {
+ $device = “lower”;
+ } else {
+ $device = “slave”;
+ }

if (! -f $masters_file) {
return {};
@@ -311,8 +321,8 @@ sub find_bonding_sysfs {

# get slave status
foreach my $slave (@slaves) {
– open my $STATE, ‘