[rrd-users] embedding multiple rrdtool SVG into web page on the fly

Tobias Oetiker tobi at oetiker.ch
Sat Oct 3 06:55:48 CEST 2009


Hi Reinhard,

Today Reinhard Scheck wrote:

> Hi all,
> when using rrdtool graph --imgformat=SVG, the resulting file looks fine and can
> be displayed in my browser using rrdtool 1.3.8 (F11, 64 bit, distro package).
>
> Now, when creating a web page in cacti, graph generation is done in parallel by
> using
> <img ... src='php file to generate rrdtool commands'>
> multiple time.
>
> This was changed to
> <object ... data='php file to generate rrdtool commands'>
> for SVG, but that breaks. Wireshark trace shows, that the plain file is
> preceeded and prepended by a number. Here's part of the TCP stream returned by
> the server for the output of that php (see the numbers 2000 and 106581?):
>
> >
> > HTTP/1.1 200 OK
> > Date: Fri, 02 Oct 2009 21:01:38 GMT
> > Server: Apache/2.2.13 (Fedora)
> > X-Powered-By: PHP/5.2.9
> > Expires: Mon, 26 Jul 1997 05:00:00 GMT
> > Cache-Control: no-store, no-cache, must-revalidate
> > Pragma: no-cache
> > Last-Modified: Fri, 02 Oct 2009 21:01:38 GMT
> > Cache-Control: post-check=0, pre-check=0
> > P3P: CP="CAO PSA OUR"
> > Keep-Alive: timeout=15, max=88
> > Connection: Keep-Alive
> > Transfer-Encoding: chunked
> > Content-Type: image/svg+xml; charset=utf-8
> >
> > 2000
> > <?xml version="1.0" encoding="UTF-8"?>
> > ....
> > </svg>
> > 106581
> > 0
>
> The same numbers appear when using PNG imgformat, but they don't seem to break
> displaying the image. When using
> <object class=... data='SVG file generated by manually running rrdtool'>
> everything looks fine.
> Does that ring a bell?

the numbers look like the numbers you get on stdout when running
rrdtool by hand ... I don't know why they show up in cacti ... must
be the way rrdtool is called here ... the most portable way of
handling this is to first write the graph to a file and then read
it back from there ...

rrdtool 1.3 support the graphv command which returns data in a more
structured way ... but you will need the new php bindings done by
benny for this ...

cheers
tobi

>
> Reinhard
>
> _______________________________________________
> rrd-users mailing list
> rrd-users at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
>
>

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi at oetiker.ch ++41 62 775 9902 / sb: -9900



More information about the rrd-users mailing list