We have a monitoring system that creates RRD databases. I am looking for the easiest way to create charts from these RRD files for our HTML pages. Therefore, I do not want to store them in files. I am trying to create a simple BASH CGI script that will output image data, so I can do something like this:
<img src="/cgi-bin/graph.cgi?param1=abc"></img>
First of all, I am trying to create a simple CGI script that will send me a PNG image. This does not work:
#!/bin/bash
echo -e "Content-type: image/png\n\n"
cat image.png
But when I rewrite this in PERL, it works:
print "Content-type: image/png\n\n";
open(IMG, "image.png");
print while <IMG>;
close(IMG);
exit 0;
What is the difference? I really would like to do it in BASH. Thank.
source
share