Thursday 18 April 2013

Script to show Etherchannel "Tree" view on AIX


Here is a short script to show a "tree" view of Etherchannel devices on AIX.   It shows the devices that make up the etherchannel, including the backup device if there is one:

  
Here is the script:
#!/usr/bin/ksh
for ec in `lsdev | grep ^ent | grep -i etherchannel | awk '{print $1}'`; do
        echo "$ec - Etherchannel device";
        for adapter in `lsattr -El $ec -a adapter_names | awk '{print $2}' | tr "," " "`; do
                echo "  `lscfg -l $adapter`"
        done
        backup=`lsattr -El $ec -a backup_adapter 2>/dev/null | awk '{print $2}'`
        [ "$backup" != "" -a "$backup" != "NONE" ] && echo "**`lscfg -l $backup` ** Backup Adapter"
        echo
done

1 comment: