#!/usr/local/bin/perl
# mon.cgi
# Run the included MON cgi program

require './mon-lib.pl';
&header($text{'status_title'}, "");
print "<hr>\n";

if (!-x $config{'mon_cgi'}) {
	print "<p>",&text('status_ecgi', "<tt>$config{'mon_cgi'}</tt>",
			  "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
	print "<hr>\n";
	&footer("", $text{'index_return'});
	exit;
	}
eval "use Mon::Client";
if ($@) {
	print "<p>",&text('status_eperl', "<tt>Mon::Client</tt>",
		  "$gconfig{'webprefix'}/cpan/download.cgi?source=3&cpan=Mon::Client"),"<p>\n";
	print "<hr>\n";
	&footer("", $text{'index_return'});
	exit;
	}

open(CGI, "$config{'mon_cgi'} 2>&1 |");
while(<CGI>) {
	$body .= $_;
	}
close(CGI);

$body =~ s/^[\000-\177]*<body[^>]*>//i;
$body =~ s/<\/body>[\000-\177]*$//i;
print $body;

print "<hr>\n";
&footer("", $text{'index_return'});

