1
|
#!/usr/bin/perl
|
2
|
# mon.cgi
|
3
|
# Run the included MON cgi program
|
4
|
|
5
|
require './mon-lib.pl';
|
6
|
&ui_print_header(undef, $text{'status_title'}, "");
|
7
|
|
8
|
if (!-x $config{'mon_cgi'}) {
|
9
|
print "<p>",&text('status_ecgi', "<tt>$config{'mon_cgi'}</tt>",
|
10
|
"../config.cgi?$module_name"),"<p>\n";
|
11
|
&ui_print_footer("", $text{'index_return'});
|
12
|
exit;
|
13
|
}
|
14
|
if (&same_file($config{'mon_cgi'}, $0)) {
|
15
|
print "<p>",&text('status_esame', "<tt>$config{'mon_cgi'}</tt>",
|
16
|
"../config.cgi?$module_name"),"<p>\n";
|
17
|
&ui_print_footer("", $text{'index_return'});
|
18
|
exit;
|
19
|
}
|
20
|
eval "use Mon::Client";
|
21
|
if ($@) {
|
22
|
print "<p>",&text('status_eperl', "<tt>Mon::Client</tt>",
|
23
|
"../cpan/download.cgi?source=3&cpan=Mon::Client"),"<p>\n";
|
24
|
&ui_print_footer("", $text{'index_return'});
|
25
|
exit;
|
26
|
}
|
27
|
|
28
|
&open_execute_command(CGI, "$config{'mon_cgi'} 2>&1", 1, 1);
|
29
|
while(<CGI>) {
|
30
|
$body .= $_;
|
31
|
}
|
32
|
close(CGI);
|
33
|
|
34
|
$body =~ s/^[\000-\177]*<body[^>]*>//i;
|
35
|
$body =~ s/<\/body>[\000-\177]*$//i;
|
36
|
print $body;
|
37
|
|
38
|
&ui_print_footer("", $text{'index_return'});
|
39
|
|