Xymon Mailing List Archive search

Graph Network Usage

4 messages in this thread

list Jeff Stuart · Sun, 25 Jun 2006 06:04:13 -0700 ·
As we all know, you can use MRTG + SNMP to graph network usage.  BUT instead of having to install 2 new programs + an external hobbit script that runs either on each box or on a centralized location, you can use this external script that runs on the client.

Basically it just grabs the data from the /proc/net/dev file.  Note: this probably only works on Linux.

Then you add the following lines to your hobbitserver.cfg:

TEST2RRD="cpu=la,disk,inode,...,hobbitd,bandwidth=ncv"
NCV_bandwidth="bytesin:COUNTER,bytesout:COUNTER"
GRAPHS="la,disk,inode,...,hobbitd,ncv,bandwidth"

Then in your hobbitgraph.cfg, add this entry:

[bandwidth]
        TITLE Network Traffic
        YAXIS Bits/Second
        DEF:inbytes=bandwidth.rrd:bytesin:AVERAGE
        CDEF:in=inbytes,8,*
        DEF:outbytes=bandwidth.rrd:bytesout:AVERAGE
        CDEF:out=outbytes,8,*
        CDEF:total=in,out,+
        VDEF:pct95=total,95,PERCENT
        LINE2:in#00FF00:Inbound
        GPRINT:in:LAST: \: %9.1lf (cur)
        GPRINT:in:MAX: \: %9.1lf (max)
        GPRINT:in:MIN: \: %9.1lf (min)
        GPRINT:in:AVERAGE: \: %9.1lf (avg)\n
        LINE2:out#FF0000:Outbound
        GPRINT:out:LAST: \: %9.1lf (cur)
        GPRINT:out:MAX: \: %9.1lf (max)
        GPRINT:out:MIN: \: %9.1lf (min)
        GPRINT:out:AVERAGE: \: %9.1lf (avg)\n
        LINE2:total#00CCCC:Total Usage
        GPRINT:total:LAST: \: %8.1lf (cur)
        GPRINT:total:MAX: \: %8.1lf (max)
        GPRINT:total:MIN: \: %8.1lf (min)
        GPRINT:total:AVERAGE: \: %9.1lf (avg)\n
        LINE1:pct95#0000FF:Outbound 95th percentile
        GPRINT:pct95:\: %6.2lf %Sbps \n

And then finally setup this script as an external script for each client:

#!/bin/sh

/bin/grep eth0 /proc/net/dev | /bin/awk '{print "bytes_in : " $2 "\nbytes_out : " $10}' > $BBTMP/bandwidth.txt

$BB $BBDISP "status $MACHINE.bandwidth green `date`

`cat $BBTMP/bandwidth.txt`
"

/bin/rm $BBTMP/bandwidth.txt
exit 0

Hope this helps someone!  
P.S.
	Thx Henrik for your EXCELLENT tutorial on the NCV graph stuff.  Made my job a 1000x easier! :)  Also, in the next week, I'm gonna be blowing my boss's mind with some of the stuff I'll be able to track and graph.  Hehe.. there's just SOO MUCH you can do when you can do it on the command line vs a windows program that can only access stuff via SNMP/TCP/UDP probes.

-- 
Jeff Stuart
Network Admin MyInternetServices.com
1-800-300-HOST
list Charles Jones · Mon, 26 Jun 2006 09:52:50 -0700 ·
Have you tried any recent snapshots of Hobbit? It already creates an inbound,outbound Bits/second graph for all of your interfaces, as well as another graph which shows Packets/second (In,Out,& Retrans). I also like the Clock offset graph, which comes in handy for pointing out how poorly vmware instances keep their clocks synced :)

-Charles
quoted from Jeff Stuart

Jeff Stuart wrote:
As we all know, you can use MRTG + SNMP to graph network usage.  BUT instead of having to install 2 new programs + an external hobbit script that runs either on each box or on a centralized location, you can use this external script that runs on the client.

