From c9d97bfb2d2349194188d66e92e4adbafaba8b14 Mon Sep 17 00:00:00 2001
From: vogelor <vogelor@ispconfig3>
Date: Fri, 30 Apr 2010 20:19:47 -0400
Subject: [PATCH] The monitor now supports OpenVZ-Hosts and OpenVZ-VE's
---
interface/web/monitor/tools.inc.php | 532 +++++++++--------
interface/web/monitor/lib/lang/en.lng | 7
interface/web/monitor/show_sys_state.php | 855 +++++++++++++++------------
interface/web/monitor/lib/lang/de.lng | 12
interface/web/themes/default/css/screen/content_ispc.css | 65 +
server/mods-available/monitor_core_module.inc.php | 206 ++++-
interface/web/monitor/lib/module.conf.php | 3
interface/web/monitor/show_data.php | 7
server/lib/classes/openvz_tools.inc.php | 149 ++++
9 files changed, 1,140 insertions(+), 696 deletions(-)
diff --git a/interface/web/monitor/lib/lang/de.lng b/interface/web/monitor/lib/lang/de.lng
index b600d28..7a97fb2 100644
--- a/interface/web/monitor/lib/lang/de.lng
+++ b/interface/web/monitor/lib/lang/de.lng
@@ -40,6 +40,7 @@
$wb['Show ISPConfig-Log'] = 'ISPConfig-Protokoll anzeigen';
$wb['Show RKHunter-Log'] = 'RKHunter-Protokoll anzeigen';
$wb['Show Jobqueue'] = 'Jobwarteschlange anzeigen';
+$wb['Show OpenVz VE BeanCounter'] = 'OpenVz VE Beancounter anzeigen';
$wb['Show ISPC Cron-Log'] = 'ISPC Cron-Protokoll anzeigen';
$wb['no_data_updates_txt'] = 'Derzeit stehen keine Daten über Updates zur Verfügung. Bitte später erneut überprüfen.';
$wb['no_data_raid_txt'] = 'Derzeit stehen keine Daten über RAID zur Verfügung. Bitte später erneut überprüfen.';
@@ -66,10 +67,10 @@
$wb['monitor_norkhunter_txt'] = 'RKHunter ist nicht installiert, deshalb gibt es keine Protokolldatei';
$wb['monitor_serverstate_server_txt'] = 'Server';
$wb['monitor_serverstate_state_txt'] = 'Status';
-$wb['monitor_serverstate_unknown_txt'] = 'unbekannt';
+$wb['monitor_serverstate_unknown_txt'] = 'Unbekannt';
$wb['monitor_serverstate_info_txt'] = 'Info';
$wb['monitor_serverstate_warning_txt'] = 'Warnung';
-$wb['monitor_serverstate_critical_txt'] = 'kritisch';
+$wb['monitor_serverstate_critical_txt'] = 'Kritisch';
$wb['monitor_serverstate_error_txt'] = 'Fehler';
$wb['monitor_serverstate_moreinfo_txt'] = 'Mehr Informationen...';
$wb['monitor_serverstate_more_txt'] = 'mehr...';
@@ -115,6 +116,11 @@
$wb['monitor_serverstate_updatesok_txt'] = 'Ihr System ist aktuell';
$wb['monitor_serverstate_updatesneeded_txt'] = 'Eine oder mehrere Komponenten benötigen ein Update';
$wb['monitor_serverstate_updatesunknown_txt'] = 'System-Update: ???';
+$wb['monitor_serverstate_beancounterok_txt'] = 'Die Datei Beancounter beinhaltet keine Fehler';
+$wb['monitor_serverstate_beancounterinfo_txt'] = 'Die Datei Beancounter beinhaltet wenige Fehler';
+$wb['monitor_serverstate_beancounterwarning_txt'] = 'Die Datei Beancounter beinhaltet einige Fehler';
+$wb['monitor_serverstate_beancountercritical_txt'] = 'Die Datei Beancounter beinhaltet viele Fehler';
+$wb['monitor_serverstate_beancountererror_txt'] = 'Die Datei Beancounter beinhaltet zu viele Fehler';
$wb['monitor_services_online_txt'] = 'Online';
$wb['monitor_services_offline_txt'] = 'Offline';
$wb['monitor_services_web_txt'] = 'Web-Server:';
@@ -135,4 +141,6 @@
$wb['monitor_title_rkhunterlog_txt'] = 'RKHunter-Protokoll';
$wb['monitor_updates_nosupport_txt'] = 'Ihre Distribution wird für die Überwachung nicht unterstützt';
$wb['monitor_title_fail2ban_txt'] = 'Fail2Ban Log';
+$wb['monitor_title_beancounter_txt'] = 'OpenVz VE BeanCounter';
+$wb['monitor_beancounter_nosupport_txt'] = 'Dieser Server ist kein OpenVz-VE und besitzt deshalb auch keine Beancounter Informationen.';
?>
diff --git a/interface/web/monitor/lib/lang/en.lng b/interface/web/monitor/lib/lang/en.lng
index a28cf09..18aa177 100644
--- a/interface/web/monitor/lib/lang/en.lng
+++ b/interface/web/monitor/lib/lang/en.lng
@@ -115,6 +115,11 @@
$wb['monitor_serverstate_updatesok_txt'] = 'Your system is up to date.';
$wb['monitor_serverstate_updatesneeded_txt'] = 'One or more components needs an update';
$wb['monitor_serverstate_updatesunknown_txt'] = 'System Update: ???';
+$wb['monitor_serverstate_beancounterok_txt'] = 'The beancounter is ok';
+$wb['monitor_serverstate_beancounterinfo_txt'] = 'There are vew failure in the beancounter';
+$wb['monitor_serverstate_beancounterwarning_txt'] = 'There are some failure in the beancounter';
+$wb['monitor_serverstate_beancountercritical_txt'] = 'There are many failure in the beancounter';
+$wb['monitor_serverstate_beancountererror_txt'] = 'There are too much failure in the beancounter';
$wb['monitor_services_online_txt'] = 'Online';
$wb['monitor_services_offline_txt'] = 'Offline';
$wb['monitor_services_web_txt'] = 'Web-Server:';
@@ -134,5 +139,7 @@
$wb['monitor_title_raidstate_txt'] = 'RAID Status';
$wb['monitor_title_rkhunterlog_txt'] = 'RKHunter Log';
$wb['monitor_title_fail2ban_txt'] = 'Fail2Ban Log';
+$wb['monitor_title_beancounter_txt'] = 'OpenVz VE BeanCounter';
$wb['monitor_updates_nosupport_txt'] = 'Your distribution is not supported for this monitoring';
+$wb['monitor_beancounter_nosupport_txt'] = 'This server is not a OpenVz VE and has no beancounter information';
?>
diff --git a/interface/web/monitor/lib/module.conf.php b/interface/web/monitor/lib/module.conf.php
index 7d75816..352cb12 100644
--- a/interface/web/monitor/lib/module.conf.php
+++ b/interface/web/monitor/lib/module.conf.php
@@ -104,6 +104,9 @@
'target' => 'content',
'link' => 'monitor/show_data.php?type=services');
+$items[] = array( 'title' => "Show OpenVz VE BeanCounter",
+ 'target' => 'content',
+ 'link' => 'monitor/show_data.php?type=openvz_beancounter');
$module["nav"][] = array( 'title' => 'Server State',
'open' => 1,
diff --git a/interface/web/monitor/show_data.php b/interface/web/monitor/show_data.php
index 5e7281d..b43d9c8 100644
--- a/interface/web/monitor/show_data.php
+++ b/interface/web/monitor/show_data.php
@@ -82,6 +82,13 @@
$title = $app->lng("Status of services").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
$description = '';
break;
+ case 'openvz_beancounter':
+ $template = 'templates/show_data.htm';
+ $output .= showOpenVzBeanCounter();
+ $time = getDataTime('openvz_beancounter');
+ $title = $app->lng("monitor_title_beancounter_txt") . ' (' . $monTransSrv . ' : ' . $_SESSION['monitor']['server_name'] . ')';
+ $description = '';
+ break;
case 'system_update':
$template = 'templates/show_data.htm';
$output .= showSystemUpdate();
diff --git a/interface/web/monitor/show_sys_state.php b/interface/web/monitor/show_sys_state.php
index 405492c..e089304 100644
--- a/interface/web/monitor/show_sys_state.php
+++ b/interface/web/monitor/show_sys_state.php
@@ -35,15 +35,15 @@
$app->auth->check_module_permissions('monitor');
/* Change the Server if needed */
-if (isset($_GET['server'])){
- $server = explode('|', $_GET['server'], 2);
- $_SESSION['monitor']['server_id'] = $server[0];
- $_SESSION['monitor']['server_name'] = $server[1];
+if (isset($_GET['server'])) {
+ $server = explode('|', $_GET['server'], 2);
+ $_SESSION['monitor']['server_id'] = $server[0];
+ $_SESSION['monitor']['server_name'] = $server[1];
}
/*
* Loading the template
- */
+*/
$app->uses('tpl');
$app->tpl->newTemplate("form.tpl.htm");
$app->tpl->setInclude('content_tpl','templates/show_sys_state.htm');
@@ -53,18 +53,17 @@
/*
* setting the content
- */
-if ($_GET['state'] == 'server')
-{
- $output = _getServerState($_SESSION['monitor']['server_id'], $_SESSION['monitor']['server_name'], true);
- $title = $app->lng("monitor_general_serverstate_txt");
- $stateType = 'server';
+*/
+if ($_GET['state'] == 'server') {
+ $res = _getServerState($_SESSION['monitor']['server_id'], $_SESSION['monitor']['server_name'], true);
+ $output = $res['html_verbose'];
+ $title = $app->lng("monitor_general_serverstate_txt");
+ $stateType = 'server';
}
-else
-{
- $output = _getSysState();
- $title = $app->lng("monitor_general_systemstate_txt");
- $stateType = 'system';
+else {
+ $output = _getSysState();
+ $title = $app->lng("monitor_general_systemstate_txt");
+ $stateType = 'system';
}
$app->tpl->setVar("state_data",$output);
@@ -89,428 +88,524 @@
$tmp .= "<option value='$key'>$val</option>";
}
}
-$app->tpl->setVar("refresh",$tmp);
+$app->tpl->setVar("refresh", $tmp);
/*
* doing the output
- */
+*/
$app->tpl_defaults();
$app->tpl->pparse();
-function _getSysState(){
- global $app;
+/*
+ * Creates HTML representing the state of the system (of all servers)
+*/
+function _getSysState() {
+ global $app;
- /*
- * Get all Servers and calculate the state of them
- */
- $html = '';
+ /** The data of all Servers as (sorted by name) array */
+ $serverData = array();
- $servers = $app->db->queryAllRecords("SELECT server_id, server_name FROM server order by server_name");
- foreach ($servers as $server)
- {
- $html .= _getServerState($server['server_id'], $server['server_name'], false);
- }
+ /*
+ * Get all servers and calculate the state of them
+ */
+ $servers = $app->db->queryAllRecords("SELECT server_id, server_name FROM server order by server_name");
+ foreach ($servers as $server) {
+ $serverData[] = _getServerState($server['server_id'], $server['server_name'], false);
+ }
- return $html;
+ /*
+ * Now we have a array with all servers. Some of them are normal servers, some of them
+ * are OpenVz-Hosts and some are OpenVz-VE's. Next we need to know which of them are
+ * OpenVz-VE's inside a OpenVz-Host (managed by the Monitor). If there is a OpenVZ-VE
+ * inside a OpenVz-Host which is NOT in the Server-Farm and so not handled by the monitor,
+ * we handle it like a "normal" server (in the output of the system-state)
+ */
+ foreach ($serverData as $data) {
+ /* get all VE's of this server */
+ $veInfo = $data['ve_info'];
+
+ /*
+ * if we found some, mark them all as VE's
+ */
+ if (is_array($veInfo)) {
+ foreach ($veInfo as $info) {
+ for ($i = 0; $i < sizeof($serverData); $i++) {
+ if ($serverData[$i]['server_name'] == $info['hostname']) {
+ $serverData[$i]['is_ve'] = true;
+ }
+ }
+ }
+ }
+ }
+
+ /*
+ * Now we have to output all "normal" server or all OpenVZ-Hosts (or all OpenVZ-VE's without
+ * a OpenVZ-Host managed by ISPConfig). The OpenVz-VE's are then included in them...
+ */
+ $html = '';
+
+ foreach ($serverData as $data) {
+ if (!isset($data['is_ve'])) {
+ /*
+ * it is NOT a Ve, so do the output of this server and off all VE's included in them
+ */
+ $html .= $data['html_server'];
+ /* get all VE's of this server */
+ $veInfo = $data['ve_info'];
+ foreach ($veInfo as $info) {
+ for ($i = 0; $i < sizeof($serverData); $i++) {
+ if ($serverData[$i]['server_name'] == $info['hostname']) {
+ $html = str_replace('##VE_INFO##', $serverData[$i]['html_ve'] . '##VE_INFO##', $html);
+ }
+ }
+ }
+ $html = str_replace('##VE_INFO##', '', $html);
+ }
+ }
+ return $html;
}
-/*
- * Calculates the State of ONE Server
+
+/**
+ * returns the state and html of ONE Server
+ * @param integer $serverId the id of the server
+ * @param string $serverName the hostname (like server1.yourdomain.com)
+ * @return array the state and representing html of the server
*/
-function _getServerState($serverId, $serverName, $showAll)
-{
- global $app;
+function _getServerState($serverId, $serverName) {
+ global $app;
- /* The State of the server */
- $serverState = 'ok';
+ /* The State of the server */
+ $serverState = 'ok';
- /** The messages */
- $messages = array();
+ /** The messages */
+ $messages = array();
- /** The Result of the function */
- $res = '';
+ /** The Result of the function */
+ $res = '';
- /*
- * get all monitoring-data from the server als process then
- * (count them and set the server-state)
- */
- $records = $app->db->queryAllRecords("SELECT DISTINCT type, data FROM monitor_data WHERE server_id = " . $serverId);
- $osData = null;
- foreach($records as $record){
- /* get the state from the db-data */
+ /*
+ * Get all monitoring-data from the server and process then
+ */
+ $records = $app->db->queryAllRecords("SELECT DISTINCT type, data FROM monitor_data WHERE server_id = " . $serverId);
+ $osData = null;
+ $veInfo = null;
+ foreach($records as $record) {
+ /* get the state from the db-data */
_processDbState($record['type'], $serverId, &$serverState, &$messages);
/* if we have the os-info, get it */
- if ($record['type'] == 'os_info') $osData = unserialize($record['data']);
- }
-
- $res .= '<div class="systemmonitor-state state-'.$serverState.'">';
- $res .= '<div class="systemmonitor-device device-server">';
- $res .= '<div class="systemmonitor-content icons32 ico-'.$serverState.'">';
- $res .= $app->lng("monitor_serverstate_server_txt") . ': ' . $serverName;
- if ($osData != null){
- $res .= ' (' . $osData['name'] . ' ' . $osData['version'] . ')';
+ if ($record['type'] == 'os_info') {
+ $osData = unserialize($record['data']);
+ }
+ /* if we have the ve-info, get it */
+ if ($record['type'] == 'openvz_veinfo') {
+ $veInfo = unserialize($record['data']);
+ }
}
- $res .= '<br />';
- $res .= $app->lng("monitor_serverstate_state_txt") . ': ' . $serverState . ' (';
- // $res .= sizeof($messages[$app->lng("monitor_serverstate_listok_txt")]) . ' ok | ';
- $res .= sizeof($messages[$app->lng("monitor_serverstate_listunknown_txt")]) . ' ' . $app->lng("monitor_serverstate_unknown_txt") . ', ';
- $res .= sizeof($messages[$app->lng("monitor_serverstate_listinfo_txt")]) . ' ' . $app->lng("monitor_serverstate_info_txt") . ', ';
- $res .= sizeof($messages[$app->lng("monitor_serverstate_listwarning_txt")]) . ' ' . $app->lng("monitor_serverstate_warning_txt") . ', ';
- $res .= sizeof($messages[$app->lng("monitor_serverstate_listcritical_txt")]) . ' ' . $app->lng("monitor_serverstate_critical_txt") . ', ';
- $res .= sizeof($messages[$app->lng("monitor_serverstate_listerror_txt")]) . ' ' . $app->lng("monitor_serverstate_error_txt") . '';
- $res .= ')<br />';
- if ($showAll){
- /*
- * if we have to show all, then we do it...
- */
+ /*
+ * We now have the state of the server. Lets now create the HTML representing this state.
+ * If we actually don't know, which type of verbose we need, let's create all
+ */
- /*
- * Show all messages
- */
- foreach($messages as $key => $state){
- /*
- * There is no need, to show the "ok" - messages
- */
-// if ($key != 'ok')
- {
- $res .= $key . ':<br />';
- foreach ($state as $msg)
- {
- $res .= $msg . '<br />';
- }
- $res .= '<br />';
- }
- }
- }
- else
- {
- /*
- * if not, we only show a link to the server...
- */
- $res .= "<a href='#' onclick='loadContent(\"monitor/show_sys_state.php?state=server&server=" . $serverId . '|' . $serverName . "\");'>" . $app->lng("monitor_serverstate_moreinfo_txt") . "</a>";
- }
- $res .= '</div>';
- $res .= '</div>';
- $res .= '</div>';
+ /*
+ * Info of a VE inside a OpenVz-Host
+ */
+ $html_ve = '<div class="systemmonitor-state state-' . $serverState . '-ve">';
+ $html_ve .= '<div class="systemmonitor-device device-ve">';
+ $html_ve .= '<div class="systemmonitor-content icons32 ico-' . $serverState . '">';
+ $html_ve .= $serverName . '<br>';
+ if ($osData != null) {
+ $html_ve .= $osData['name'] . ' ' . $osData['version'] . '<br>';
+ }
+ $html_ve .= $app->lng("monitor_serverstate_state_txt") . ': ' . $serverState . '<br>';
- if ($showAll){
- /*
- * Show some state-info
- */
- //$res .= showServerLoad();
- //$res .= ' '. showDiskUsage();
- //$res .= ' '.showServices();
- }
+ /*
+ * Info of a "normal" Server or a OpenVz-Host
+ */
+ $html_server .= '<div class="systemmonitor-state state-' . $serverState . '">';
+ $html_server .= '<div class="systemmonitor-device device-server">';
+ $html_server .= '<div class="systemmonitor-content icons32 ico-' . $serverState . '">';
+ $html_server .= $app->lng("monitor_serverstate_server_txt") . ': ' . $serverName;
+ if ($osData != null) {
+ $html_server .= ' (' . $osData['name'] . ' ' . $osData['version'] . ')';
+ }
+ $html_server .= '<br />';
+ $html_server .= $app->lng("monitor_serverstate_state_txt") . ': ' . $serverState . ' (';
+ $html_server .= sizeof($messages[$app->lng("monitor_serverstate_listunknown_txt")]) . ' ' . $app->lng("monitor_serverstate_unknown_txt") . ', ';
+ $html_server .= sizeof($messages[$app->lng("monitor_serverstate_listinfo_txt")]) . ' ' . $app->lng("monitor_serverstate_info_txt") . ', ';
+ $html_server .= sizeof($messages[$app->lng("monitor_serverstate_listwarning_txt")]) . ' ' . $app->lng("monitor_serverstate_warning_txt") . ', ';
+ $html_server .= sizeof($messages[$app->lng("monitor_serverstate_listcritical_txt")]) . ' ' . $app->lng("monitor_serverstate_critical_txt") . ', ';
+ $html_server .= sizeof($messages[$app->lng("monitor_serverstate_listerror_txt")]) . ' ' . $app->lng("monitor_serverstate_error_txt") . '';
+ $html_server .= ')<br />';
- return $res;
+ /*
+ * Verbose - Info
+ */
+ $html_verbose = $html_server;
+ foreach($messages as $key => $state) { {
+ $html_verbose .= $key . ':<br />';
+ foreach ($state as $msg) {
+ $html_verbose .= $msg . '<br />';
+ }
+ $html_verbose .= '<br />';
+ }
+ }
+
+ /*
+ * The normal info also needs a link to the verbose info
+ */
+ $html_ve .= "<a href='#' onclick='loadContent(\"monitor/show_sys_state.php?state=server&server=" . $serverId . '|' . $serverName . "\");'>" . $app->lng("monitor_serverstate_moreinfo_txt") . "</a>";
+ $html_server .= "<a href='#' onclick='loadContent(\"monitor/show_sys_state.php?state=server&server=" . $serverId . '|' . $serverName . "\");'>" . $app->lng("monitor_serverstate_moreinfo_txt") . "</a>";
+
+ /*
+ * Finish all html's
+ */
+ $html_ve .= '</div></div></div>';
+ $html_server .= '<div>##VE_INFO##</div></div></div></div>';
+ $html_verbose .= '</div></div></div>';
+
+ /*
+ * create and return the result
+ */
+ $res['state'] = $serverState;
+ $res['server_name'] = $serverName;
+ $res['html_server'] = $html_server;
+ $res['html_ve'] = $html_ve;
+ $res['html_verbose'] = $html_verbose;
+ $res['ve_info'] = $veInfo;
+ return $res;
}
/*
* gets the state from the db and process it
- */
-function _processDbState($type, $serverId, $serverState, $messages)
-{
- global $app;
+*/
+function _processDbState($type, $serverId, $serverState, $messages) {
+ global $app;
- /*
+ /*
* Always the NEWEST record of each monitoring is responsible for the
* state
- */
- // get the State from the DB
- $record = $app->db->queryOneRecord("SELECT state FROM monitor_data WHERE type = '" . $type . "' and server_id = " . $serverId . " order by created desc");
- // change the new state to the highest state
- $serverState = _setState($serverState, $record['state']);
+ */
+// get the State from the DB
+ $record = $app->db->queryOneRecord("SELECT state FROM monitor_data WHERE type = '" . $type . "' and server_id = " . $serverId . " order by created desc");
+// change the new state to the highest state
+ $serverState = _setState($serverState, $record['state']);
- /*
+ /*
* The message depands on the type and the state
- */
- if ($type == 'cpu_info'){
- /* this type has no state */
- }
- if ($type == 'disk_usage'){
- switch ($record['state']) {
- case 'ok':
- $messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_hdok_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- case 'info':
- $messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_hdgoingfull_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- case 'warning':
- $messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_hdnearlyfull_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- case 'critical':
- $messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_hdveryfull_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- case 'error':
- $messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_hdfull_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
+ */
+ if ($type == 'cpu_info') {
+ /* this type has no state */
+ }
+ if ($type == 'disk_usage') {
+ switch ($record['state']) {
+ case 'ok':
+ $messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_hdok_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ case 'info':
+ $messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_hdgoingfull_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ case 'warning':
+ $messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_hdnearlyfull_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ case 'critical':
+ $messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_hdveryfull_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ case 'error':
+ $messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_hdfull_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
- default:
- $messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_hdunknown_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- }
- }
- if ($type == 'mem_usage'){
- /* this type has no state */
- }
- if ($type == 'server_load'){
- switch ($record['state']) {
- case 'ok':
- $messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_loadok_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- case 'info':
- $messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_loadheavy_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- case 'warning':
- $messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_loadhigh_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- case 'critical':
- $messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_loadhigher_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- case 'error':
- $messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_loadhighest_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- default:
- $messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_loadunknown_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- }
- }
- if ($type == 'services'){
- switch ($record['state']) {
- case 'ok':
- $messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_servicesonline_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=services\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ default:
+ $messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_hdunknown_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ }
+ }
+ if ($type == 'mem_usage') {
+ /* this type has no state */
+ }
+ if ($type == 'server_load') {
+ switch ($record['state']) {
+ case 'ok':
+ $messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_loadok_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ case 'info':
+ $messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_loadheavy_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ case 'warning':
+ $messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_loadhigh_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ case 'critical':
+ $messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_loadhigher_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ case 'error':
+ $messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_loadhighest_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ default:
+ $messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_loadunknown_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ }
+ }
+ if ($type == 'services') {
+ switch ($record['state']) {
+ case 'ok':
+ $messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_servicesonline_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=services\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- case 'error':
- $messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_servicesoffline_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=services\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- default:
- $messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_servicesunknown_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=services\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- }
- }
- if ($type == 'system_update'){
- switch ($record['state']) {
- case 'ok':
- $messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_updatesok_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=system_update\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ case 'error':
+ $messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_servicesoffline_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=services\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ default:
+ $messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_servicesunknown_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=services\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ }
+ }
+ if ($type == 'system_update') {
+ switch ($record['state']) {
+ case 'ok':
+ $messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_updatesok_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=system_update\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- case 'warning':
- $messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_updatesneeded_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=system_update\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- case 'no_state':
- /*
+ break;
+ case 'info':
+ $messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_updatesneeded_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=system_update\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ case 'no_state':
+ /*
* not debian and not Ubuntu, so the state could not be monitored...
- */
- break;
- default:
- $messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_updatesunknown_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=system_update\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- }
- }
+ */
+ break;
+ default:
+ $messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_updatesunknown_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=system_update\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ }
+ }
- if ($type == 'raid_state'){
- switch ($record['state']) {
- case 'ok':
- $messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_raidok_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- case 'info':
- $messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_raidresync_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- case 'critical':
- $messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_raidfault_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- case 'error':
- $messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_raiderror_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- case 'no_state':
- /*
+ if ($type == 'raid_state') {
+ switch ($record['state']) {
+ case 'ok':
+ $messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_raidok_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ case 'info':
+ $messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_raidresync_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ case 'critical':
+ $messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_raidfault_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ case 'error':
+ $messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_raiderror_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ case 'no_state':
+ /*
* mdadm is not installed or the RAID is not supported...
- */
- break;
- default:
- $messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_raidunknown_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- }
- }
+ */
+ break;
+ default:
+ $messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_raidunknown_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ }
+ }
+
+ if ($type == 'openvz_beancounter') {
+ switch ($record['state']) {
+ case 'ok':
+ $messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_beancounterok_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=openvz_beancounter\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ case 'info':
+ $messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_beancounterinfo_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=openvz_beancounter\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ case 'warning':
+ $messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_beancounterwarning_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=openvz_beancounter\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ case 'critical':
+ $messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_beancountercritical_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=openvz_beancounter\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ case 'error':
+ $messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_beancountererror_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=openvz_beancounter\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ default:
+ break;
+ }
+ }
- if ($type == 'mailq'){
- switch ($record['state']) {
- case 'ok':
- $messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_mailqok_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- case 'info':
- $messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_mailqheavy_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- case 'warning':
- $messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_mailqhigh_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- case 'critical':
- $messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_mailqhigher_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- case 'error':
- $messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_mailqhighest_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- default:
- $messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_mailqunknown_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- }
- }
+ if ($type == 'mailq') {
+ switch ($record['state']) {
+ case 'ok':
+ $messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_mailqok_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ case 'info':
+ $messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_mailqheavy_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ case 'warning':
+ $messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_mailqhigh_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ case 'critical':
+ $messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_mailqhigher_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ case 'error':
+ $messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_mailqhighest_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ default:
+ $messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_mailqunknown_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ }
+ }
- if ($type == 'sys_log'){
- switch ($record['state']) {
- case 'ok':
- $messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_syslogok_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/log_list.php\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- case 'warning':
- $messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_syslogwarning_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/log_list.php\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- case 'error':
- $messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_syslogerror_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/log_list.php\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- default:
- $messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_syslogunknown_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/log_list.php\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- }
- }
+ if ($type == 'sys_log') {
+ switch ($record['state']) {
+ case 'ok':
+ $messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_syslogok_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/log_list.php\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ case 'warning':
+ $messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_syslogwarning_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/log_list.php\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ case 'error':
+ $messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_syslogerror_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/log_list.php\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ default:
+ $messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_syslogunknown_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/log_list.php\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ }
+ }
- if ($type == 'log_clamav'){
- /* this type has no state */
- }
+ if ($type == 'log_clamav') {
+ /* this type has no state */
+ }
- if ($type == 'log_freshclam'){
- switch ($record['state']) {
- case 'ok':
- $messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_fclamok_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_log.php?log=log_freshclam\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- case 'warning':
- $messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_fclamoutdated_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_log.php?log=log_freshclam\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- default:
- $messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_fclamunknown_txt") . ' ' .
- "<a href='#' onclick='loadContent(\"monitor/show_log.php?log=log_freshclam\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
- break;
- }
- }
+ if ($type == 'log_freshclam') {
+ switch ($record['state']) {
+ case 'ok':
+ $messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_fclamok_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_log.php?log=log_freshclam\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ case 'info':
+ $messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_fclamoutdated_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_log.php?log=log_freshclam\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ default:
+ $messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_fclamunknown_txt") . ' ' .
+ "<a href='#' onclick='loadContent(\"monitor/show_log.php?log=log_freshclam\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+ break;
+ }
+ }
- if ($type == 'log_ispconfig'){
- /* this type has no state */
- }
- if ($type == 'log_mail'){
- /* this type has no state */
- }
- if ($type == 'log_mail_err'){
- /* this type has no state */
- }
- if ($type == 'log_mail_warn'){
- /* this type has no state */
- }
- if ($type == 'log_messages'){
- /* this type has no state */
- }
- if ($type == 'rkhunter'){
- /* this type has no state */
- }
+ if ($type == 'log_ispconfig') {
+ /* this type has no state */
+ }
+ if ($type == 'log_mail') {
+ /* this type has no state */
+ }
+ if ($type == 'log_mail_err') {
+ /* this type has no state */
+ }
+ if ($type == 'log_mail_warn') {
+ /* this type has no state */
+ }
+ if ($type == 'log_messages') {
+ /* this type has no state */
+ }
+ if ($type == 'rkhunter') {
+ /* this type has no state */
+ }
}
- /*
+/*
* Set the state to the given level (or higher, but not lesser).
* * If the actual state is critical and you call the method with ok,
* then the state is critical.
*
* * If the actual state is critical and you call the method with error,
* then the state is error.
- */
-function _setState($oldState, $newState)
-{
- /*
+*/
+function _setState($oldState, $newState) {
+ /*
* Calculate the weight of the old state
- */
- switch ($oldState) {
- case 'no_state': $oldInt = 0;
- break;
- case 'ok': $oldInt = 1;
- break;
- case 'unknown': $oldInt = 2;
- break;
- case 'info': $oldInt = 3;
- break;
- case 'warning': $oldInt = 4;
- break;
- case 'critical': $oldInt = 5;
- break;
- case 'error': $oldInt = 6;
- break;
- }
- /*
+ */
+ switch ($oldState) {
+ case 'no_state': $oldInt = 0;
+ break;
+ case 'ok': $oldInt = 1;
+ break;
+ case 'unknown': $oldInt = 2;
+ break;
+ case 'info': $oldInt = 3;
+ break;
+ case 'warning': $oldInt = 4;
+ break;
+ case 'critical': $oldInt = 5;
+ break;
+ case 'error': $oldInt = 6;
+ break;
+ }
+ /*
* Calculate the weight of the new state
- */
- switch ($newState) {
- case 'no_state': $newInt = 0 ;
- break;
- case 'ok': $newInt = 1 ;
- break;
- case 'unknown': $newInt = 2 ;
- break;
- case 'info': $newInt = 3 ;
- break;
- case 'warning': $newInt = 4 ;
- break;
- case 'critical': $newInt = 5 ;
- break;
- case 'error': $newInt = 6 ;
- break;
- }
+ */
+ switch ($newState) {
+ case 'no_state': $newInt = 0 ;
+ break;
+ case 'ok': $newInt = 1 ;
+ break;
+ case 'unknown': $newInt = 2 ;
+ break;
+ case 'info': $newInt = 3 ;
+ break;
+ case 'warning': $newInt = 4 ;
+ break;
+ case 'critical': $newInt = 5 ;
+ break;
+ case 'error': $newInt = 6 ;
+ break;
+ }
- /*
+ /*
* Set to the higher level
- */
- if ($newInt > $oldInt){
- return $newState;
- }
- else
- {
- return $oldState;
- }
+ */
+ if ($newInt > $oldInt) {
+ return $newState;
+ }
+ else {
+ return $oldState;
+ }
}
?>
diff --git a/interface/web/monitor/tools.inc.php b/interface/web/monitor/tools.inc.php
index 8bee86c..f407c60 100644
--- a/interface/web/monitor/tools.inc.php
+++ b/interface/web/monitor/tools.inc.php
@@ -26,21 +26,21 @@
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-function showServerLoad(){
- global $app;
+function showServerLoad() {
+ global $app;
- /* fetch the Data from the DB */
- $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");
+ /* fetch the Data from the DB */
+ $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");
- if(isset($record['data'])) {
- $data = unserialize($record['data']);
+ if(isset($record['data'])) {
+ $data = unserialize($record['data']);
- /*
+ /*
Format the data
- */
+ */
if (strlen($data['up_minutes']) == "1") $data['up_minutes'] = "0".$data['up_minutes'];
- $html =
- '<div class="systemmonitor-state state-'.$record['state'].'">
+ $html =
+ '<div class="systemmonitor-state state-'.$record['state'].'">
<div class="systemmonitor-content icons32 ico-'.$record['state'].'">
<table>
<tr>
@@ -51,7 +51,7 @@
<td>' . $app->lng("Users online").':</td>
<td>' . $data['user_online'] . '</td>
</tr>' .
- '<tr>
+ '<tr>
<td>' . $app->lng("System load 1 minute") . ':</td>
<td>' . $data['load_1'] . '</td>
</tr>
@@ -66,27 +66,27 @@
</table>
</div>
</div>';
- } else {
- $html = '<p>'.$app->lng("no_data_serverload_txt").'</p>';
- }
+ } else {
+ $html = '<p>'.$app->lng("no_data_serverload_txt").'</p>';
+ }
- return $html;
+ return $html;
}
function showDiskUsage () {
- global $app;
+ global $app;
- /* fetch the Data from the DB */
- $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");
+ /* fetch the Data from the DB */
+ $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");
- if(isset($record['data'])) {
- $data = unserialize($record['data']);
+ if(isset($record['data'])) {
+ $data = unserialize($record['data']);
- /*
+ /*
Format the data
- */
- $html =
- '<div class="systemmonitor-state state-'.$record['state'].'">
+ */
+ $html =
+ '<div class="systemmonitor-state state-'.$record['state'].'">
<div class="systemmonitor-content icons32 ico-'.$record['state'].'">
<table>
<tr>
@@ -98,359 +98,389 @@
<td>'.$app->lng("monitor_diskusage_usage_txt").'</td>
<td>'.$app->lng("monitor_diskusage_mounted_txt").'</td>
</tr>';
- foreach($data as $line) {
- $html .= '<tr>';
- foreach ($line as $item) {
- $html .= '<td>' . $item . '</td>';
- }
- $html .= '</tr>';
- }
- $html .= '</table>';
- $html .= '</div></div>';
- } else {
- $html = '<p>'.$app->lng("no_data_diskusage_txt").'</p>';
- }
+ foreach($data as $line) {
+ $html .= '<tr>';
+ foreach ($line as $item) {
+ $html .= '<td>' . $item . '</td>';
+ }
+ $html .= '</tr>';
+ }
+ $html .= '</table>';
+ $html .= '</div></div>';
+ } else {
+ $html = '<p>'.$app->lng("no_data_diskusage_txt").'</p>';
+ }
- return $html;
+ return $html;
}
function showMemUsage () {
- global $app;
+ global $app;
- /* fetch the Data from the DB */
- $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");
+ /* fetch the Data from the DB */
+ $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");
- if(isset($record['data'])) {
- $data = unserialize($record['data']);
+ if(isset($record['data'])) {
+ $data = unserialize($record['data']);
- /*
+ /*
Format the data
- */
- $html =
- '<div class="systemmonitor-state state-'.$record['state'].'">
+ */
+ $html =
+ '<div class="systemmonitor-state state-'.$record['state'].'">
<div class="systemmonitor-content icons32 ico-'.$record['state'].'">
<table>';
- foreach($data as $key => $value){
- if ($key != '') {
- $html .= '<tr>
+ foreach($data as $key => $value) {
+ if ($key != '') {
+ $html .= '<tr>
<td>' . $key . ':</td>
<td>' . $value . '</td>
</tr>';
- }
- }
- $html .= '</table>';
- $html .= '</div></div>';
+ }
+ }
+ $html .= '</table>';
+ $html .= '</div></div>';
- } else {
- $html = '<p>'.$app->lng("no_data_memusage_txt").'</p>';
- }
+ } else {
+ $html = '<p>'.$app->lng("no_data_memusage_txt").'</p>';
+ }
- return $html;
+ return $html;
}
function showCpuInfo () {
- global $app;
+ global $app;
- /* fetch the Data from the DB */
- $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");
+ /* fetch the Data from the DB */
+ $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");
- if(isset($record['data'])) {
- $data = unserialize($record['data']);
+ if(isset($record['data'])) {
+ $data = unserialize($record['data']);
- /*
+ /*
Format the data
- */
- $html =
- '<div class="systemmonitor-state state-'.$record['state'].'">
+ */
+ $html =
+ '<div class="systemmonitor-state state-'.$record['state'].'">
<div class="systemmonitor-content icons32 ico-'.$record['state'].'">
<table>';
- foreach($data as $key => $value){
- if ($key != '') {
- $html .= '<tr>
+ foreach($data as $key => $value) {
+ if ($key != '') {
+ $html .= '<tr>
<td>' . $key . ':</td>
<td>' . $value . '</td>
</tr>';
- }
- }
- $html .= '</table>';
- $html .= '</div></div>';
- } else {
- $html = '<p>'.$app->lng("no_data_cpuinfo_txt").'</p>';
- }
+ }
+ }
+ $html .= '</table>';
+ $html .= '</div></div>';
+ } else {
+ $html = '<p>'.$app->lng("no_data_cpuinfo_txt").'</p>';
+ }
- return $html;
+ return $html;
}
function showServices () {
- global $app;
+ global $app;
- /* fetch the Data from the DB */
- $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'services' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+ /* fetch the Data from the DB */
+ $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'services' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
- if(isset($record['data'])) {
- $data = unserialize($record['data']);
+ if(isset($record['data'])) {
+ $data = unserialize($record['data']);
- /*
+ /*
Format the data
- */
- $html =
- '<div class="systemmonitor-state state-'.$record['state'].'">
+ */
+ $html =
+ '<div class="systemmonitor-state state-'.$record['state'].'">
<div class="systemmonitor-content icons32 ico-'.$record['state'].'">
<table>';
- if($data['webserver'] != -1) {
- if($data['webserver'] == 1) {
- $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
- } else {
- $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
- }
- $html .= '<tr>
+ if($data['webserver'] != -1) {
+ if($data['webserver'] == 1) {
+ $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
+ } else {
+ $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
+ }
+ $html .= '<tr>
<td>'.$app->lng("monitor_services_web_txt").'</td>
<td>'.$status.'</td>
</tr>';
- }
+ }
- if($data['ftpserver'] != -1) {
- if($data['ftpserver'] == 1) {
- $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
- } else {
- $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
- }
- $html .= '<tr>
+ if($data['ftpserver'] != -1) {
+ if($data['ftpserver'] == 1) {
+ $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
+ } else {
+ $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
+ }
+ $html .= '<tr>
<td>'.$app->lng("monitor_services_ftp_txt").'</td>
<td>'.$status.'</td>
</tr>';
- }
+ }
- if($data['smtpserver'] != -1) {
- if($data['smtpserver'] == 1) {
- $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
- } else {
- $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
- }
- $html .= '<tr>
+ if($data['smtpserver'] != -1) {
+ if($data['smtpserver'] == 1) {
+ $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
+ } else {
+ $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
+ }
+ $html .= '<tr>
<td>'.$app->lng("monitor_services_smtp_txt").'</td>
<td>'.$status.'</td>
</tr>';
- }
+ }
- if($data['pop3server'] != -1) {
- if($data['pop3server'] == 1) {
- $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
- } else {
- $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
- }
- $html .= '<tr>
+ if($data['pop3server'] != -1) {
+ if($data['pop3server'] == 1) {
+ $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
+ } else {
+ $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
+ }
+ $html .= '<tr>
<td>'.$app->lng("monitor_services_pop_txt").'</td>
<td>'.$status.'</td>
</tr>';
- }
+ }
- if($data['imapserver'] != -1) {
- if($data['imapserver'] == 1) {
- $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
- } else {
- $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
- }
- $html .= '<tr>
+ if($data['imapserver'] != -1) {
+ if($data['imapserver'] == 1) {
+ $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
+ } else {
+ $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
+ }
+ $html .= '<tr>
<td>'.$app->lng("monitor_services_imap_txt").'</td>
<td>'.$status.'</td>
</tr>';
- }
+ }
- if($data['bindserver'] != -1) {
- if($data['bindserver'] == 1) {
- $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
- } else {
- $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
- }
- $html .= '<tr>
+ if($data['bindserver'] != -1) {
+ if($data['bindserver'] == 1) {
+ $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
+ } else {
+ $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
+ }
+ $html .= '<tr>
<td>'.$app->lng("monitor_services_mydns_txt").'</td>
<td>'.$status.'</td>
</tr>';
- }
+ }
- if($data['mysqlserver'] != -1) {
- if($data['mysqlserver'] == 1) {
- $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
- } else {
- $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
- }
- $html .= '<tr>
+ if($data['mysqlserver'] != -1) {
+ if($data['mysqlserver'] == 1) {
+ $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
+ } else {
+ $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
+ }
+ $html .= '<tr>
<td>'.$app->lng("monitor_services_mysql_txt").'</td>
<td>'.$status.'</td>
</tr>';
- }
+ }
- $html .= '</table></div></div>';
- } else {
- $html = '<p>'.$app->lng("no_data_services_txt").'</p>';
- }
+ $html .= '</table></div></div>';
+ } else {
+ $html = '<p>'.$app->lng("no_data_services_txt").'</p>';
+ }
- return $html;
+ return $html;
}
function showSystemUpdate() {
- global $app;
+ global $app;
- /* fetch the Data from the DB */
- $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");
+ /* fetch the Data from the DB */
+ $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");
- if(isset($record['data'])) {
- $html =
- '<div class="systemmonitor-state state-'.$record['state'].'">
+ if(isset($record['data'])) {
+ $html =
+ '<div class="systemmonitor-state state-'.$record['state'].'">
<div class="systemmonitor-content icons32 ico-'.$record['state'].'">';
- /*
+ /*
* First, we have to detect, if there is any monitoring-data.
* If not (because the destribution is not supported) show this.
- */
- if ($record['state'] == 'no_state'){
- $html .= '<p>'.$app->lng("monitor_updates_nosupport_txt").'</p>';
- }
- else {
- $data = unserialize($record['data']);
- $html .= nl2br($data['output']);
- }
- $html .= '</div></div>';
- } else {
- $html = '<p>'.$app->lng("no_data_updates_txt").'</p>';
- }
+ */
+ if ($record['state'] == 'no_state') {
+ $html .= '<p>'.$app->lng("monitor_updates_nosupport_txt").'</p>';
+ }
+ else {
+ $data = unserialize($record['data']);
+ $html .= nl2br($data['output']);
+ }
+ $html .= '</div></div>';
+ } else {
+ $html = '<p>'.$app->lng("no_data_updates_txt").'</p>';
+ }
- return $html;
+ return $html;
+}
+
+
+function showOpenVzBeancounter() {
+ global $app;
+
+ /* fetch the Data from the DB */
+ $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");
+
+ if(isset($record['data'])) {
+ $html =
+ '<div class="systemmonitor-state state-'.$record['state'].'">
+ <div class="systemmonitor-content icons32 ico-'.$record['state'].'">';
+ /*
+ * First, we have to detect, if there is any monitoring-data.
+ * If not (because the server is not a VE) show this.
+ */
+ $data = unserialize($record['data']);
+ if ((!isset($data)) || ($data == '')) {
+ $html .= '<p>'.$app->lng("monitor_beancounter_nosupport_txt").'</p>';
+ }
+ else {
+ $html .= '<pre>' . nl2br($data) . '</pre>';
+ }
+ $html .= '</div></div>';
+ } else {
+ $html = '<p>'.$app->lng("no_data_updates_txt").'</p>';
+ }
+
+ return $html;
}
function showRaidState() {
- global $app;
+ global $app;
- /* fetch the Data from the DB */
- $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");
+ /* fetch the Data from the DB */
+ $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");
- if(isset($record['data'])) {
- $html =
- '<div class="systemmonitor-state state-'.$record['state'].'">
+ if(isset($record['data'])) {
+ $html =
+ '<div class="systemmonitor-state state-'.$record['state'].'">
<div class="systemmonitor-content icons32 ico-'.$record['state'].'">';
- /*
+ /*
* First, we have to detect, if there is any monitoring-data.
* If not (because the destribution is not supported) show this.
- */
- if ($record['state'] == 'no_state'){
- $html .= '<p>'.$app->lng("monitor_nomdadm_txt").'</p>';
- }
- else {
- $data = unserialize($record['data']);
- $html .= nl2br($data['output']);
- }
- $html .= '</div></div>';
+ */
+ if ($record['state'] == 'no_state') {
+ $html .= '<p>'.$app->lng("monitor_nomdadm_txt").'</p>';
+ }
+ else {
+ $data = unserialize($record['data']);
+ $html .= nl2br($data['output']);
+ }
+ $html .= '</div></div>';
- } else {
- $html = '<p>'.$app->lng("no_data_raid_txt").'</p>';
- }
+ } else {
+ $html = '<p>'.$app->lng("no_data_raid_txt").'</p>';
+ }
- return $html;
+ return $html;
}
function showRKHunter() {
- global $app;
+ global $app;
- /* fetch the Data from the DB */
- $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'rkhunter' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+ /* fetch the Data from the DB */
+ $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'rkhunter' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
- if(isset($record['data'])) {
- $html =
- '<div class="systemmonitor-state state-'.$record['state'].'">
+ if(isset($record['data'])) {
+ $html =
+ '<div class="systemmonitor-state state-'.$record['state'].'">
<div class="systemmonitor-content icons32 ico-'.$record['state'].'">';
- /*
+ /*
* First, we have to detect, if there is any monitoring-data.
* If not (because rkhunter is not installed) show this.
- */
- $data = unserialize($record['data']);
- if ($data['output'] == ''){
- $html .= '<p>'.$app->lng("monitor_norkhunter_txt").'</p>';
- }
- else {
- $html .= nl2br($data['output']);
- }
- $html .= '</div></div>';
+ */
+ $data = unserialize($record['data']);
+ if ($data['output'] == '') {
+ $html .= '<p>'.$app->lng("monitor_norkhunter_txt").'</p>';
+ }
+ else {
+ $html .= nl2br($data['output']);
+ }
+ $html .= '</div></div>';
- } else {
- $html = '<p>'.$app->lng("no_data_rkhunter_txt").'</p>';
- }
+ } else {
+ $html = '<p>'.$app->lng("no_data_rkhunter_txt").'</p>';
+ }
- return $html;
+ return $html;
}
function showFail2ban() {
- global $app;
+ global $app;
- /* fetch the Data from the DB */
- $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");
+ /* fetch the Data from the DB */
+ $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");
- if(isset($record['data'])) {
- $html =
- '<div class="systemmonitor-state state-'.$record['state'].'">
+ if(isset($record['data'])) {
+ $html =
+ '<div class="systemmonitor-state state-'.$record['state'].'">
<div class="systemmonitor-content icons32 ico-'.$record['state'].'">';
- /*
+ /*
* First, we have to detect, if there is any monitoring-data.
* If not (because fail2ban is not installed) show this.
- */
- $data = unserialize($record['data']);
- if ($data == ''){
- $html .= '<p>'.
- 'fail2ban is not installed at this server.<br />' .
- 'See more (for debian) <a href="http://www.howtoforge.com/fail2ban_debian_etch" target="htf">here...</a>'.
- '</p>';
- }
- else {
- $html .= nl2br($data);
- }
- $html .= '</div></div>';
+ */
+ $data = unserialize($record['data']);
+ if ($data == '') {
+ $html .= '<p>'.
+ 'fail2ban is not installed at this server.<br />' .
+ 'See more (for debian) <a href="http://www.howtoforge.com/fail2ban_debian_etch" target="htf">here...</a>'.
+ '</p>';
+ }
+ else {
+ $html .= nl2br($data);
+ }
+ $html .= '</div></div>';
- } else {
- $html = '<p>There is no data available at the moment.</p>';
- }
+ } else {
+ $html = '<p>There is no data available at the moment.</p>';
+ }
- return $html;
+ return $html;
}
function showMailq() {
- global $app;
+ global $app;
- /* fetch the Data from the DB */
- $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'mailq' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+ /* fetch the Data from the DB */
+ $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'mailq' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
- if(isset($record['data'])) {
- $data = unserialize($record['data']);
- $html = nl2br($data['output']);
- } else {
- $html = '<p>'.$app->lng("no_data_mailq_txt").'</p>';
- }
+ if(isset($record['data'])) {
+ $data = unserialize($record['data']);
+ $html = nl2br($data['output']);
+ } else {
+ $html = '<p>'.$app->lng("no_data_mailq_txt").'</p>';
+ }
- return $html;
+ return $html;
}
function getDataTime($type) {
- global $app;
+ global $app;
- /* fetch the Data from the DB */
- $record = $app->db->queryOneRecord("SELECT created FROM monitor_data WHERE type = '" . $type . "' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+ /* fetch the Data from the DB */
+ $record = $app->db->queryOneRecord("SELECT created FROM monitor_data WHERE type = '" . $type . "' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
- /* TODO: datetimeformat should be set somewhat other way */
- $dateTimeFormat = $app->lng("monitor_settings_datetimeformat_txt");
+ /* TODO: datetimeformat should be set somewhat other way */
+ $dateTimeFormat = $app->lng("monitor_settings_datetimeformat_txt");
- if(isset($record['created'])) {
+ if(isset($record['created'])) {
// $res = date('Y-m-d H:i', $record['created']);
- $res = date($dateTimeFormat, $record['created']);
- } else {
- $res = '????-??-?? ??:??';
- }
- return $res;
+ $res = date($dateTimeFormat, $record['created']);
+ } else {
+ $res = '????-??-?? ??:??';
+ }
+ return $res;
}
?>
diff --git a/interface/web/themes/default/css/screen/content_ispc.css b/interface/web/themes/default/css/screen/content_ispc.css
index aca368d..a6fdd9a 100644
--- a/interface/web/themes/default/css/screen/content_ispc.css
+++ b/interface/web/themes/default/css/screen/content_ispc.css
@@ -105,9 +105,11 @@
/* Systemmonitor */
.systemmonitor-state {
- margin: 10px 0;
+ margin: 10px 5px;
font-family: Consolas, "Lucida Console", "Courier New", monospace;
font-size: 0.9em;
+ float: left;
+ width: 100%;
}
.systemmonitor-state.state-no_state {
border-top: 4px solid #95A19F;
@@ -122,8 +124,8 @@
background-color: #adffa2;
}
.systemmonitor-state.state-info {
- border-top: 4px solid #fdff00;
- background-color: #fdffa2;
+ border-top: 4px solid #183e99;
+ background-color: #d4e2ff;
}
.systemmonitor-state.state-warning {
border-top: 4px solid #ffa800;
@@ -137,17 +139,68 @@
border-top: 4px solid #ff0000;
background-color: #ff7f7f;
}
+ .systemmonitor-state.state-no_state-ve {
+ float: left;
+ width: 213px;
+ border-top: 4px solid #95A19F;
+ background-color: #f8f8ff;
+ }
+ .systemmonitor-state.state-unknown-ve {
+ float: left;
+ width: 213px;
+ border-top: 4px solid #30302e;
+ background-color: #cecfc5;
+ }
+ .systemmonitor-state.state-ok-ve {
+ float: left;
+ width: 213px;
+ border-top: 4px solid #23fb00;
+ background-color: #adffa2;
+ }
+ .systemmonitor-state.state-info-ve {
+ float: left;
+ width: 213px;
+ border-top: 4px solid #183e99;
+ background-color: #d4e2ff;
+ }
+ .systemmonitor-state.state-warning-ve {
+ float: left;
+ width: 213px;
+ border-top: 4px solid #ffa800;
+ background-color: #ffda93;
+ }
+ .systemmonitor-state.state-critical-ve {
+ float: left;
+ width: 213px;
+ border-top: 4px solid #ff0000;
+ background-color: #ffb9b9;
+ }
+ .systemmonitor-state.state-error-ve {
+ float: left;
+ width: 213px;
+ border-top: 4px solid #ff0000;
+ background-color: #ff7f7f;
+ }
.systemmonitor-device {
+ background-position: -6px 4px;
background-repeat: no-repeat;
- background-position: 12px 4px;
min-height: 80px;
}
.systemmonitor-device.device-system { background-image: url("../../icons/x64/network.png"); }
- .systemmonitor-device.device-server { background-image: url("../../icons/x64/server.png"); }
+ .systemmonitor-device.device-server {
+ background-image: url("../../icons/x64/server.png");
+ }
+ .systemmonitor-device.device-ve {
+ background-image: url("../../icons/x64/server.png");
+ width: 213px;
+ float: left;
+ border: 1px dashed #aaaaaa;
+ border-top: none;
+ }
.systemmonitor-content.icons32 {
- padding:2px 10px 2px 80px;
+ padding:2px 10px 2px 56px;
background-repeat: no-repeat;
background-position: 12px 4px;
}
diff --git a/server/lib/classes/openvz_tools.inc.php b/server/lib/classes/openvz_tools.inc.php
new file mode 100644
index 0000000..403613c
--- /dev/null
+++ b/server/lib/classes/openvz_tools.inc.php
@@ -0,0 +1,149 @@
+<?php
+/*
+Copyright (c) 2010, Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of ISPConfig nor the names of its contributors
+ may be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+class openvz_tools {
+ /**
+ * Checks, if the server ist a OpenVZ - Host
+ */
+ public function isOpenVzHost() {
+ /*
+ * if there is a "/proc/user_beanconters" we have OpenVz "in use"
+ */
+ if (file_exists('/proc/user_beancounters')) {
+ /*
+ * if "vzctl" exists, it is a host
+ */
+ system('which vzctl', $retval);
+ if($retval === 0) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ else {
+ return false;
+ }
+ }
+
+ /**
+ * Checks, if the server ist a OpenVZ - VE
+ */
+ public function isOpenVzVe() {
+ /*
+ * if there is a "/proc/user_beanconters" we have OpenVz "in use"
+ */
+ if (file_exists('/proc/user_beancounters')) {
+ /*
+ * if "vzctl" does not exists, it is a VE
+ */
+ system('which vzctl', $retval);
+ if($retval === 0) {
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+ else {
+ return false;
+ }
+ }
+
+ /**
+ * Return information about all created VE's at this Host
+ */
+ public function getOpenVzVeInfo() {
+ /*
+ * If it is not a OpenVz - Host, we have NO VE's
+ */
+ if (!$this->isOpenVzHost()) {
+ return array();
+ }
+ /*
+ * if it is a OpenVz-Host, we first have to get the VE - List and then parse it to a array
+ */
+ $output = shell_exec('vzlist -a');
+
+ /* transfer this output-string into a array */
+ $outputArray = explode("\n", $output);
+
+ /* the first list of the output is not needed */
+ array_shift($outputArray);
+
+ /* now process all items of the rest */
+ $res = array();
+ foreach ($outputArray as $item) {
+ /*
+ * eliminate all doubled spaces and spaces at the beginning and end
+ */
+ while (strpos($item, ' ') !== false) {
+ $item = str_replace(' ', ' ', $item);
+ }
+ $item = trim($item);
+
+ /*
+ * Now get every token and insert it to the array
+ */
+ if ($item != '') {
+ $tmp = explode(' ', $item);
+ $tmpRes['veid'] = $tmp[0];
+ $tmpRes['nproc'] = $tmp[1];
+ $tmpRes['status'] = $tmp[2];
+ $tmpRes['ip_addr'] = $tmp[3];
+ $tmpRes['hostname'] = $tmp[4];
+ $res[] = $tmpRes;
+ }
+ }
+
+ /* ready */
+ return $res;
+ }
+
+ /**
+ * Return information about the user_beancounters of this VE
+ */
+ public function getOpenVzVeBeanCounter() {
+ /*
+ * If it is not a OpenVz - VE, we need no beancounter, because we use the beancounter
+ * "inside" of each VE
+ */
+ if (!$this->isOpenVzVe()) {
+ return "";
+ }
+ /*
+ * if it is a OpenVz-VE, we get the output to a string
+ */
+ $res = file_get_contents('/proc/user_beancounters');
+
+ /* ready */
+ return $res;
+ }
+}
+?>
\ No newline at end of file
diff --git a/server/mods-available/monitor_core_module.inc.php b/server/mods-available/monitor_core_module.inc.php
index 7f15626..f0e7771 100644
--- a/server/mods-available/monitor_core_module.inc.php
+++ b/server/mods-available/monitor_core_module.inc.php
@@ -51,26 +51,7 @@
global $app;
/*
- Annonce the actions that where provided by this module, so plugins
- can register on them.
- */
- /* none at them moment */
- //$app->plugins->announceEvents($this->module_name,$this->actions_available);
-
- /*
- As we want to get notified of any changes on several database tables,
- we register for them.
-
- The following function registers the function "functionname"
- to be executed when a record for the table "dbtable" is
- processed in the sys_datalog. "classname" is the name of the
- class that contains the function functionname.
- */
- /* none at them moment */
- //$app->modules->registerTableHook('mail_access','mail_module','process');
-
- /*
- Do the monitor every n minutes and write the result in the db
+ * Do the monitor every n minutes and write the result to the db
*/
$min = date('i');
if (($min % $this->interval) == 0) {
@@ -83,15 +64,7 @@
The function then raises the events for the plugins.
*/
function process($tablename, $action, $data) {
- // global $app;
- //
- // switch ($tablename) {
- // case 'mail_access':
- // if($action == 'i') $app->plugins->raiseEvent('mail_access_insert',$data);
- // if($action == 'u') $app->plugins->raiseEvent('mail_access_update',$data);
- // if($action == 'd') $app->plugins->raiseEvent('mail_access_delete',$data);
- // break;
- // } // end switch
+ // not needed
} // end function
//** Get distribution identifier
@@ -228,6 +201,8 @@
$this->monitorMemUsage();
$this->monitorCpu();
$this->monitorServices();
+ $this->monitorOpenVzHost();
+ $this->monitorOpenVzUserBeancounter();
$this->monitorMailLog();
$this->monitorMailWarnLog();
$this->monitorMailErrLog();
@@ -296,7 +271,7 @@
$app->dbmaster->query($sql);
/* The new data is written, now we can delete the old one */
- $this->_delOldRecords($type, 10);
+ $this->_delOldRecords($type, 4);
}
function monitorOsVer() {
@@ -334,10 +309,10 @@
$app->dbmaster->query($sql);
/* The new data is written, now we can delete the old one */
- $this->_delOldRecords($type, 10);
+ $this->_delOldRecords($type, 4);
}
-
+
function monitorDiskUsage() {
global $app;
global $conf;
@@ -403,7 +378,7 @@
$app->dbmaster->query($sql);
/* The new data is written, now we can delete the old one */
- $this->_delOldRecords($type, 10);
+ $this->_delOldRecords($type, 4);
}
@@ -453,7 +428,7 @@
$app->dbmaster->query($sql);
/* The new data is written, now we can delete the old one */
- $this->_delOldRecords($type, 10);
+ $this->_delOldRecords($type, 4);
}
@@ -500,7 +475,7 @@
$app->dbmaster->query($sql);
/* The new data is written, now we can delete the old one */
- $this->_delOldRecords($type, 10);
+ $this->_delOldRecords($type, 4);
}
@@ -616,7 +591,116 @@
$app->dbmaster->query($sql);
/* The new data is written, now we can delete the old one */
- $this->_delOldRecords($type, 10);
+ $this->_delOldRecords($type, 4);
+ }
+
+
+ function monitorOpenVzHost() {
+ global $app;
+ global $conf;
+
+ /* the id of the server as int */
+ $server_id = intval($conf["server_id"]);
+
+ /** The type of the data */
+ $type = 'openvz_veinfo';
+
+ /*
+ Fetch the data into a array
+ */
+ $app->load(openvz_tools);
+ $openVzTools = new openvz_tools();
+ $data = $openVzTools->getOpenVzVeInfo();
+
+ /* the VE-Info has no state. It is, what it is */
+ $state = 'no_state';
+
+ /*
+ Insert the data into the database
+ */
+ $sql = "INSERT INTO monitor_data (server_id, type, created, data, state) " .
+ "VALUES (".
+ $server_id . ", " .
+ "'" . $app->dbmaster->quote($type) . "', " .
+ time() . ", " .
+ "'" . $app->dbmaster->quote(serialize($data)) . "', " .
+ "'" . $state . "'" .
+ ")";
+ $app->dbmaster->query($sql);
+
+ /* The new data is written, now we can delete the old one */
+ $this->_delOldRecords($type, 4);
+ }
+
+ function monitorOpenVzUserBeancounter() {
+ global $app;
+ global $conf;
+
+ /* the id of the server as int */
+ $server_id = intval($conf["server_id"]);
+
+ /** The type of the data */
+ $type = 'openvz_beancounter';
+
+ /*
+ Fetch the data into a array
+ */
+ $app->load(openvz_tools);
+ $openVzTools = new openvz_tools();
+ $data = $openVzTools->getOpenVzVeBeanCounter();
+
+ /* calculate the state of the beancounter */
+ if ($data == '') {
+ $state = 'no_state';
+ }
+ else {
+ $state = 'ok';
+
+ /* transfer this output-string into a array */
+ $test = explode("\n", $data);
+
+ /* the first list of the output is not needed */
+ array_shift($test);
+
+ /* now process all items of the rest */
+ foreach ($test as $item) {
+ /*
+ * eliminate all doubled spaces and spaces at the beginning and end
+ */
+ while (strpos($item, ' ') !== false) {
+ $item = str_replace(' ', ' ', $item);
+ }
+ $item = trim($item);
+
+ /*
+ * The failcounter is the LAST
+ */
+ if ($item != '') {
+ $tmp = explode(' ', $item);
+ $failCounter = $tmp[sizeof($tmp)-1];
+ if ($failCounter > 0 ) $state = 'info';
+ if ($failCounter > 50 ) $state = 'warning';
+ if ($failCounter > 200 ) $state = 'critical';
+ if ($failCounter > 10000 ) $state = 'error';
+ }
+ }
+ }
+
+ /*
+ Insert the data into the database
+ */
+ $sql = "INSERT INTO monitor_data (server_id, type, created, data, state) " .
+ "VALUES (".
+ $server_id . ", " .
+ "'" . $app->dbmaster->quote($type) . "', " .
+ time() . ", " .
+ "'" . $app->dbmaster->quote(serialize($data)) . "', " .
+ "'" . $state . "'" .
+ ")";
+ $app->dbmaster->query($sql);
+
+ /* The new data is written, now we can delete the old one */
+ $this->_delOldRecords($type, 4);
}
@@ -657,8 +741,11 @@
$state = 'ok';
}
else {
- /* There is something to update! */
- $state = 'warning';
+ /*
+ * There is something to update! this is in most cases not critical, so we can
+ * do a system-update once a month or so...
+ */
+ $state = 'info';
}
/*
@@ -738,7 +825,7 @@
$app->dbmaster->query($sql);
/* The new data is written, now we can delete the old one */
- $this->_delOldRecords($type, 0, 2);
+ $this->_delOldRecords($type, 4);
}
function monitorMailQueue() {
@@ -784,7 +871,7 @@
$app->dbmaster->query($sql);
/* The new data is written, now we can delete the old one */
- $this->_delOldRecords($type, 10);
+ $this->_delOldRecords($type, 4);
}
@@ -799,7 +886,7 @@
$type = 'raid_state';
/* This monitoring is only available if mdadm is installed */
- $location = system('which mdadm', $retval);
+ system('which mdadm', $retval);
if($retval === 0) {
/*
* Fetch the output
@@ -878,7 +965,7 @@
$app->dbmaster->query($sql);
/* The new data is written, now we can delete the old one */
- $this->_delOldRecords($type, 10);
+ $this->_delOldRecords($type, 4);
}
function monitorRkHunter() {
@@ -899,7 +986,7 @@
$type = 'rkhunter';
/* This monitoring is only available if rkhunter is installed */
- $location = system('which rkhunter', $retval);
+ system('which rkhunter', $retval);
if($retval === 0) {
/*
* Fetch the output
@@ -939,7 +1026,7 @@
$app->dbmaster->query($sql);
/* The new data is written, now we can delete the old one */
- $this->_delOldRecords($type, 0, 2);
+ $this->_delOldRecords($type, 4);
}
function monitorFail2ban() {
@@ -953,8 +1040,8 @@
$type = 'log_fail2ban';
/* This monitoring is only available if fail2ban is installed */
- $location = system('which fail2ban-client', $retval); // Debian, Ubuntu, Fedora
- if($retval !== 0) $location = system('which fail2ban', $retval); // CentOS
+ system('which fail2ban-client', $retval); // Debian, Ubuntu, Fedora
+ if($retval !== 0) system('which fail2ban', $retval); // CentOS
if($retval === 0) {
/* Get the data of the log */
$data = $this->_getLogData($type);
@@ -992,7 +1079,7 @@
$app->dbmaster->query($sql);
/* The new data is written, now we can delete the old one */
- $this->_delOldRecords($type, 10);
+ $this->_delOldRecords($type, 4);
}
function monitorSysLog() {
@@ -1034,7 +1121,7 @@
$app->dbmaster->query($sql);
/* The new data is written, now we can delete the old one */
- $this->_delOldRecords($type, 10);
+ $this->_delOldRecords($type, 4);
}
function monitorMailLog() {
@@ -1070,7 +1157,7 @@
$app->dbmaster->query($sql);
/* The new data is written, now we can delete the old one */
- $this->_delOldRecords($type, 10);
+ $this->_delOldRecords($type, 4);
}
function monitorMailWarnLog() {
@@ -1106,7 +1193,7 @@
$app->dbmaster->query($sql);
/* The new data is written, now we can delete the old one */
- $this->_delOldRecords($type, 10);
+ $this->_delOldRecords($type, 4);
}
function monitorMailErrLog() {
@@ -1142,7 +1229,7 @@
$app->dbmaster->query($sql);
/* The new data is written, now we can delete the old one */
- $this->_delOldRecords($type, 10);
+ $this->_delOldRecords($type, 4);
}
@@ -1179,7 +1266,7 @@
$app->dbmaster->query($sql);
/* The new data is written, now we can delete the old one */
- $this->_delOldRecords($type, 10);
+ $this->_delOldRecords($type, 4);
}
function monitorISPCCronLog() {
@@ -1215,7 +1302,7 @@
$app->dbmaster->query($sql);
/* The new data is written, now we can delete the old one */
- $this->_delOldRecords($type, 10);
+ $this->_delOldRecords($type, 4);
}
function monitorFreshClamLog() {
@@ -1265,7 +1352,12 @@
*/
foreach($lastLog as $line) {
if (strpos(strtolower($line), "outdated") !== false) {
- $state = $this->_setState($state, 'warning');
+ /*
+ * Outdatet is only info, because if we set this to warning, the server is
+ * as long in state warning, as there is a new version of ClamAv which takes
+ * sometimes weeks!
+ */
+ $state = $this->_setState($state, 'info');
}
}
@@ -1283,7 +1375,7 @@
$app->dbmaster->query($sql);
/* The new data is written, now we can delete the old one */
- $this->_delOldRecords($type, 10);
+ $this->_delOldRecords($type, 4);
}
function monitorClamAvLog() {
@@ -1316,7 +1408,7 @@
$app->dbmaster->query($sql);
/* The new data is written, now we can delete the old one */
- $this->_delOldRecords($type, 10);
+ $this->_delOldRecords($type, 4);
}
function monitorIspConfigLog() {
@@ -1349,7 +1441,7 @@
$app->dbmaster->query($sql);
/* The new data is written, now we can delete the old one */
- $this->_delOldRecords($type, 10);
+ $this->_delOldRecords($type, 4);
}
--
Gitblit v1.9.1