[rrd-users] Help -how to extract rrd data for script variables

Alex van den Bogaerdt alex at ergens.op.het.net
Sun Sep 9 14:25:44 CEST 2007


On Sun, Sep 09, 2007 at 09:37:16PM +1000, Rob Conway wrote:
> I was hoping someone could help me out in a script snippet (hopefully bash) in how to extract data from an rrd to be used within script variables.
> 
> example... I would like to get four variables that represented say max daily, min daily, avg daily and last value.  I do not want to plot a graph  just use the rrd database to extract the four pieces of information and place them in my script  variable so I can biuld a simple report  I already have the rrd's setup for max, min avg


To help you get started (you will need to work this further out, correct it):

prepare a graph command:

rrdtool graph whatever DEF:... CDEF:... and so on.
Then:   PRINT:myvar:shellvar1=%lf  PRINT:myothervar:shellvar2=%lf
 and so on

Then in bash:

eval $(rrdtool graph whatever DEF:.... and so on)

or

eval $(/path/to/graph/script)


HTH
-- 
Alex van den Bogaerdt
http://www.vandenbogaerdt.nl/rrdtool/



More information about the rrd-users mailing list