From 220bb93ba4c0f5142b22905c94add1012cd8caf0 Mon Sep 17 00:00:00 2001
From: vogelor <vogelor@ispconfig3>
Date: Fri, 30 Apr 2010 13:51:13 -0400
Subject: [PATCH] The Monitor now also shows the distribution and the version

---
 interface/web/monitor/show_sys_state.php |   32 ++++++++++++++++++++------------
 1 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/interface/web/monitor/show_sys_state.php b/interface/web/monitor/show_sys_state.php
index cbe1c61..405492c 100644
--- a/interface/web/monitor/show_sys_state.php
+++ b/interface/web/monitor/show_sys_state.php
@@ -1,6 +1,6 @@
 <?php
 /*
-Copyright (c) 2007-2008, Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com
+Copyright (c) 2007-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,
@@ -135,23 +135,31 @@
      * get all monitoring-data from the server als process then
      * (count them and set the server-state)
      */
-    $records = $app->db->queryAllRecords("SELECT DISTINCT type FROM monitor_data WHERE server_id = " . $serverId);
-    foreach($records as $record){
-        _processDbState($record['type'], $serverId, &$serverState, &$messages);
+    $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 */
+		_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 . '<br />';
-    $res .= $app->lng("monitor_serverstate_state_txt") . ': ' . $serverState . '<br />';
+    $res .= $app->lng("monitor_serverstate_server_txt") . ': ' . $serverName;
+	if ($osData != null){
+		$res .= ' (' . $osData['name'] . ' ' . $osData['version'] . ')';
+	}
+	$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") . '<br />';
-    $res .= '<br />';
+    $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){
         /*

--
Gitblit v1.9.1