[rrd-users] Re: RRDs::graph without temporary files?

Todd Caine todd_caine at eli.net
Sat May 27 00:23:59 MEST 2000


Never mind, I'm an idiot.  It actually does work.  I didn't
give the CGI script a .pl or .cgi extension, and I have
apache configured to recognize '.pl' and '.cgi' as valid
extensions for CGI scripts.  Any way, try it out.  It works
very well.  And the best part is that you don't have to run
cron jobs to go clean out a caching directory where the
images are stored.  



Todd Caine wrote:
> 
> Hello All,
> 
> I'm trying to create a CGI script which can print a graph to
> STDOUT and capture that image in a <IMG SRC> html tag.
> Assume for now that you have a GIF called graph.gif.  You
> could write a program called image.cgi to do the following:
> 
> #!/usr/bin/perl
> 
> my $image_file = $ARGV[0]
> 
> open(IMG, "< $image_file");
> print "Content-type: image/gif\n\n";
> binmode(IMG);
> print <IMG>;
> close(IMG);
> 
> Now from an HTML document you could say:
> 
> <IMG SRC="image.cgi?graph.gif">
> 
> And the image should be displayed on your web browser.  I
> have tested this and it works.
> 
> Now if you don't want to create an actual file(image.gif),
> read it, and then print it, you can use a '-' as the
> filename argument to RRDs::graph and it will print to
> STDOUT.  I've actually done this and redirected it to a
> file and it does create a real image.  But when trying to
> write a script to do the following:
> 
> # image.cgi
> print "Content-type: image/gif\n\n";
> binmod(STDOUT);
> RRDs::graph('-', '-s -86400', ....);
> 
> I can't get it to work through the <IMG
> SRC="image.cgi?arguments"> tag.  Any ideas?
> 
> --
> ---------------------------------------------------------
> 
>         <!--    Todd Caine - tcaine at eli.net
>                 Software Engineer
>                 Electric Lightwave, Inc.
>                 4400 NE 77th Avenue
>                 Vancouver, WA   98662
>                 Direct Dial: (360) 816-4344      //-->
> 
> ---------------------------------------------------------
> 
> --
> 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://www.ee.ethz.ch/~slist/rrd-users

-- 
--------------------------------------------------------------

	<!--	Todd Caine - tcaine at eli.net
		Software Engineer
		Electric Lightwave, Inc.
		4400 NE 77th Avenue
		Vancouver, WA	98662
		Direct Dial: (360) 816-4344	 //-->

--------------------------------------------------------------

--
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://www.ee.ethz.ch/~slist/rrd-users



More information about the rrd-users mailing list