How do people monitor the status of bonding slave interfaces on linux?
Solution 1:
There are some ways to do this:
-
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" [email protected] fi
Nagios's check_linux_bonding plugin.
SNMP.
Solution 2:
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.
Solution 3:
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.