#!/bin/ksh # $Id: bond,v 1.1 2011/12/07 20:51:03 ksb Exp $ # Output the Linux (at least) bonding information (ksb) # Tom Swan helped with the data source, the manual page for ip # doesn't have a form for just "ip addr"? # TODO: proccess other OS's bonding binding lists for more power. #****p* netlint/bond # NAME # bond # DESCRIPTION # Output the relationship between bonding interfaces and subordinates. #*** PROGNAME=`basename $0` : ${CARP:=echo} if [ _"$1" = _"-V" ]; then echo "$PROGNAME: "'$Id: bond,v 1.1 2011/12/07 20:51:03 ksb Exp $' exit 0 fi export CARP # We only work with this tool install, which means Linux mostly --ksb # We could look for /proc/net/bonding/ files, but that's grosser. [ -x /sbin/ip ] || exit 0 # Example output from $ ip addr | grep " master " # 3: eth3: <...> mtu 9000 qdisc pfifo_fast master bond1 qlen 1000 # 4: eth4: <...> mtu 9000 qdisc pfifo_fast master bond1 qlen 1000 # 6: eth0: <...> mtu 1500 qdisc pfifo_fast master bond0 qlen 1000 # 7: eth1: <...> mtu 1500 qdisc pfifo_fast master bond0 qlen 1000 /sbin/ip addr | tr -s '\t ' ' ' | sed -n -e 's/^[^:]*: \([^:]*[0-9]\):.*master \([^ ]*\) .*/\2 \1/p' | awk ' { Name[$1] = Name[$1]","$2; } END { for (i in Name) { print("INTEFACE_BOND:", i, substr(Name[i], 2)); } }' | xapply -f '$CARP "%q1"' - #****a* bond/INTERFACE_BOND # NAME # INTERFACE_BOND # FORMAT # INTERFACE_BOND: bond-interface slave1,slave2... # DESCRIPTION # The topology of the bonded network interfaces. # # This reporter makes it clear which bonded interfaces are slaved # to each bonding drvier instance. # IMPACT # This helps build interface.cl, no additional usage is expected. # REMEDIATION # None. If a bonded interface is missing, that's site policy (hostlint). #*** exit 0