commit | author | age
|
31f6ce
|
1 |
<?php |
M |
2 |
/* |
|
3 |
Copyright (c) 2007-2008, Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com |
|
4 |
All rights reserved. |
|
5 |
|
|
6 |
Redistribution and use in source and binary forms, with or without modification, |
|
7 |
are permitted provided that the following conditions are met: |
|
8 |
|
|
9 |
* Redistributions of source code must retain the above copyright notice, |
|
10 |
this list of conditions and the following disclaimer. |
|
11 |
* Redistributions in binary form must reproduce the above copyright notice, |
|
12 |
this list of conditions and the following disclaimer in the documentation |
|
13 |
and/or other materials provided with the distribution. |
|
14 |
* Neither the name of ISPConfig nor the names of its contributors |
|
15 |
may be used to endorse or promote products derived from this software without |
|
16 |
specific prior written permission. |
|
17 |
|
|
18 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
|
19 |
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
20 |
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|
21 |
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
|
22 |
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
23 |
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
24 |
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
|
25 |
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
|
26 |
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
|
27 |
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
28 |
*/ |
|
29 |
|
|
30 |
class tools_monitor { |
|
31 |
|
|
32 |
function showServerLoad() { |
|
33 |
global $app; |
|
34 |
|
|
35 |
/* fetch the Data from the DB */ |
|
36 |
$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'server_load' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); |
|
37 |
|
|
38 |
if(isset($record['data'])) { |
|
39 |
$data = unserialize($record['data']); |
|
40 |
|
|
41 |
/* |
|
42 |
Format the data |
|
43 |
*/ |
|
44 |
if (strlen($data['up_minutes']) == "1") $data['up_minutes'] = "0".$data['up_minutes']; |
|
45 |
$html = |
|
46 |
'<div class="systemmonitor-state state-'.$record['state'].'"> |
|
47 |
<div class="systemmonitor-content icons32 ico-'.$record['state'].'"> |
|
48 |
<table> |
|
49 |
<tr> |
|
50 |
<td>' . $app->lng("Server online since").':</td> |
|
51 |
<td>' . $data['up_days'] . ' days, ' . $data['up_hours'] . ':' . $data['up_minutes'] . ' hours</center></td> |
|
52 |
</tr> |
|
53 |
<tr> |
|
54 |
<td>' . $app->lng("Users online").':</td> |
|
55 |
<td>' . $data['user_online'] . '</td> |
|
56 |
</tr>' . |
|
57 |
'<tr> |
|
58 |
<td>' . $app->lng("System load 1 minute") . ':</td> |
|
59 |
<td>' . $data['load_1'] . '</td> |
|
60 |
</tr> |
|
61 |
<tr> |
|
62 |
<td>' . $app->lng("System load 5 minutes") . ':</td> |
|
63 |
<td>' . $data['load_5'] . '</td> |
|
64 |
</tr> |
|
65 |
<tr> |
|
66 |
<td>'.$app->lng("System load 15 minutes").':</td> |
|
67 |
<td>' . $data['load_15'] . '</td> |
|
68 |
</tr> |
|
69 |
</table> |
|
70 |
</div> |
|
71 |
</div>'; |
|
72 |
} else { |
|
73 |
$html = '<p>'.$app->lng("no_data_serverload_txt").'</p>'; |
|
74 |
} |
|
75 |
|
|
76 |
return $html; |
|
77 |
} |
|
78 |
|
|
79 |
function showDiskUsage () { |
|
80 |
global $app; |
|
81 |
|
|
82 |
/* fetch the Data from the DB */ |
|
83 |
$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'disk_usage' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); |
|
84 |
|
|
85 |
if(isset($record['data'])) { |
|
86 |
$data = unserialize($record['data']); |
|
87 |
|
|
88 |
/* |
|
89 |
Format the data |
|
90 |
*/ |
|
91 |
$html = |
|
92 |
'<div class="systemmonitor-state state-'.$record['state'].'"> |
|
93 |
<div class="systemmonitor-content icons32 ico-'.$record['state'].'"> |
|
94 |
<table> |
|
95 |
<tr> |
|
96 |
<td>'.$app->lng("monitor_diskusage_filesystem_txt").'</td> |
|
97 |
<td>'.$app->lng("monitor_diskusage_type_txt").'</td> |
|
98 |
<td>'.$app->lng("monitor_diskusage_size_txt").'</td> |
|
99 |
<td>'.$app->lng("monitor_diskusage_used_txt").'</td> |
|
100 |
<td>'.$app->lng("monitor_diskusage_available_txt").'</td> |
|
101 |
<td>'.$app->lng("monitor_diskusage_usage_txt").'</td> |
|
102 |
<td>'.$app->lng("monitor_diskusage_mounted_txt").'</td> |
|
103 |
</tr>'; |
|
104 |
foreach($data as $line) { |
|
105 |
$html .= '<tr>'; |
|
106 |
foreach ($line as $item) { |
|
107 |
$html .= '<td>' . $item . '</td>'; |
|
108 |
} |
|
109 |
$html .= '</tr>'; |
|
110 |
} |
|
111 |
$html .= '</table>'; |
|
112 |
$html .= '</div></div>'; |
|
113 |
} else { |
|
114 |
$html = '<p>'.$app->lng("no_data_diskusage_txt").'</p>'; |
|
115 |
} |
|
116 |
|
|
117 |
|
|
118 |
return $html; |
|
119 |
} |
|
120 |
|
|
121 |
function showMemUsage () { |
|
122 |
global $app; |
|
123 |
|
|
124 |
/* fetch the Data from the DB */ |
|
125 |
$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'mem_usage' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); |
|
126 |
|
|
127 |
if(isset($record['data'])) { |
|
128 |
$data = unserialize($record['data']); |
|
129 |
|
|
130 |
/* |
|
131 |
Format the data |
|
132 |
*/ |
|
133 |
$html = |
|
134 |
'<div class="systemmonitor-state state-'.$record['state'].'"> |
|
135 |
<div class="systemmonitor-content icons32 ico-'.$record['state'].'"> |
|
136 |
<table>'; |
|
137 |
|
|
138 |
foreach($data as $key => $value) { |
|
139 |
if ($key != '') { |
|
140 |
$html .= '<tr> |
|
141 |
<td>' . $key . ':</td> |
|
142 |
<td>' . $value . '</td> |
|
143 |
</tr>'; |
|
144 |
} |
|
145 |
} |
|
146 |
$html .= '</table>'; |
|
147 |
$html .= '</div></div>'; |
|
148 |
|
|
149 |
} else { |
|
150 |
$html = '<p>'.$app->lng("no_data_memusage_txt").'</p>'; |
|
151 |
} |
|
152 |
|
|
153 |
return $html; |
|
154 |
} |
|
155 |
|
|
156 |
function showCpuInfo () { |
|
157 |
global $app; |
|
158 |
|
|
159 |
/* fetch the Data from the DB */ |
|
160 |
$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'cpu_info' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); |
|
161 |
|
|
162 |
if(isset($record['data'])) { |
|
163 |
$data = unserialize($record['data']); |
|
164 |
|
|
165 |
/* |
|
166 |
Format the data |
|
167 |
*/ |
|
168 |
$html = |
|
169 |
'<div class="systemmonitor-state state-'.$record['state'].'"> |
|
170 |
<div class="systemmonitor-content icons32 ico-'.$record['state'].'"> |
|
171 |
<table>'; |
|
172 |
foreach($data as $key => $value) { |
|
173 |
if ($key != '') { |
|
174 |
$html .= '<tr> |
|
175 |
<td>' . $key . ':</td> |
|
176 |
<td>' . $value . '</td> |
|
177 |
</tr>'; |
|
178 |
} |
|
179 |
} |
|
180 |
$html .= '</table>'; |
|
181 |
$html .= '</div></div>'; |
|
182 |
} else { |
|
183 |
$html = '<p>'.$app->lng("no_data_cpuinfo_txt").'</p>'; |
|
184 |
} |
|
185 |
|
|
186 |
return $html; |
|
187 |
} |
|
188 |
|
|
189 |
function showServices () { |
|
190 |
global $app; |
|
191 |
|
|
192 |
/* fetch the Data from the DB */ |
|
193 |
$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'services' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); |
|
194 |
|
|
195 |
if(isset($record['data'])) { |
|
196 |
$data = unserialize($record['data']); |
|
197 |
|
|
198 |
/* |
|
199 |
Format the data |
|
200 |
*/ |
|
201 |
$html = |
|
202 |
'<div class="systemmonitor-state state-'.$record['state'].'"> |
|
203 |
<div class="systemmonitor-content icons32 ico-'.$record['state'].'"> |
|
204 |
<table>'; |
|
205 |
|
|
206 |
if($data['webserver'] != -1) { |
|
207 |
if($data['webserver'] == 1) { |
|
208 |
$status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>'; |
|
209 |
} else { |
|
210 |
$status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>'; |
|
211 |
} |
|
212 |
$html .= '<tr> |
|
213 |
<td>'.$app->lng("monitor_services_web_txt").'</td> |
|
214 |
<td>'.$status.'</td> |
|
215 |
</tr>'; |
|
216 |
} |
|
217 |
|
|
218 |
|
|
219 |
if($data['ftpserver'] != -1) { |
|
220 |
if($data['ftpserver'] == 1) { |
|
221 |
$status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>'; |
|
222 |
} else { |
|
223 |
$status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>'; |
|
224 |
} |
|
225 |
$html .= '<tr> |
|
226 |
<td>'.$app->lng("monitor_services_ftp_txt").'</td> |
|
227 |
<td>'.$status.'</td> |
|
228 |
</tr>'; |
|
229 |
} |
|
230 |
|
|
231 |
if($data['smtpserver'] != -1) { |
|
232 |
if($data['smtpserver'] == 1) { |
|
233 |
$status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>'; |
|
234 |
} else { |
|
235 |
$status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>'; |
|
236 |
} |
|
237 |
$html .= '<tr> |
|
238 |
<td>'.$app->lng("monitor_services_smtp_txt").'</td> |
|
239 |
<td>'.$status.'</td> |
|
240 |
</tr>'; |
|
241 |
} |
|
242 |
|
|
243 |
if($data['pop3server'] != -1) { |
|
244 |
if($data['pop3server'] == 1) { |
|
245 |
$status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>'; |
|
246 |
} else { |
|
247 |
$status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>'; |
|
248 |
} |
|
249 |
$html .= '<tr> |
|
250 |
<td>'.$app->lng("monitor_services_pop_txt").'</td> |
|
251 |
<td>'.$status.'</td> |
|
252 |
</tr>'; |
|
253 |
} |
|
254 |
|
|
255 |
if($data['imapserver'] != -1) { |
|
256 |
if($data['imapserver'] == 1) { |
|
257 |
$status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>'; |
|
258 |
} else { |
|
259 |
$status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>'; |
|
260 |
} |
|
261 |
$html .= '<tr> |
|
262 |
<td>'.$app->lng("monitor_services_imap_txt").'</td> |
|
263 |
<td>'.$status.'</td> |
|
264 |
</tr>'; |
|
265 |
} |
|
266 |
|
|
267 |
if($data['bindserver'] != -1) { |
|
268 |
if($data['bindserver'] == 1) { |
|
269 |
$status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>'; |
|
270 |
} else { |
|
271 |
$status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>'; |
|
272 |
} |
|
273 |
$html .= '<tr> |
|
274 |
<td>'.$app->lng("monitor_services_mydns_txt").'</td> |
|
275 |
<td>'.$status.'</td> |
|
276 |
</tr>'; |
|
277 |
} |
|
278 |
|
|
279 |
if($data['mysqlserver'] != -1) { |
|
280 |
if($data['mysqlserver'] == 1) { |
|
281 |
$status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>'; |
|
282 |
} else { |
|
283 |
$status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>'; |
|
284 |
} |
|
285 |
$html .= '<tr> |
|
286 |
<td>'.$app->lng("monitor_services_mysql_txt").'</td> |
|
287 |
<td>'.$status.'</td> |
|
288 |
</tr>'; |
|
289 |
} |
|
290 |
|
|
291 |
|
|
292 |
$html .= '</table></div></div>'; |
|
293 |
} else { |
|
294 |
$html = '<p>'.$app->lng("no_data_services_txt").'</p>'; |
|
295 |
} |
|
296 |
|
|
297 |
|
|
298 |
return $html; |
|
299 |
} |
|
300 |
|
|
301 |
function showSystemUpdate() { |
|
302 |
global $app; |
|
303 |
|
|
304 |
/* fetch the Data from the DB */ |
|
305 |
$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'system_update' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); |
|
306 |
|
|
307 |
if(isset($record['data'])) { |
|
308 |
$html = |
|
309 |
'<div class="systemmonitor-state state-'.$record['state'].'"> |
|
310 |
<div class="systemmonitor-content icons32 ico-'.$record['state'].'">'; |
|
311 |
/* |
|
312 |
* First, we have to detect, if there is any monitoring-data. |
|
313 |
* If not (because the destribution is not supported) show this. |
|
314 |
*/ |
|
315 |
if ($record['state'] == 'no_state') { |
|
316 |
$html .= '<p>'.$app->lng("monitor_updates_nosupport_txt").'</p>'; |
|
317 |
} |
|
318 |
else { |
|
319 |
$data = unserialize($record['data']); |
|
320 |
$html .= nl2br(html_entity_decode($data['output'])); |
|
321 |
} |
|
322 |
$html .= '</div></div>'; |
|
323 |
} else { |
|
324 |
$html = '<p>'.$app->lng("no_data_updates_txt").'</p>'; |
|
325 |
} |
|
326 |
|
|
327 |
return $html; |
|
328 |
} |
|
329 |
|
|
330 |
|
|
331 |
function showOpenVzBeancounter() { |
|
332 |
global $app; |
|
333 |
|
|
334 |
/* fetch the Data from the DB */ |
|
335 |
$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'openvz_beancounter' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); |
|
336 |
|
|
337 |
if(isset($record['data'])) { |
|
338 |
$html = |
|
339 |
'<div class="systemmonitor-state state-'.$record['state'].'"> |
|
340 |
<div class="systemmonitor-content icons32 ico-'.$record['state'].'">'; |
|
341 |
/* |
|
342 |
* First, we have to detect, if there is any monitoring-data. |
|
343 |
* If not (because the server is not a VE) show this. |
|
344 |
*/ |
|
345 |
$data = unserialize($record['data']); |
|
346 |
if ((!isset($data)) || ($data == '')) { |
|
347 |
$html .= '<p>'.$app->lng("monitor_beancounter_nosupport_txt").'</p>'; |
|
348 |
} |
|
349 |
else { |
|
350 |
$html .= '<pre>' . nl2br($data) . '</pre>'; |
|
351 |
} |
|
352 |
$html .= '</div></div>'; |
|
353 |
} else { |
|
354 |
$html = '<p>'.$app->lng("no_data_updates_txt").'</p>'; |
|
355 |
} |
|
356 |
|
|
357 |
return $html; |
|
358 |
} |
|
359 |
|
|
360 |
function showRaidState() { |
|
361 |
global $app; |
|
362 |
|
|
363 |
/* fetch the Data from the DB */ |
|
364 |
$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'raid_state' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); |
|
365 |
|
|
366 |
if(isset($record['data'])) { |
|
367 |
$html = |
|
368 |
'<div class="systemmonitor-state state-'.$record['state'].'"> |
|
369 |
<div class="systemmonitor-content icons32 ico-'.$record['state'].'">'; |
|
370 |
|
|
371 |
/* |
|
372 |
* First, we have to detect, if there is any monitoring-data. |
|
373 |
* If not (because the RAID-Controler is not supported yet) show this. |
|
374 |
*/ |
|
375 |
if ($record['state'] == 'no_state') { |
|
376 |
$html .= '<p>'.$app->lng("monitor_nosupportedraid1_txt").'</p>'; |
|
377 |
} |
|
378 |
else { |
|
379 |
$data = unserialize($record['data']); |
|
380 |
$html .= nl2br($data['output']); |
|
381 |
} |
|
382 |
$html .= '</div></div>'; |
|
383 |
|
|
384 |
} else { |
|
385 |
$html = '<p>'.$app->lng("no_data_raid_txt").'</p>'; |
|
386 |
} |
|
387 |
|
|
388 |
return $html; |
|
389 |
} |
|
390 |
|
|
391 |
function showRKHunter() { |
|
392 |
global $app; |
|
393 |
|
|
394 |
/* fetch the Data from the DB */ |
|
395 |
$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'rkhunter' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); |
|
396 |
|
|
397 |
if(isset($record['data'])) { |
|
398 |
$html = |
|
399 |
'<div class="systemmonitor-state state-'.$record['state'].'"> |
|
400 |
<div class="systemmonitor-content icons32 ico-'.$record['state'].'">'; |
|
401 |
|
|
402 |
/* |
|
403 |
* First, we have to detect, if there is any monitoring-data. |
|
404 |
* If not (because rkhunter is not installed) show this. |
|
405 |
*/ |
|
406 |
$data = unserialize($record['data']); |
|
407 |
if ($data['output'] == '') { |
|
408 |
$html .= '<p>'.$app->lng("monitor_norkhunter_txt").'</p>'; |
|
409 |
} |
|
410 |
else { |
|
411 |
$html .= nl2br($data['output']); |
|
412 |
} |
|
413 |
$html .= '</div></div>'; |
|
414 |
|
|
415 |
} else { |
|
416 |
$html = '<p>'.$app->lng("no_data_rkhunter_txt").'</p>'; |
|
417 |
} |
|
418 |
|
|
419 |
return $html; |
|
420 |
} |
|
421 |
|
|
422 |
function showFail2ban() { |
|
423 |
global $app; |
|
424 |
|
|
425 |
/* fetch the Data from the DB */ |
|
426 |
$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'log_fail2ban' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); |
|
427 |
|
|
428 |
if(isset($record['data'])) { |
|
429 |
$html = |
|
430 |
'<div class="systemmonitor-state state-'.$record['state'].'"> |
|
431 |
<div class="systemmonitor-content icons32 ico-'.$record['state'].'">'; |
|
432 |
|
|
433 |
/* |
|
434 |
* First, we have to detect, if there is any monitoring-data. |
|
435 |
* If not (because fail2ban is not installed) show this. |
|
436 |
*/ |
|
437 |
$data = unserialize($record['data']); |
|
438 |
if ($data == '') { |
|
439 |
$html .= '<p>'. |
|
440 |
'fail2ban is not installed at this server.<br />' . |
|
441 |
'See more (for debian) <a href="http://www.howtoforge.com/fail2ban_debian_etch" target="htf">here...</a>'. |
|
442 |
'</p>'; |
|
443 |
} |
|
444 |
else { |
|
445 |
$html .= nl2br($data); |
|
446 |
} |
|
447 |
$html .= '</div></div>'; |
|
448 |
|
|
449 |
} else { |
|
450 |
$html = '<p>There is no data available at the moment.</p>'; |
|
451 |
} |
|
452 |
|
|
453 |
return $html; |
|
454 |
} |
|
455 |
|
2332b2
|
456 |
function showMongoDB() { |
T |
457 |
global $app; |
|
458 |
|
|
459 |
/* fetch the Data from the DB */ |
|
460 |
$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'log_mongodb' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); |
|
461 |
|
|
462 |
if(isset($record['data'])) { |
|
463 |
$html = |
|
464 |
'<div class="systemmonitor-state state-'.$record['state'].'"> |
|
465 |
<div class="systemmonitor-content icons32 ico-'.$record['state'].'">'; |
|
466 |
|
|
467 |
/* |
|
468 |
* First, we have to detect, if there is any monitoring-data. |
|
469 |
* If not (because mongodb is not installed) show this. |
|
470 |
*/ |
|
471 |
$data = unserialize($record['data']); |
|
472 |
if ($data == '') { |
|
473 |
$html .= '<p>'. |
|
474 |
'MongoDB is not installed at this server.<br />' . |
|
475 |
'See more (for debian) <a href="http://www.howtoforge.com/fail2ban_debian_etch" target="htf">here...</a>'. |
|
476 |
'</p>'; |
|
477 |
} |
|
478 |
else { |
|
479 |
$html .= nl2br($data); |
|
480 |
} |
|
481 |
$html .= '</div></div>'; |
|
482 |
|
|
483 |
} else { |
|
484 |
$html = '<p>There is no data available at the moment.</p>'; |
|
485 |
} |
|
486 |
|
|
487 |
return $html; |
|
488 |
} |
|
489 |
|
31f6ce
|
490 |
function showIPTables() { |
M |
491 |
global $app; |
|
492 |
$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'iptables_rules' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); |
|
493 |
if(isset($record['data'])) { |
|
494 |
$html = |
|
495 |
'<div class="systemmonitor-state state-'.$record['state'].'"> |
|
496 |
<div class="systemmonitor-content icons32 ico-'.$record['state'].'">'; |
|
497 |
$data = unserialize($record['data']); |
|
498 |
if ($data == '') { |
|
499 |
$html .= '<p>Problem, there are no rules listed for the server</p>'; |
|
500 |
} |
|
501 |
else { |
cc6568
|
502 |
$html .= nl2br($data['output']); |
31f6ce
|
503 |
} |
M |
504 |
$html .= '</div></div>'; |
|
505 |
} else { |
|
506 |
$html = '<p>There is no data available at the moment.</p>'; |
|
507 |
} |
|
508 |
return $html; |
|
509 |
} |
|
510 |
|
|
511 |
|
|
512 |
function showMailq() { |
|
513 |
global $app; |
|
514 |
|
|
515 |
/* fetch the Data from the DB */ |
|
516 |
$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'mailq' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); |
|
517 |
|
|
518 |
if(isset($record['data'])) { |
|
519 |
$data = unserialize($record['data']); |
|
520 |
$html = nl2br($data['output']); |
|
521 |
} else { |
|
522 |
$html = '<p>'.$app->lng("no_data_mailq_txt").'</p>'; |
|
523 |
} |
|
524 |
|
|
525 |
return $html; |
|
526 |
} |
|
527 |
|
|
528 |
function getDataTime($type) { |
|
529 |
global $app; |
|
530 |
|
|
531 |
/* fetch the Data from the DB */ |
|
532 |
$record = $app->db->queryOneRecord("SELECT created FROM monitor_data WHERE type = '" . $type . "' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); |
|
533 |
|
|
534 |
/* TODO: datetimeformat should be set somewhat other way */ |
|
535 |
$dateTimeFormat = $app->lng("monitor_settings_datetimeformat_txt"); |
|
536 |
|
|
537 |
if(isset($record['created'])) { |
|
538 |
// $res = date('Y-m-d H:i', $record['created']); |
|
539 |
$res = date($dateTimeFormat, $record['created']); |
|
540 |
} else { |
|
541 |
$res = '????-??-?? ??:??'; |
|
542 |
} |
|
543 |
return $res; |
|
544 |
} |
|
545 |
} |
|
546 |
?> |