From: "Parsons, Scott" <sparsons@xxxxxxxxxxxxxx> > 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. Made mine by reading /proc/net/dev and comparing with the values of the previous check saved in a tmp file... basicaly: ( value - previousvalue ) / time If you do, watch out for tricky values (each 3 lines are 3 consecutive nagios checks, and the middle lines bug): No idea why they happen (maybe network driver bug?). # null value: # eth1:406480423 4248723190 0 0 0 0 0 0 3936994849 1479449504 0 0 0 0 0 0 # eth1: 0 3869683986 12714 0 0 12714 0 29853042 407203012 1509323306 0 0 0 0 0 0 # eth1:407977803 4248736776 0 0 0 0 0 0 3956304636 1479465887 0 0 0 0 0 0 # false cycled value: # eth1:1616399669 4273106787 0 0 0 0 0 17 1680717193 1514316105 0 0 0 0 0 0 # eth1: 68966782 1661804061 13218 0 0 13218 0 30344226 1618715737 1544705181 17 0 0 0 17 0 # eth1:1621560785 4273138758 0 0 0 0 0 17 1735041823 1514359042 0 0 0 0 0 0 # Mega value (32bits=4294967296 max, 64bits=18446744073709551616 max???): # Did not find an easy way to handle 64 bits exceptions... # So check if bp is realistic (< 100Mb/s on eth1 and 1Gb/s on eth0). # eth0:1547646696449 8147061470 0 930 0 0 0 6 4113045092950 8164215117 0 0 0 0 0 0 # eth0:16615907842663613929 8145771274 0 930 0 0 0 8164237729 17763115100 8165567515 16937 0 0 0 16937 0 # eth0:1547659651868 8147140907 0 930 0 0 0 6 4113088607337 8164294628 0 0 0 0 0 0 JD _______________________________________________ CentOS mailing list CentOS@xxxxxxxxxx http://lists.centos.org/mailman/listinfo/centos