From ed30c60150ffda0301eb1f8d30c93cac94de41df Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Mon, 25 Jul 2011 10:38:22 -0400
Subject: [PATCH] Fixed some warnings in the installer.
---
interface/web/monitor/show_sys_state.php | 115 +++++++++++++++++++++++++++++++++++----------------------
1 files changed, 71 insertions(+), 44 deletions(-)
diff --git a/interface/web/monitor/show_sys_state.php b/interface/web/monitor/show_sys_state.php
index e089304..88fa3c9 100644
--- a/interface/web/monitor/show_sys_state.php
+++ b/interface/web/monitor/show_sys_state.php
@@ -138,7 +138,7 @@
}
}
}
-
+
/*
* 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...
@@ -149,14 +149,16 @@
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);
+ if(is_array($veInfo)) {
+ 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);
+ }
}
}
}
@@ -191,12 +193,17 @@
$records = $app->db->queryAllRecords("SELECT DISTINCT type, data FROM monitor_data WHERE server_id = " . $serverId);
$osData = null;
$veInfo = null;
+ $ispcData = 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']);
+ }
+ /* if we have the ISPConfig-info, get it */
+ if ($record['type'] == 'ispc_info') {
+ $ispcData = unserialize($record['data']);
}
/* if we have the ve-info, get it */
if ($record['type'] == 'openvz_veinfo') {
@@ -219,6 +226,9 @@
if ($osData != null) {
$html_ve .= $osData['name'] . ' ' . $osData['version'] . '<br>';
}
+ if ($ispcData != null) {
+ $html_ve .= $ispcData['name'] . ' ' . $ispcData['version'] . '<br>';
+ }
$html_ve .= $app->lng("monitor_serverstate_state_txt") . ': ' . $serverState . '<br>';
/*
@@ -229,10 +239,18 @@
$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 .= ' (' . $osData['name'] . ' ' . $osData['version'] . ')<br>';
+ }
+ else {
+ $html_server .= '<br />';
+ }
+ if ($ispcData != null) {
+ $html_server .= $ispcData['name'] . ' ' . $ispcData['version'] . '<br>';
+ }
+ else {
+ $html_server .= '<br />';
}
- $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") . ', ';
@@ -245,13 +263,12 @@
* 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 />';
+ foreach($messages as $key => $state) {
+ $html_verbose .= $key . ':<br />';
+ foreach ($state as $msg) {
+ $html_verbose .= $msg . '<br />';
}
+ $html_verbose .= '<br />';
}
/*
@@ -280,7 +297,7 @@
}
/*
- * gets the state from the db and process it
+* gets the state from the db and process it
*/
function _processDbState($type, $serverId, $serverState, $messages) {
global $app;
@@ -289,10 +306,17 @@
* Always the NEWEST record of each monitoring is responsible for the
* state
*/
-// get the State from the DB
+ // 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']);
+
+ // change the new state to the highest state
+ /*
+ * Monitoring the user_beancounter of a VE is not as easy as i thought, so for now ignore
+ * this state (if we have a better solution)
+ */
+ if ($type != 'openvz_beancounter') {
+ $serverState = _setState($serverState, $record['state']);
+ }
/*
* The message depands on the type and the state
@@ -430,32 +454,35 @@
}
}
- 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;
- }
- }
+ /*
+ * ignore, until we find a better solution
+ */
+// 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') {
--
Gitblit v1.9.1