Create a Post
Showing results for 
Search instead for 
Did you mean: 

One-Liner for status summary of all configured bonds

I've created a one-liner to get a simple status summary of all configured bonds. Probable it helps someone:

ls /proc/net/bonding/ | while read BOND_NAME; do BOND_STATE=`cat /proc/net/bonding/$BOND_NAME|grep Status|head -1|cut -d":" -f2`; SLAVE_CNT=`cat /proc/net/bonding/$BOND_NAME|grep "Slave Interface"|wc -l`; ACTIVE_SLAVE_CNT=`cat /proc/net/bonding/$BOND_NAME|grep -A1 "Slave Interface"|grep "Status: up"|wc -l`; echo "$BOND_NAME:$BOND_STATE ($ACTIVE_SLAVE_CNT/$SLAVE_CNT members up)"; done;

Sample  output:

bond0: up (2/2 members up)
bond1: up (2/2 members up)
bond2: down (0/2 members up)
bond3: down (0/0 members up)

Successfully tested on R80.20 and R81.10

0 Kudos
2 Replies
This widget could not be displayed.