[rrd-users] rrd python help needed.

Larry Low llow at telesphere.com
Mon Dec 29 21:52:52 CET 2008


> On Fri, 2008-12-26 at 14:29 -0800, Jeremiah Jester wrote:
> >
> >         rrdtool.create('test.rrd' ,
> >                  '--start' , str(stime),
> >                  #### can sepcify end time below
> >                  # '--end' , str(endtime)
> >                  #add DS for another line element
> >                  'DS:speed:COUNTER:600:U:U',
> >                  'DS:average:GAUGE:600:U:U',
> >                  'DS:min:COUNTER:600:U:U',
> >                  'RRA:AVERAGE:0.5:1:576',
> >                  'RRA:AVERAGE:0.5:6:336'
> >         )

You should only run this once to create the initial graph.

> >         #LASTLY, GRAPH THE UPDATED DATA
> >         rrdtool.graph(gfname ,
> >                 '--start' , str(etime - (24 * 3600)) ,
> >                 '--end' , str(etime) ,
> >                 '--vertical-label' , 'CPU Load' ,
> >                 '--imgformat' , 'PNG' ,
> >                 '--title' , 'System Load Average' ,
> >                 '--lower-limit' , '0' ,
> >
> >                 'DEF:myspeed=%s:speed:AVERAGE' % fname ,
> >
> >                 'CDEF:mph=myspeed,3600,*' ,
> >                 'VDEF:msmax=mph,MAXIMUM' ,
> >                 'VDEF:msavg=mph,AVERAGE' ,
> >                 'VDEF:msmin=mph,MINIMUM' ,
> >
> >                 #lines
> >                 'LINE1:%s#CC9999:Net1' % a,
> >                 'LINE2:%s#FF0000:Net2' % b,
> >                 'LINE3:%s#FFDDDD:Net3' % c,
> >
> >                 #r'GPRINT:msmax:Max\: %6.1lf Load' ,
> >                 #r'GPRINT:msavg:Avg\: %6.1lf Load' ,
> >                 #r'GPRINT:msmin:Min\: %6.1lf Load\l' ,
> >         )

You are graphing values.  You need to graph the datasources within your rrd file.

'LINE1:myspeed#CC9999:Net1'

You are storing 3 values into your rrd.   Stat 0 is going in as "speed", Stat 1 is going in as "average", Stat 2 is going in as "min".  I'm not sure if this is what you are intending.

If you need help understanding what's going on you should take a look at programs like cacti to get a good understanding of rrdtool and how it is used.



More information about the rrd-users mailing list