[rrd-users] Resolution of .png image being printed to STDOUT with 'rrdtool graph'

Simon Hobson linux at thehobsons.co.uk
Sat Jan 15 09:26:09 CET 2011

David Ball wrote:

>   Is there a way I can convince 'rrdtool graph' to *not* print out 
>the resolution of the resulting image to STDOUT ?  I tried toying 
>with the --imginfo knob to no avail.  I'm trying to generate a .png, 
>then I print out a bunch of HTML which includes an IMG SRC tag 
>pointing to the image I just generated.  But the fact that the 
>image's resolution is being printed when I make the call to 'rrdtool 
>graph', it's bunging up my HTML (cuz I haven't printed Content-type: 
>text/html  yet).

How about :
   rrdtool graph ... > /dev/null 2>&1

Works for me.

I do something similar, a load of code that generates an image file 
(silently), then outputs a header and 'cat's the file out - I now use 
image links in my page code that calls a cgi to dynamically create 
each image. That allows me to mix and match images on a page without 
re-writing any code, and also means multiple images are generated in 
Because of the complexity of some of my images, I've settled on using 
rrdcgi so my code can be like this :

   echo options
   echo more options
   echo still more options
   echo and so on
) | rrdcgi --filter >/dev/null

In many cases, the options are dynamically created with while or for 
loops, and of course influenced by the parameters requested. When you 
are stacking 500+ areas, and printing over 1k items in the legend, 
then that lot won't necessarily fit in the command line buffer of the 
shell !

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