From 7162553354e297f7c152144eed24aaecd28e7b43 Mon Sep 17 00:00:00 2001
From: vogelor <vogelor@ispconfig3>
Date: Mon, 24 Nov 2008 16:27:37 -0500
Subject: [PATCH] The monitor now monitors the mailq and (on debian/ubuntu) the update-status

---
 interface/web/monitor/show_sys_state.php |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 53 insertions(+), 7 deletions(-)

diff --git a/interface/web/monitor/show_sys_state.php b/interface/web/monitor/show_sys_state.php
index 7d4cab4..83e6068 100644
--- a/interface/web/monitor/show_sys_state.php
+++ b/interface/web/monitor/show_sys_state.php
@@ -142,7 +142,7 @@
             /*
              * There is no need, to show the "ok" - messages
              */
-            if ($key != 'ok')
+//            if ($key != 'ok')
             {
                 $res .= $key . ':<br />';
                 foreach ($state as $msg)
@@ -278,6 +278,52 @@
                 break;
         }
     }
+    if ($type == 'system_update'){
+        switch ($record['state']) {
+            case 'ok':
+                $messages['ok'][] = 'Your System is up to date. ' .
+                                    "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=system_update\");'>[more...]</a>";
+
+                break;
+            case 'warning':
+                $messages['warning'][] = 'One or more Components needs a update ' .
+                                    "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=system_update\");'>[more...]</a>";
+                break;
+            default:
+                $messages['unknown'][] = 'System-Updatese:??? ' .
+                                    "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=system_update\");'>[more...]</a>";
+                break;
+        }
+    }
+
+    if ($type == 'mailq'){
+        switch ($record['state']) {
+            case 'ok':
+                $messages['ok'][] = 'Your Mailq load is ok ' .
+                                    "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[more...]</a>";
+                break;
+            case 'info':
+                $messages['info'][] = 'Your Mailq in under heavy load ' .
+                                    "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[more...]</a>";
+                break;
+            case 'warning':
+                $messages['warning'][] = 'Your Mailq in under high load ' .
+                                    "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[more...]</a>";
+                break;
+            case 'critical':
+                $messages['critical'][] = 'Your Mailq in under higher load ' .
+                                    "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[more...]</a>";
+                break;
+            case 'error':
+                $messages['error'][] = 'Your Mailq in under highest load ' .
+                                    "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[more...]</a>";
+                break;
+            default:
+                $messages['unknown'][] = 'Mailq: ??? ' .
+                                    "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[more...]</a>";
+                break;
+        }
+    }
     if ($type == 'log_clamav'){
         /* this type has no state */
     }
@@ -311,9 +357,9 @@
   */
 function _setState($oldState, $newState)
 {
-        /*
-         * Calculate the weight of the old state
-         */
+   /*
+    * Calculate the weight of the old state
+    */
     switch ($oldState) {
         case 'no_state': $oldInt = 0;
             break;
@@ -350,9 +396,9 @@
             break;
     }
 
-        /*
-         * Set to the higher level
-         */
+   /*
+    * Set to the higher level
+    */
     if ($newInt > $oldInt){
         return $newState;
     }

--
Gitblit v1.9.1