commit | author | age
|
b7489f
|
1 |
<?php |
V |
2 |
|
|
3 |
/* |
|
4 |
Copyright (c) 2007-2008, Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com |
|
5 |
All rights reserved. |
|
6 |
|
|
7 |
Redistribution and use in source and binary forms, with or without modification, |
|
8 |
are permitted provided that the following conditions are met: |
|
9 |
|
|
10 |
* Redistributions of source code must retain the above copyright notice, |
|
11 |
this list of conditions and the following disclaimer. |
|
12 |
* Redistributions in binary form must reproduce the above copyright notice, |
|
13 |
this list of conditions and the following disclaimer in the documentation |
|
14 |
and/or other materials provided with the distribution. |
|
15 |
* Neither the name of ISPConfig nor the names of its contributors |
|
16 |
may be used to endorse or promote products derived from this software without |
|
17 |
specific prior written permission. |
|
18 |
|
|
19 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
|
20 |
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
21 |
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|
22 |
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
|
23 |
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
24 |
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
25 |
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
|
26 |
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
|
27 |
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
|
28 |
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
29 |
*/ |
|
30 |
|
|
31 |
require_once('../../lib/config.inc.php'); |
|
32 |
require_once('../../lib/app.inc.php'); |
|
33 |
|
|
34 |
//* Check permissions for module |
|
35 |
$app->auth->check_module_permissions('monitor'); |
|
36 |
|
31f6ce
|
37 |
$app->uses('tools_monitor'); |
b7489f
|
38 |
|
V |
39 |
/* Get the dataType to show */ |
|
40 |
$dataType = $_GET["type"]; |
|
41 |
|
7e3524
|
42 |
/* Get some translations */ |
A |
43 |
$monTransDate = $app->lng("monitor_settings_datafromdate_txt"); |
|
44 |
$monTransSrv = $app->lng("monitor_settings_server_txt"); |
|
45 |
|
|
46 |
|
b7489f
|
47 |
$output = ''; |
V |
48 |
|
|
49 |
switch($dataType) { |
8793b3
|
50 |
case 'server_load': |
V |
51 |
$template = 'templates/show_data.htm'; |
31f6ce
|
52 |
$output .= $app->tools_monitor->showServerLoad(); |
M |
53 |
$time = $app->tools_monitor->getDataTime('server_load'); |
7e3524
|
54 |
$title = $app->lng("Server Load").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')'; |
8793b3
|
55 |
$description = ''; |
V |
56 |
break; |
|
57 |
case 'disk_usage': |
|
58 |
$template = 'templates/show_data.htm'; |
31f6ce
|
59 |
$output .= $app->tools_monitor->showDiskUsage(); |
M |
60 |
$time = $app->tools_monitor->getDataTime('disk_usage'); |
7e3524
|
61 |
$title = $app->lng("Disk usage").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')'; |
8793b3
|
62 |
$description = ''; |
V |
63 |
break; |
|
64 |
case 'mem_usage': |
|
65 |
$template = 'templates/show_data.htm'; |
31f6ce
|
66 |
$output .= $app->tools_monitor->showMemUsage(); |
M |
67 |
$time = $app->tools_monitor->getDataTime('mem_usage'); |
7e3524
|
68 |
$title = $app->lng("Memory usage").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')'; |
8793b3
|
69 |
$description = ''; |
V |
70 |
break; |
|
71 |
case 'cpu_info': |
|
72 |
$template = 'templates/show_data.htm'; |
31f6ce
|
73 |
$output .= $app->tools_monitor->showCpuInfo(); |
M |
74 |
$time = $app->tools_monitor->getDataTime('cpu_info'); |
51d014
|
75 |
$title = $app->lng("monitor_title_cpuinfo_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')'; |
8793b3
|
76 |
$description = ''; |
V |
77 |
break; |
|
78 |
case 'services': |
|
79 |
$template = 'templates/show_data.htm'; |
31f6ce
|
80 |
$output .= $app->tools_monitor->showServices(); |
M |
81 |
$time = $app->tools_monitor->getDataTime('services'); |
7e3524
|
82 |
$title = $app->lng("Status of services").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')'; |
8793b3
|
83 |
$description = ''; |
V |
84 |
break; |
c9d97b
|
85 |
case 'openvz_beancounter': |
V |
86 |
$template = 'templates/show_data.htm'; |
31f6ce
|
87 |
$output .= $app->tools_monitor->showOpenVzBeanCounter(); |
M |
88 |
$time = $app->tools_monitor->getDataTime('openvz_beancounter'); |
c9d97b
|
89 |
$title = $app->lng("monitor_title_beancounter_txt") . ' (' . $monTransSrv . ' : ' . $_SESSION['monitor']['server_name'] . ')'; |
V |
90 |
$description = ''; |
|
91 |
break; |
716255
|
92 |
case 'system_update': |
V |
93 |
$template = 'templates/show_data.htm'; |
31f6ce
|
94 |
$output .= $app->tools_monitor->showSystemUpdate(); |
M |
95 |
$time = $app->tools_monitor->getDataTime('system_update'); |
7e3524
|
96 |
$title = $app->lng("monitor_title_updatestate_txt"). ' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')'; |
716255
|
97 |
$description = ''; |
V |
98 |
break; |
|
99 |
case 'mailq': |
|
100 |
$template = 'templates/show_data.htm'; |
31f6ce
|
101 |
$output .= $app->tools_monitor->showMailq(); |
M |
102 |
$time = $app->tools_monitor->getDataTime('mailq'); |
7e3524
|
103 |
$title = $app->lng("monitor_title_mailq_txt"). ' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')'; |
716255
|
104 |
$description = ''; |
V |
105 |
break; |
36d307
|
106 |
case 'raid_state': |
V |
107 |
$template = 'templates/show_data.htm'; |
31f6ce
|
108 |
$output .= $app->tools_monitor->showRaidState(); |
M |
109 |
$time = $app->tools_monitor->getDataTime('raid_state'); |
7e3524
|
110 |
$title = $app->lng("monitor_title_raidstate_txt"). ' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')'; |
36d307
|
111 |
$description = ''; |
V |
112 |
break; |
|
113 |
case 'rkhunter': |
|
114 |
$template = 'templates/show_data.htm'; |
31f6ce
|
115 |
$output .= $app->tools_monitor->showRKHunter(); |
M |
116 |
$time = $app->tools_monitor->getDataTime('rkhunter'); |
7e3524
|
117 |
$title = $app->lng("monitor_title_rkhunterlog_txt"). ' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')'; |
36d307
|
118 |
$description = ''; |
V |
119 |
break; |
476a60
|
120 |
case 'fail2ban': |
V |
121 |
$template = 'templates/show_data.htm'; |
31f6ce
|
122 |
$output .= $app->tools_monitor->showFail2ban(); |
M |
123 |
$time = $app->tools_monitor->getDataTime('log_fail2ban'); |
a3e696
|
124 |
$title = $app->lng("monitor_title_fail2ban_txt") . ' (' . $monTransSrv . ' : ' . $_SESSION['monitor']['server_name'] . ')'; |
476a60
|
125 |
$description = ''; |
V |
126 |
break; |
2332b2
|
127 |
case 'mongodb': |
T |
128 |
$template = 'templates/show_data.htm'; |
|
129 |
$output .= $app->tools_monitor->showMongoDB(); |
|
130 |
$time = $app->tools_monitor->getDataTime('log_mongodb'); |
|
131 |
$title = $app->lng("monitor_title_mongodb_txt") . ' (' . $monTransSrv . ' : ' . $_SESSION['monitor']['server_name'] . ')'; |
|
132 |
$description = ''; |
|
133 |
break; |
28548b
|
134 |
case 'iptables': |
L |
135 |
$template = 'templates/show_data.htm'; |
31f6ce
|
136 |
$output .= $app->tools_monitor->showIPTables(); |
M |
137 |
$time = $app->tools_monitor->getDataTime('iptables_rules'); |
28548b
|
138 |
$title = $app->lng("monitor_title_iptables_txt") . ' (' . $monTransSrv . ' : ' . $_SESSION['monitor']['server_name'] . ')'; |
L |
139 |
$description = ''; |
|
140 |
break; |
8793b3
|
141 |
default: |
V |
142 |
$template = ''; |
|
143 |
break; |
b7489f
|
144 |
} |
V |
145 |
|
|
146 |
|
|
147 |
// Loading the template |
|
148 |
$app->uses('tpl'); |
|
149 |
$app->tpl->newTemplate("form.tpl.htm"); |
fb4c27
|
150 |
$app->tpl->setInclude('content_tpl', $template); |
b7489f
|
151 |
|
fb4c27
|
152 |
$app->tpl->setVar("output", $output); |
a3e696
|
153 |
$app->tpl->setVar("list_head_txt", $title); |
O |
154 |
$app->tpl->setVar("list_desc_txt", $description); |
fb4c27
|
155 |
$app->tpl->setVar("time", $time); |
7e3524
|
156 |
$app->tpl->setVar("monTransDate", $monTransDate); |
b7489f
|
157 |
|
V |
158 |
$app->tpl_defaults(); |
|
159 |
$app->tpl->pparse(); |
7e3524
|
160 |
?> |