1 |
95b003ff
|
Origo
|
#!/usr/bin/perl
|
2 |
|
|
# index.cgi
|
3 |
|
|
|
4 |
|
|
require './mon-lib.pl';
|
5 |
|
|
&ui_print_header(undef, $text{'index_title'}, "","intro", 1, 1, 0
|
6 |
|
|
&help_search_link("mon", "man", "doc", "google"));
|
7 |
|
|
|
8 |
|
|
# Check if mon is installed
|
9 |
|
|
if (!-r $mon_config_file) {
|
10 |
|
|
print "<p>",&text('err_nomonconf', "<tt>$mon_config_file</tt>",
|
11 |
|
|
"$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
|
12 |
|
|
&ui_print_footer("/", $text{'index'});
|
13 |
|
|
exit;
|
14 |
|
|
}
|
15 |
|
|
|
16 |
|
|
# print icons
|
17 |
|
|
@opts = ( 'global', 'groups', 'watches', 'periods', 'users', 'auth',
|
18 |
|
|
'status', 'show' );
|
19 |
|
|
@links = ( 'edit_global.cgi', 'list_groups.cgi', 'list_watches.cgi',
|
20 |
|
|
'list_periods.cgi', 'list_users.cgi', 'edit_auth.cgi', 'mon.cgi',
|
21 |
|
|
'monshow.cgi' );
|
22 |
|
|
@titles = map { $text{"${_}_title"} } @opts;
|
23 |
|
|
@icons = map { "images/${_}.gif" } @opts;
|
24 |
|
|
&icons_table(\@links, \@titles, \@icons);
|
25 |
|
|
|
26 |
|
|
# check if mon is running
|
27 |
|
|
print &ui_hr();
|
28 |
|
|
print "<table width=100%>\n";
|
29 |
|
|
if (&check_pid_file($config{'pid_file'})) {
|
30 |
|
|
print "<tr><form action=stop.cgi>\n";
|
31 |
|
|
print "<td><input type=submit value=\"$text{'mon_stop'}\"></td>\n";
|
32 |
|
|
print "<td>$text{'mon_stopdesc'}</td>\n";
|
33 |
|
|
print "</form></tr>\n";
|
34 |
|
|
|
35 |
|
|
print "<tr><form action=restart.cgi>\n";
|
36 |
|
|
print "<td><input type=submit value=\"$text{'mon_restart'}\"></td>\n";
|
37 |
|
|
print "<td>$text{'mon_restartdesc'}</td>\n";
|
38 |
|
|
print "</form></tr>\n";
|
39 |
|
|
close(PID);
|
40 |
|
|
}
|
41 |
|
|
else {
|
42 |
|
|
print "<tr><form action=start.cgi>\n";
|
43 |
|
|
print "<td><input type=submit value=\"$text{'mon_start'}\"></td>\n";
|
44 |
|
|
print "<td>$text{'mon_startdesc'}</td>\n";
|
45 |
|
|
print "</form></tr>\n";
|
46 |
|
|
}
|
47 |
|
|
print "</table>\n";
|
48 |
|
|
|
49 |
|
|
&ui_print_footer("/", $text{'index'});
|