From 3bdfa350abd475078b8f43f7210efe6a07d21fba Mon Sep 17 00:00:00 2001
From: vogelor <vogelor@ispconfig3>
Date: Mon, 10 May 2010 10:04:37 -0400
Subject: [PATCH] The Monitor now also monitors the ISPC-Version of each server

---
 server/mods-available/monitor_core_module.inc.php |   37 +++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/server/mods-available/monitor_core_module.inc.php b/server/mods-available/monitor_core_module.inc.php
index e46512b..da509e6 100644
--- a/server/mods-available/monitor_core_module.inc.php
+++ b/server/mods-available/monitor_core_module.inc.php
@@ -197,6 +197,7 @@
 		/* Calls the single Monitoring steps */
 		$this->monitorServer();
 		$this->monitorOSVer();
+		$this->monitorIspCVer();
 		$this->monitorDiskUsage();
 		$this->monitorMemUsage();
 		$this->monitorCpu();
@@ -313,6 +314,42 @@
 	}
 
 
+	function monitorIspcVer() {
+		global $app;
+		global $conf;
+
+		/* the id of the server as int */
+		$server_id = intval($conf["server_id"]);
+
+		/** The type of the data */
+		$type = 'ispc_info';
+
+		/*
+        Fetch the data into a array
+		*/
+		$data['name'] = ISPC_APP_TITLE;
+		$data['version'] = ISPC_APP_VERSION;
+
+		/* the ISPC-Version has no state. It is, what it is */
+		$state = 'no_state';
+
+		/*
+        Insert the data into the database
+		*/
+		$sql = "INSERT INTO monitor_data (server_id, type, created, data, state) " .
+				"VALUES (".
+				$server_id . ", " .
+				"'" . $app->dbmaster->quote($type) . "', " .
+				time() . ", " .
+				"'" . $app->dbmaster->quote(serialize($data)) . "', " .
+				"'" . $state . "'" .
+				")";
+		$app->dbmaster->query($sql);
+
+		/* The new data is written, now we can delete the old one */
+		$this->_delOldRecords($type, 4);
+	}
+
 	function monitorDiskUsage() {
 		global $app;
 		global $conf;

--
Gitblit v1.9.1