From e589cc1dbb43111f7b7ecf21c99820baa8b7f45c Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Thu, 15 Dec 2011 10:23:40 -0500
Subject: [PATCH] Fixed: FS#1912 - uncomment and chagne SSL keys pointing in /etc/dovecot.conf

---
 server/mods-available/monitor_core_module.inc.php |   69 +++++++++++++++++++++++++++++++++-
 1 files changed, 67 insertions(+), 2 deletions(-)

diff --git a/server/mods-available/monitor_core_module.inc.php b/server/mods-available/monitor_core_module.inc.php
index 185702a..bfb03be 100644
--- a/server/mods-available/monitor_core_module.inc.php
+++ b/server/mods-available/monitor_core_module.inc.php
@@ -86,7 +86,7 @@
 		/*
 		 * Calls the single Monitoring steps 
 		 */
-        //*  $this->_monitorEmailQuota(); in process
+		$this->_monitorEmailQuota();
 		$this->_monitorHDQuota();
 		$this->_monitorServer();
 		$this->_monitorOsVer();
@@ -112,8 +112,41 @@
 		$this->_monitorRaid();
 		$this->_monitorRkHunter();
 		$this->_monitorFail2ban();
+		$this->_monitorIPTables();
 		$this->_monitorSysLog();
 	}
+
+    private function _monitorEmailQuota() {
+        global $app;
+
+        /*
+		 *  This monitoring is expensive, so do it only every 15 minutes
+		 */
+		$min = @date('i');
+		if ($min % 15 != 0) return;
+		
+		
+		/*
+         * First we get the Monitoring-data from the tools
+         */
+        $res = $this->_tools->monitorEmailQuota();
+
+        /*
+         * Insert the data into the database
+         */
+        $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+                'VALUES (' .
+                $res['server_id'] . ', ' .
+                "'" . $app->dbmaster->quote($res['type']) . "', " .
+                'UNIX_TIMESTAMP(), ' .
+                "'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+                "'" . $res['state'] . "'" .
+                ')';
+        $app->dbmaster->query($sql);
+
+        /* The new data is written, now we can delete the old one */
+        $this->_delOldRecords($res['type'], $res['server_id']);
+    }
 
 	private function _monitorHDQuota() {
 		global $app;
@@ -380,6 +413,9 @@
 		 * First we get the Monitoring-data from the tools
 		 */
 		$res = $this->_tools->monitorSystemUpdate();
+		
+		//* Ensure that output is encoded so that it does not break the serialize
+		$res['data']['output'] = htmlentities($res['data']['output']);
 
 		/*
 		 * Insert the data into the database
@@ -484,12 +520,38 @@
 	}
 
 	private function _monitorFail2ban() {
+        global $app;
+
+        /*
+         * First we get the Monitoring-data from the tools
+         */
+        $res = $this->_tools->monitorFail2ban();
+
+        /*
+         * Insert the data into the database
+         */
+        $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+                'VALUES (' .
+                $res['server_id'] . ', ' .
+                "'" . $app->dbmaster->quote($res['type']) . "', " .
+                'UNIX_TIMESTAMP(), ' .
+                "'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+                "'" . $res['state'] . "'" .
+                ')';
+        $app->dbmaster->query($sql);
+
+        /* The new data is written, now we can delete the old one */
+        $this->_delOldRecords($res['type'], $res['server_id']);
+    }
+
+
+	private function _monitorIPTables() {
 		global $app;
 
 		/*
 		 * First we get the Monitoring-data from the tools
 		 */
-		$res = $this->_tools->monitorFail2ban();
+		$res = $this->_tools->monitorIPTables();
 
 		/*
 		 * Insert the data into the database
@@ -640,6 +702,9 @@
 		 * First we get the Monitoring-data from the tools
 		 */
 		$res = $this->_tools->monitorISPCCronLog();
+		
+		//* Ensure that output is encoded so that it does not break the serialize
+		$res['data']['output'] = htmlentities($res['data']['output']);
 
 		/*
 		 * Insert the data into the database

--
Gitblit v1.9.1