Hello,
I’ve been trying to make a cgi script to create a png graph and then display it on the webserver. I’m using rrdtool, heres what I have:
#!/usr/bin/perl
$gfile="/usr/local/nagios/nagiosgraph/rrd/mygraph.png";
/usr/local/rrdtool-1.2.12/bin/rrdtool graph mygraph.png -a PNG --title="Round Trip Average" --vertical-label "Seconds" 'DEF:Probe1=svr%2Done_PING_ping.rrd:rta:AVERAGE' 'DEF:Probe2=svr%2Dtwo_PING_ping.rrd:rta:AVERAGE' 'DEF:Probe3=svr%2Dthree_PING_ping.rrd:rta:AVERAGE' 'LINE1:Probe1#ff0000:svr-one RTA' 'LINE1:Probe2#0400ff:svr-two RTA' 'LINE1:Probe3#35b73d:svr-three RTA'
print “Content-type: image/png\n\n”;
print $gfile->png;
as you can see its a pretty small script that only creates the image of round trip time for the three servers. The script was fine for the part that creates the file, it does create the file and shows the right quantities. But I get “compilation error” when I added the print statements which I believe print the resulting graph on web page. Am I doing something wrong?
Thanks in advance