statusmap.cgi and PNG output
Subhendu Ghosh
sghosh at sghosh.org
Tue Jun 10 03:50:37 CEST 2003
The images cannot be generated separately from the existing cgis.
-sg
On Tue, 3 Jun 2003, [iso-8859-15] Jesús M. NAVARRO wrote:
> 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.
>
--
-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
More information about the Developers
mailing list