statusmap.cgi and PNG output

Jesús M. NAVARRO jesus_navarro at undominio.net
Tue Jun 3 21:25:25 CEST 2003


Hi, list:

I'm following on my intent for a drop-in replacement for nagios user 
interface.

Rigth now, V 0.4.8 (released today) is able to manage cmd.cgi, and only 
pendant question is how to manage those CGIs that embed images.  Now I'm 
trying to make it work with statusmap.cgi.

It seems that something like 
http://localhost/nagios/cgi-bin/statusmap.cgi?host=all&createimage&canvas_x=0&canvas_y=0&canvas_width=593&canvas_height=552&max_width=0&max_height=0&layout=5&layermode=exclude

(quite a long URL, isn't it?) does output the PNG image, and I'm trying to 
wrap this invocation within a PHP file by calling the CGI as a command line 
program.

For this to work, I do something like this:
		putenv("REQUEST_METHOD=GET");
		putenv("REMOTE_USER=username");
		putenv("QUERY_STRING=" . $query_string);
			$cgi=CGI_PATH . "statusmap.cgi";
 			$cgi_output=system($cgi);

...where, as you can imagine, $query_string equals 
"host=all&createimage&canvas_x=0&canvas_y=0&..."

This approach does work for "simple" CGIs, like tac.cgi (the Tactical Overview 
one).  Problem is that the above invocation DOES NOT return just the PNG 
"file" but the HTTP headers too (Content-type, no cache, etc.).

Though I had a look at the statusmap source code, I haven been able to 
discover if there's any way to call the CGI so it just returns the plain 
image, so I can return it to the client browser the way it have to.

Well, I hope someone can guide me through this one.
-- 
SALUD,
Jesús
***
jesus_navarro at undominio.net
***



-------------------------------------------------------
This SF.net email is sponsored by: eBay
Get office equipment for less on eBay!
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5




More information about the Developers mailing list