9

I have set up two interfaces as bonding slaves (eth0 and eth1 bonded as bond0). How are people monitoring the status of the slaves?

How are you notified if the link fails on one interface? Do you poll something in /sys/class/net/bond0 or /proc/net/bonding/bond0 ? Is there a daemon I can configure to get notifications?

Some context: I'm running SUSE 11 server SP1 and I'm not interested in any graphical tool as this server is not running X11.

4

There are some ways to do this:

  1. As you mentioned, query status from /proc/net/bonding/bond0:

    if [ `grep -c down /proc/net/bonding/bond0` -eq 1 ]; then
        echo "`date +%c`" | \
        mail -s "$(grep -B1 down /proc/net/bonding/bond0 | head -1 | \
        awk -F': ' '{ print $2 }') is down" your@email.address 
    fi
    
  2. Nagios's check_linux_bonding plugin.

  3. SNMP.

  • This will work only if 1 slave is down but you might want to receive e-mails if all of 2 slaves or 2 of 3 or more slaves are down. I suggest if fgrep -q down /proc/net/bonding/bond0 to check for any occurrence of down. – Daniel Böhmer Nov 7 '17 at 15:56
  • In the end I put fgrep -C999 down /proc/net/bonding/bond0 || true in my crontab which will simply send the whole file content if down was found. – Daniel Böhmer Nov 7 '17 at 16:04
1

If you are doing bonding, check /proc/net/bonding/bond0.

You should see something like this

Ethernet Channel Bonding Driver: v3.7.0 (June 2, 2010)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0d:60:d4:a3:00
Slave queue ID: 0

Slave Interface: eth1
MII Status: up
Speed: 100 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0d:60:d4:a3:01
Slave queue ID: 0

I just check to see if the Currently Active slave has changed or not.

Also if you are just looking to see if link is lost on one of your NIC's, you can still do that though SNMP or other standard forms of monitoring.

0

I haven't any Suse here to test the command. In fedora/redhat I use "ethtool slave_device_name" http://en.wikipedia.org/wiki/Ethtool and i see "Link detected:" parameter.

0

Under Nagios I used check_ifoperstatus on each of the slave interfaces which performs an SNMP query to 1.3.6.1.2.1.2.2.1.8 in the IF-MIB.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.