[rrd-users] couple of questions

Simon Hobson linux at thehobsons.co.uk
Wed Sep 8 21:23:36 CEST 2010

Ricardo Kleemann wrote:

>Is it possible to generate graphs on the fly to the browser without 
>actually generating a file on the server?

I started off trying to use rrdtool in filter mode, but it lacked the 
flexibility I wanted. In the end I wrote scripts (in BASH) to 
generate the rrdtool code, create a png file on disk, and then send 
that out with the right headers for the browser to display it as an 
image. I use the --lazy option so rrdtool won't rebuild the image if 
it's recent.

Why do you want to avoid creating a file ? If it's just a case of not 
having them around, then you could delete the file after it's been 
sent. Or you could have a cron job to clean up any images more than a 
certain age.

>I would like to also display an accumulated counter (say total 
>bandwidth for the month), how would I do that on the graph and on 
>the rrd table?

By calendar month, or by period ? I've just added that to some of my 
graphs. While the script if parsing options and setting variables 
(specifically end and start times), I also set a variable for the 
accumulator period* I have separate CDEFs etc that will get the 
average for that period, multiply by the accumulator period (eg 86400 
for 24 hours), and then display the result.

* My graphs aren't the same periods - for example, my "month" 
actually shows about 6 weeks, it's just the way the number of pixels 
and consolidation periods works out.

Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.

More information about the rrd-users mailing list