Creating a custom cgi to display custom graphs

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/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

why not stick to nagiostat/nagiosgraph which already provides everything? i seem to remeber you got it working…


yeah I did.
I just had this idea yesterday of making group multigraphs for some reason but just realized I wouldn’t really need that.
thanks though :slight_smile:

you could create a new entry in the side menu and have it link to a standard web pag ewhich inorporates the graphs… instead of creating them on the fly through a cgi you could create them through cron every 10 minutes… this would be much easier…

lazy? me? yessss :smiley: