Skip to content

Commit b7489f7

Browse files
author
vogelor
committed
First version of the new monitor - module (works for more than one server)
It is now possible to add "navigation-text" without links (actions) to the left navigations-side of the template (needed by the monitor module to add the server-dropdown)
1 parent 5bbbee3 commit b7489f7

File tree

9 files changed

+753
-479
lines changed

9 files changed

+753
-479
lines changed

install/sql/ispconfig3.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ CREATE TABLE `monitor_data` (
10741074
`type` varchar(255) NOT NULL,
10751075
`created` int(11) NOT NULL,
10761076
`data` mediumtext NOT NULL,
1077-
`state` enum('unknown','ok','warning','error') NOT NULL default 'unknown',
1077+
`state` enum('unknown','ok','warning','critical', 'error') NOT NULL default 'unknown',
10781078
PRIMARY KEY (`server_id`,`type`,`created`)
10791079
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
10801080

interface/web/monitor/lib/module.conf.php

Lines changed: 62 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,116 @@
11
<?php
22

3+
/*
4+
Config of the Module
5+
*/
36
$module["name"] = "monitor";
47
$module["title"] = "Monitor";
58
$module["template"] = "module.tpl.htm";
6-
$module["startpage"] = "monitor/system.php?mod=index";
79
$module["tab_width"] = '';
10+
$module["startpage"] = "monitor/system.php?type=overview";
811

912
/*
10-
Logmonitoring module
13+
We need all the available servers on the left navigation.
14+
So fetch them from the database and add then to the navigation as dropdown-list
1115
*/
16+
$servers = $app->db->queryAllRecords("SELECT server_id, server_name FROM server order by server_name");
1217

13-
$items[] = array( 'title' => "Load",
14-
'target' => 'content',
15-
'link' => 'monitor/system.php?mod=load');
18+
$dropDown = "<select id='server_id' onchange=\"loadContent('monitor/show_data.php?type=overview&server=' + document.getElementById('server_id').value);\">";
19+
foreach ($servers as $server)
20+
{
21+
$dropDown .= "<option value='" . $server['server_id'] . "|" . $server['server_name'] . "'>" . $server['server_name'] . "</option>";
22+
}
23+
$dropDown .= "</select>";
24+
25+
/*
26+
Now add them as dropdown to the navigation
27+
*/
28+
$items[] = array( 'title' => $dropDown,
29+
'target' => '', // no action!
30+
'link' => ''); // no action!
31+
32+
$module["nav"][] = array( 'title' => 'Server to Monitor',
33+
'open' => 1,
34+
'items' => $items);
35+
36+
/*
37+
The first Server at the list is the server first selected
38+
*/
39+
$_SESSION['monitor']['server_id'] = $servers[0]['server_id'];
40+
$_SESSION['monitor']['server_name'] = $servers[0]['server_name'];
1641

17-
$items[] = array( 'title' => "Harddisk",
42+
/*
43+
Logmonitoring module
44+
*/
45+
// aufräumen
46+
unset($items);
47+
$items[] = array( 'title' => "Server Load",
1848
'target' => 'content',
19-
'link' => 'monitor/system.php?mod=disk');
49+
'link' => 'monitor/show_data.php?type=server_load');
2050

21-
$items[] = array( 'title' => "Memory usage",
51+
$items[] = array( 'title' => "Disk usage",
2252
'target' => 'content',
23-
'link' => 'monitor/system.php?mod=memusage');
53+
'link' => 'monitor/show_data.php?type=disk_usage');
2454

25-
$items[] = array( 'title' => "CPU",
55+
$items[] = array( 'title' => "Memory usage",
2656
'target' => 'content',
27-
'link' => 'monitor/system.php?mod=cpu');
57+
'link' => 'monitor/show_data.php?type=mem_usage');
2858

2959
$items[] = array( 'title' => "Services",
3060
'target' => 'content',
31-
'link' => 'monitor/system.php?mod=services');
61+
'link' => 'monitor/show_data.php?type=services');
3262

3363

34-
$module["nav"][] = array( 'title' => 'System',
64+
$module["nav"][] = array( 'title' => 'Monitoring',
3565
'open' => 1,
3666
'items' => $items);
3767

3868
// aufräumen
3969
unset($items);
4070

71+
$items[] = array( 'title' => "CPU",
72+
'target' => 'content',
73+
'link' => 'monitor/show_data.php?type=cpu_info');
74+
75+
$module["nav"][] = array( 'title' => 'System-Information',
76+
'open' => 1,
77+
'items' => $items);
78+
79+
// aufräumen
80+
unset($items);
81+
82+
4183
/*
4284
Logmonitoring module
4385
*/
4486

4587
$items[] = array( 'title' => "Mail log",
4688
'target' => 'content',
47-
'link' => 'monitor/logview.php?log=mail_log');
89+
'link' => 'monitor/show_log.php?log=log_mail');
4890

4991
$items[] = array( 'title' => "Mail warn",
5092
'target' => 'content',
51-
'link' => 'monitor/logview.php?log=mail_warn');
93+
'link' => 'monitor/show_log.php?log=log_mail_warn');
5294

5395
$items[] = array( 'title' => "Mail err",
5496
'target' => 'content',
55-
'link' => 'monitor/logview.php?log=mail_err');
97+
'link' => 'monitor/show_log.php?log=log_mail_err');
5698

5799
$items[] = array( 'title' => "Messages",
58100
'target' => 'content',
59-
'link' => 'monitor/logview.php?log=messages');
101+
'link' => 'monitor/show_log.php?log=log_messages');
60102

61103
$items[] = array( 'title' => "Freshclam",
62104
'target' => 'content',
63-
'link' => 'monitor/logview.php?log=freshclam');
105+
'link' => 'monitor/show_log.php?log=log_freshclam');
64106

65107
$items[] = array( 'title' => "Clamav",
66108
'target' => 'content',
67-
'link' => 'monitor/logview.php?log=clamav');
109+
'link' => 'monitor/show_log.php?log=log_clamav');
68110

69111
$items[] = array( 'title' => "ISPConfig",
70112
'target' => 'content',
71-
'link' => 'monitor/logview.php?log=ispconfig');
113+
'link' => 'monitor/show_log.php?log=log_ispconfig');
72114

73115

74116
$module["nav"][] = array( 'title' => 'Logfiles',

0 commit comments

Comments
 (0)