We moved this page to our Documentation Portal. You can find the latest updates here. |
Question
How can I see in real time how saturated my interfaces/bonds are?
Answer
Take one of the following, and amend ***INTERFACE_NAME*** to your NIC/interface name that you want to check, paste it into your terminal on a server and it should show you the current traffic throughput in close to real time:
IFACE=***INTERFACE_NAME***; while true ; do raw0=`cat /proc/net/dev|grep $IFACE|awk -F':' '{print $2}'`;sleep 1; raw1=`cat /proc/net/dev|grep $IFACE|awk -F':' '{print $2}'`; r0=`echo $raw0|awk '{print $1}'` ; t0=`echo $raw0|awk '{print $9}'`; r1=`echo $raw1|awk '{print $1}'` ; t1=`echo $raw1|awk '{print $9}'`; echo -n "RX: $(( $(( $r1 - $r0 )) / 1048576 )) MB/s" ; echo -e "\t TX: $(( $(( $t1 - $t0 )) / 1048576 )) MB/s" ; done
Here are some pre-made examples for common interface names:
Eth0:
IFACE=eth0; while true ; do raw0=`cat /proc/net/dev|grep $IFACE|awk -F':' '{print $2}'`;sleep 1; raw1=`cat /proc/net/dev|grep $IFACE|awk -F':' '{print $2}'`; r0=`echo $raw0|awk '{print $1}'` ; t0=`echo $raw0|awk '{print $9}'`; r1=`echo $raw1|awk '{print $1}'` ; t1=`echo $raw1|awk '{print $9}'`; echo -n "RX: $(( $(( $r1 - $r0 )) / 1048576 )) MB/s" ; echo -e "\t TX: $(( $(( $t1 - $t0 )) / 1048576 )) MB/s" ; done
Eth1:
IFACE=eth1; while true ; do raw0=`cat /proc/net/dev|grep $IFACE|awk -F':' '{print $2}'`;sleep 1; raw1=`cat /proc/net/dev|grep $IFACE|awk -F':' '{print $2}'`; r0=`echo $raw0|awk '{print $1}'` ; t0=`echo $raw0|awk '{print $9}'`; r1=`echo $raw1|awk '{print $1}'` ; t1=`echo $raw1|awk '{print $9}'`; echo -n "RX: $(( $(( $r1 - $r0 )) / 1048576 )) MB/s" ; echo -e "\t TX: $(( $(( $t1 - $t0 )) / 1048576 )) MB/s" ; done
Eth2:
IFACE=eth2; while true ; do raw0=`cat /proc/net/dev|grep $IFACE|awk -F':' '{print $2}'`;sleep 1; raw1=`cat /proc/net/dev|grep $IFACE|awk -F':' '{print $2}'`; r0=`echo $raw0|awk '{print $1}'` ; t0=`echo $raw0|awk '{print $9}'`; r1=`echo $raw1|awk '{print $1}'` ; t1=`echo $raw1|awk '{print $9}'`; echo -n "RX: $(( $(( $r1 - $r0 )) / 1048576 )) MB/s" ; echo -e "\t TX: $(( $(( $t1 - $t0 )) / 1048576 )) MB/s" ; done
Bond0:
IFACE=bond0; while true ; do raw0=`cat /proc/net/dev|grep $IFACE|awk -F':' '{print $2}'`;sleep 1; raw1=`cat /proc/net/dev|grep $IFACE|awk -F':' '{print $2}'`; r0=`echo $raw0|awk '{print $1}'` ; t0=`echo $raw0|awk '{print $9}'`; r1=`echo $raw1|awk '{print $1}'` ; t1=`echo $raw1|awk '{print $9}'`; echo -n "RX: $(( $(( $r1 - $r0 )) / 1048576 )) MB/s" ; echo -e "\t TX: $(( $(( $t1 - $t0 )) / 1048576 )) MB/s" ; done
Bond1:
IFACE=bond1; while true ; do raw0=`cat /proc/net/dev|grep $IFACE|awk -F':' '{print $2}'`;sleep 1; raw1=`cat /proc/net/dev|grep $IFACE|awk -F':' '{print $2}'`; r0=`echo $raw0|awk '{print $1}'` ; t0=`echo $raw0|awk '{print $9}'`; r1=`echo $raw1|awk '{print $1}'` ; t1=`echo $raw1|awk '{print $9}'`; echo -n "RX: $(( $(( $r1 - $r0 )) / 1048576 )) MB/s" ; echo -e "\t TX: $(( $(( $t1 - $t0 )) / 1048576 )) MB/s" ; done
Bond2:
IFACE=bond2; while true ; do raw0=`cat /proc/net/dev|grep $IFACE|awk -F':' '{print $2}'`;sleep 1; raw1=`cat /proc/net/dev|grep $IFACE|awk -F':' '{print $2}'`; r0=`echo $raw0|awk '{print $1}'` ; t0=`echo $raw0|awk '{print $9}'`; r1=`echo $raw1|awk '{print $1}'` ; t1=`echo $raw1|awk '{print $9}'`; echo -n "RX: $(( $(( $r1 - $r0 )) / 1048576 )) MB/s" ; echo -e "\t TX: $(( $(( $t1 - $t0 )) / 1048576 )) MB/s" ; done