[rrd-users] SOLVED Re: corrupted PNG files coming out of cacti/apache

C. Falconer cfalconer at totalteam.co.nz
Fri Aug 26 07:05:29 CEST 2011


I fixed my problem.  Here's the answer, for those who might come later. 
   So it wasn't rrdtool, and it also wasn't apache or cacti.  The 
problem was in php.ini - PHP corrupted the data produced by rrdtool.


; Magic quotes for runtime-generated data, e.g. data from SQL, from 
exec(), etc.
magic_quotes_runtime = Off


And that's all it was.



C. Falconer wrote, On 11/22/2010 03:50 PM:
> I've had a problem for the past couple of months and its not obvious
> what's at fault. I'm reasonably sure its not rrdtool though.
>
> -----------
> Problem: Cacti shows no graphs.
>
> If I get the rrdtool command line out of cacti's "graph debug" section,
> and run that at the command line then I get the file at
> http://criggie.org.nz/crap/cacti-good.png
>
> RRDTool Command:
> /usr/bin/rrdtool graph - --imgformat=PNG --start=-86400 --end=-300
> --title='testhing for CF 3T - Ping Latency' --base=1000 --height=120
> --width=800 --alt-autoscale-max --lower-limit=0
> --vertical-label='milliseconds' --slope-mode --font TITLE:9: --font
> AXIS:8: --font LEGEND:8: --font UNIT:8:
> DEF:a="/var/www/html/cacti/rra/testhing_for_cf_3t_ping_1053.rrd":ping:AVERAGE
> AREA:a#FFF200FF:""
> GPRINT:a:LAST:"Current\:%8.2lf %s" GPRINT:a:AVERAGE:"Average\:%8.2lf %s"
> GPRINT:a:MAX:"Maximum\:%8.2lf %s"
>
> RRDTool Says:
>
> OK
>
>
> So this works fine when pasted to a command line, and produces a valid
> PNG file.
>
> -------------------------------------
> When I do a wget on the file
>
> wget -c
> "http://192.168.100.198/cacti/graph_image.php?local_graph_id=821&rra_id=0&view_type=tree&graph_start=1290388765&graph_end=1290390565"
> -O cacti-bad.png
>
> I get the file at
> http://criggie.org.nz/crap/cacti-bad.png
> Which is an invalid PNG file
>
>
> -----------------------------------
> Now, the two output PNGs differ
>
> cacti-bad.png
> PNG image data, 1212437084 x 811347971, 135-bit
>
> cacti-good.png
> PNG image data, 903 x 202, 8-bit/color RGBA, non-interlaced
>
>
> $ ls -la *png
> -rw-r--r-- 1 cf Domain Users 22180 Nov 19 13:34 cacti-bad.png
> -rw-r--r-- 1 cf Domain Users 22860 Nov 19 13:35 cacti-good.png
>
>
>
> I've put an od -a at
> http://rrdtool.pastebin.ca/1998463
> to show the differences.
>
>
>
> Now if I replace "\0" with nul in that file, its better but still not
> right.
>
> $ cat cacti-bad.png | sed "s/\\\0/\x00/g" > cacti-sed.png
> $ file cacti-sed.png
> PNG image data, 903 x 230, 8-bit/color RGBA, non-interlaced
>
>
> Therefore something is futzing with the data after it is generated by
> rrdtool.
>
> ------------------------------------
> Other diagnostics:
>
> I have duplicated the entire cacti install to another host which is
> similarly configured. It works perfectly and shows the graphs fine.
>
> ------------------------------------
> Details:
>
> Linux, Centos 5.5 running on an IBM x3250 in 32 bit mode
>
> # uname -srmopi
> Linux 2.6.18-194.8.1.el5.centos.plusPAE i686 i686 i386 GNU/Linux
>
> # rpm -q rrdtool cacti php-gd httpd php
> rrdtool-1.2.23-1.el5.rf
> cacti-0.8.7f-1.3t
> php-gd-5.1.6-27.el5
> httpd-2.2.3-43.el5.centos.3
> php-5.1.6-27.el5
>
>
>
>
> -------------------------------------
> Firstly I do not think rrdtool is the cause. I suspect its something to
> do with the way apache's httpd is getting the data back
>
>
> I have access to other servers configured basically the same way, and
> they're all working fine.
>
> Cacti is continuing to poll correctly in the background.
>
> The problem seems to be rrdtool's output being fiddled before it hits
> the end-user's browser.


-- 
Craig Falconer
   The Total Team - Secure Networks for Serious Business
   Office: 0800 888 326 / +643 974 9128
   Email: workorder at totalteam.co.nz
   Web: http://www.totalteam.co.nz/



More information about the rrd-users mailing list