Please note: This project is no longer active. The website is kept online for historic purposes only.
If you´re looking for a Linux driver for your Atheros WLAN device, you should continue here .

Changes from Version 1 of UserDocs/Tools/rrdtooSnmpget

Author:
Duncan Webb <duncan-wifi@linuxowl.com> (IP: 0.0.0.0)
Timestamp:
08/20/06 15:28:25 (13 years ago)
Comment:

Initial version

Legend:

Unmodified
Added
Removed
Modified
  • UserDocs/Tools/rrdtooSnmpget

    v v1  
     1= Graphing Bandwidth with snmpget and rrdtool = 
     2 
     3Using the snmpget and rrdtool to log the input and output data throughput. Then view the captured data. 
     4 
     5== Output == 
     6The graph from the wifi-daily.png will look similar to this: 
     7![[Image(wifi-bandwidth.png)]] 
     8 
     9== Create == 
     10First create a rrdtool database using: 
     11 
     12{{{ 
     13#! /bin/bash 
     14# create-bandwidth.sh 
     15 
     16# check every 5 minutes for 7 days 
     17rrdtool create /var/lib/sensord/bandwidth.rrd --start N \ 
     18  DS:in:COUNTER:600:U:U \ 
     19  DS:out:COUNTER:600:U:U \ 
     20  RRA:AVERAGE:0.5:1:2016 
     21}}} 
     22 
     23If you wish to graph the data more or less frequently then change 2016 and 600. 
     242016 is calculated by 7 days * 24 hours * 60 minutes / 5 minutes per update. 
     25600 is 10 minutes * 60 seconds and represents that when no data is added in 600 seconds then there is a break in the output.  
     26 
     27== Update == 
     28 
     29Add a script to update the rrdtool database 
     30 
     31{{{ 
     32#! /bin/bash 
     33# update-bandwidth.sh 
     34 
     35# check every 5 minute for 7 days 
     36/usr/bin/rrdupdate /var/lib/sensord/bandwidth.rrd \ 
     37  N:\ 
     38  $(/usr/bin/snmpget -v 1 -c public -Oqv localhost IF-MIB::ifInOctets.4):\ 
     39  $(/usr/bin/snmpget -v 1 -c public -Oqv localhost IF-MIB::ifOutOctets.4) 
     40}}} 
     41 
     42Then capture that data every minute with a cron job 
     43 
     44{{{ 
     45*/5 * * * * update-bandwidth.sh 
     46}}} 
     47 
     48== Generate Graph == 
     49 
     50Graphing with python and the rrdtool module 
     51 
     52{{{ 
     53#! /usr/bin/python 
     54# graph-quality.py 
     55 
     56import rrdtool 
     57 
     58# Generate a graph of the last 24 hours of the data throughput 
     59rrdtool.graph('/usr/share/freevo/htdocs/sensors/pix/day-net-ath0.png', 
     60    '--imgformat', 'PNG', 
     61    '--height', '200', '--width', '800', 
     62    '--lazy', 
     63    '--title', 'Day Network Load (ath0)', 
     64    '--vertical-label', 'Data Throughput', 
     65    '--start', '-1days', 
     66    '--x-grid', 'HOUR:1:HOUR:3:HOUR:3:0:%b %d %H:00', 
     67    'DEF:in=/var/lib/sensord/bandwidth.rrd:in:AVERAGE', 
     68    'DEF:out=/var/lib/sensord/bandwidth.rrd:out:AVERAGE', 
     69    'CDEF:kbin=in,1024,/', 
     70    'CDEF:kbout=out,1024,/', 
     71    'AREA:in#00FF00:Bandwidth In', 
     72    'LINE1:out#0000FF:Bandwidth Out\j', 
     73    'GPRINT:kbin:LAST:Last Bandwidth In\:     %5.2lf Kbps', 
     74    'GPRINT:kbout:LAST:Last Bandwidth Out\:    %5.2lf Kbps\j', 
     75    'GPRINT:kbin:AVERAGE:Average Bandwidth In\:  %5.2lf Kbps', 
     76    'GPRINT:kbout:AVERAGE:Average Bandwidth Out\: %5.2lf Kbps\j') 
     77 
     78# Generate a graph of the last 7 days of the data throughput 
     79rrdtool.graph('/usr/share/freevo/htdocs/sensors/pix/week-net-ath0.png', 
     80    '--imgformat', 'PNG', 
     81    '--height', '200', '--width', '800', 
     82    '--lazy', 
     83    '--title', 'Week Network Load (ath0)', 
     84    '--vertical-label', 'Data Throughput', 
     85    '--start', '-1week', 
     86    '--x-grid', 'HOUR:6:DAY:1:DAY:1:86400:%a %b %d', 
     87    'DEF:in=/var/lib/sensord/bandwidth.rrd:in:AVERAGE', 
     88    'DEF:out=/var/lib/sensord/bandwidth.rrd:out:AVERAGE', 
     89    'CDEF:kbin=in,1024,/', 
     90    'CDEF:kbout=out,1024,/', 
     91    'AREA:in#00FF00:Bandwidth In', 
     92    'LINE1:out#0000FF:Bandwidth Out\j', 
     93    'GPRINT:kbin:LAST:Last Bandwidth In\:     %5.2lf Kbps', 
     94    'GPRINT:kbout:LAST:Last Bandwidth Out\:    %5.2lf Kbps\j', 
     95    'GPRINT:kbin:AVERAGE:Average Bandwidth In\:  %5.2lf Kbps', 
     96    'GPRINT:kbout:AVERAGE:Average Bandwidth Out\: %5.2lf Kbps\j') 
     97}}} 
     98 
     99The command line version of graph is similar to above.