The issue was not flushing the buffers. I added $|=1 and it works fine
now.
 

________________________________

From: Block, Ryan (Citco) 
Sent: Tuesday, August 15, 2006 12:06 PM
To: [email protected]
Subject: Problem with RRDs::graph and malformed header

 

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
[EMAIL PROTECTED]

 


--
Unsubscribe mailto:[EMAIL PROTECTED]
Help        mailto:[EMAIL PROTECTED]
Archive     http://lists.ee.ethz.ch/rrd-users
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi

Reply via email to