From fb4c27e329659f7ebfb72855297549ac01a54f02 Mon Sep 17 00:00:00 2001
From: vogelor <vogelor@ispconfig3>
Date: Tue, 02 Dec 2008 03:12:36 -0500
Subject: [PATCH] The monitor now shows the date of the data (to determine how old they are) Fixed some bugs and improved the RAID - monitor Fixed the user count in the monitor The monitor now monitors the rkhunter - log too The monitor now deletes the old data AFTER writing the new one, so there are always data in the db

---
 interface/web/monitor/tools.inc.php |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/interface/web/monitor/tools.inc.php b/interface/web/monitor/tools.inc.php
index 1def6aa..5460b45 100644
--- a/interface/web/monitor/tools.inc.php
+++ b/interface/web/monitor/tools.inc.php
@@ -359,6 +359,38 @@
     return $html;
 }
 
+function showRKHunter()
+{
+    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");
+
+    if(isset($record['data'])) {
+        $html =
+           '<div class="systemmonitor-state systemmonitor-state-' . $record['state'] . '">
+            <div class="systemmonitor-state-' . $record['state'] . '-icon">';
+
+        /*
+         * First, we have to detect, if there is any monitoring-data.
+         * If not (because the destribution is not supported) show this.
+         */
+        $data = unserialize($record['data']);
+        if ($data['output'] == ''){
+            $html .= '<p>' . "rkhunter ist not installed, so there is no log data" . '</p>';
+        }
+        else {
+            $html .= nl2br($data['output']);
+        }
+        $html .= '</div></div>';
+
+    } else {
+        $html = '<p>' . "No RKHunter-Data available" . '</p>';
+    }
+
+    return $html;
+}
+
 function showMailq()
 {
     global $app;
@@ -375,4 +407,18 @@
 
     return $html;
 }
+
+function getDataTime($type) {
+    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");
+
+    if(isset($record['created'])) {
+        $res = date('Y-m-d H:i', $record['created']);
+    } else {
+        $res = '????-??-?? ??:??';
+    }
+    return $res;
+}
 ?>

--
Gitblit v1.9.1