Basically it just grabs the data from the /proc/net/dev file.  Note: this probably only works on Linux.

Then you add the following lines to your hobbitserver.cfg:

TEST2RRD="cpu=la,disk,inode,...,hobbitd,bandwidth=ncv"
NCV_bandwidth="bytesin:COUNTER,bytesout:COUNTER"
GRAPHS="la,disk,inode,...,hobbitd,ncv,bandwidth"

Then in your hobbitgraph.cfg, add this entry:

[bandwidth]
       TITLE Network Traffic
       YAXIS Bits/Second
       DEF:inbytes=bandwidth.rrd:bytesin:AVERAGE
       CDEF:in=inbytes,8,*
       DEF:outbytes=bandwidth.rrd:bytesout:AVERAGE
       CDEF:out=outbytes,8,*
       CDEF:total=in,out,+
       VDEF:pct95=total,95,PERCENT
       LINE2:in#00FF00:Inbound
       GPRINT:in:LAST: \: %9.1lf (cur)
       GPRINT:in:MAX: \: %9.1lf (max)
       GPRINT:in:MIN: \: %9.1lf (min)
       GPRINT:in:AVERAGE: \: %9.1lf (avg)\n
       LINE2:out#FF0000:Outbound
       GPRINT:out:LAST: \: %9.1lf (cur)
       GPRINT:out:MAX: \: %9.1lf (max)
       GPRINT:out:MIN: \: %9.1lf (min)
       GPRINT:out:AVERAGE: \: %9.1lf (avg)\n
       LINE2:total#00CCCC:Total Usage
       GPRINT:total:LAST: \: %8.1lf (cur)
       GPRINT:total:MAX: \: %8.1lf (max)
       GPRINT:total:MIN: \: %8.1lf (min)
       GPRINT:total:AVERAGE: \: %9.1lf (avg)\n
       LINE1:pct95#0000FF:Outbound 95th percentile
       GPRINT:pct95:\: %6.2lf %Sbps \n

And then finally setup this script as an external script for each client:

#!/bin/sh

/bin/grep eth0 /proc/net/dev | /bin/awk '{print "bytes_in : " $2 "\nbytes_out : " $10}' > $BBTMP/bandwidth.txt

$BB $BBDISP "status $MACHINE.bandwidth green `date`

`cat $BBTMP/bandwidth.txt`
"

/bin/rm $BBTMP/bandwidth.txt
exit 0

Hope this helps someone!  
P.S.
	Thx Henrik for your EXCELLENT tutorial on the NCV graph stuff.  Made my job a 1000x easier! :)  Also, in the next week, I'm gonna be blowing my boss's mind with some of the stuff I'll be able to track and graph.  Hehe.. there's just SOO MUCH you can do when you can do it on the command line vs a windows program that can only access stuff via SNMP/TCP/UDP probes.

 
list Jeff Stuart · Mon, 26 Jun 2006 10:03:36 -0700 ·
Heheh no I hadn't.  Good to know that 4.2 has it built in.  
quoted from Charles Jones

On Monday 26 June 2006 9:52 am, Charles Jones wrote:
Have you tried any recent snapshots of Hobbit? It already creates an
inbound,outbound Bits/second graph for all of your interfaces, as well
as another graph which shows Packets/second (In,Out,& Retrans). I also
like the Clock offset graph, which comes in handy for pointing out how
poorly vmware instances keep their clocks synced :)

-Charles
-- 
Jeff Stuart
Network Admin 
MyInternetServices.com
1-800-300-HOST
list Nicolas Dorfsman · Mon, 26 Jun 2006 21:32:04 +0200 ·
quoted from Jeff Stuart
Le 26 juin 06 à 19:03, Jeff Stuart a écrit :
Heheh no I hadn't.  Good to know that 4.2 has it built in.

...and it has other wonderful surprises !


This software is the best monitoring tool I ever tried !
And it is just a beta ! How could be the RC version ?