[CentOS] Network Utilization

Mon Jul 6 16:32:39 UTC 2009
nate <centos at linuxpowered.net>

Parsons, Scott wrote:
> I'm attempting to create a script that will indicate the % utilization
> of a network interface. I need this to export a one shot output that can
> be called by nagios.
> I've tried the following tools but I was unable to find a way to output
> just the utilization, and just one time: bmon, iftop, ifstat, bwm,
> dstat, rrdtool, iptraf.

Get the interface counters for the interface, sleep 5 seconds(or more),
get them again, calculate the difference taking into account interface
speed and you can determine the % utilization that way.

I use SNMP and use these OIDs:

. = IF-MIB::ifInOctets.2
. = IF-MIB::ifOutOctets.2
. = IF-MIB::ifInOctets.3
. = IF-MIB::ifOutOctets.3