[rrd-users] Problem with RRDs::graph and malformed header

Block, Ryan (Citco) RBlock at citco.com
Tue Aug 15 18:06:28 MEST 2006


I have this script that prints a graph to stdout which runs fine from a
command line. When I run it via a web browser, I get the following error
in my apache log. Also, if I graph it to a file and then display the
file, it works fine. 
 

malformed header from script. Bad header=\x89PNG

 

I have searched all over, but have not found a resolution. I have this
working with no problems in other scripts, but this one is kicking my
butt. Any help will be most appreciated. Thanks.

 

#!/usr/bin/perl

 

use warnings;

use strict;

use lib "/usr/local/rrdtool/lib/perl";

use RRDs;

 

my $datadir = "/usr/local/rbping-server/data";

my $graph_height = 100;

my $graph_width = 700;

my $agent_id = "USC1";

my $host = "usc1-usc1par01";

my $file = "-";

 

my $title = "$host Loss Graph";

my @args = (

             "-v percentage",

             "-w $graph_width",

             "-h $graph_height",

             "-s end-3600",

             "-e now",

             "-t $title",

             "-a","PNG", 

             "-l 0",

             "-u 100",

             "-r",

             "DEF:loss=$datadir/$agent_id/$host.rrd:loss:LAST",

             "AREA:loss#FF0000:LOSS",

             "GPRINT:loss:LAST:   latest LOSS\\: %.0lf%%",

            );

 

print "Content-Type: image/png\n\n";

RRDs::graph($file , @args);

my $ERR = RRDs::error;

print STDERR "ERROR while creating $host: $ERR\n" if $ERR;

 

Ryan Block
WAN Engineer
Citco Technology Mgt.
(Office) 954-351-7245
(Mobile) 954-326-9173
rblock at citco.com

 


--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://lists.ee.ethz.ch/rrd-users
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the rrd-users mailing list