[rrd-users] display graphs generated with python bindings in html
Clemens Weninger
clemens_weninger at gmx.net
Tue Dec 15 10:18:55 CET 2009
On Tuesday 15 December 2009 00:55:26 Michael P. Soulier wrote:
> On 15/12/09 Jean-Yves Avenard said:
> > You should have a look at the pylons framework ; which let you do
> > stuff like that quite easily.
> >
> > Otherwise, you can't modify html headers directly, as least not as
> > easily as with PHP
>
> If this is Django then I must disagree. Modifying the headers is trivial.
>
> I would not rely on rrdtool to send http headers, capture the output of
> rrdtool in a buffer in memory, and then customize your response object in
> Django.
>
> ie.
>
> response = HttpResponse(mimetype="image/jpg")
> response.write(buffer)
> return response
>
> Not really an rrdtool question though.
>
> Mike
>
Hi,
ok thanks for that tip, I can easily modify the headers now. But a problem
that remains is how to get the image in the buffer?
I would like to call:
#!/usr/bin/python
import rrdtool
rrdtool.graph('-', <further options>) # that should go into buffer
response = HttpResponse(mimetype="image/jpg")
response.write(buffer)
return response
but that goes directly to stdout. I tried to redirect stdout to a buffer but I
couldn't get it to work.
Clemens
More information about the rrd-users
mailing list