From bfbabf3b78aa9d52a0046e2f2f630e8006817a3a Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Sun, 07 Dec 2008 10:53:11 -0500
Subject: [PATCH] monitor module writes the monitoring data now to the master server instead of the local server.

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

diff --git a/server/mods-available/monitor_core_module.inc.php b/server/mods-available/monitor_core_module.inc.php
index bfed2e1..3222094 100644
--- a/server/mods-available/monitor_core_module.inc.php
+++ b/server/mods-available/monitor_core_module.inc.php
@@ -161,7 +161,7 @@
             "'" . $app->db->quote(serialize($data)) . "', " .
             "'" . $state . "'" .
             ")";
-        $app->db->query($sql);
+        $app->dbmaster->query($sql);
 
         /* The new data is written, now we can delete the old one */
         $this->_delOldRecords($type, 10);
@@ -225,7 +225,7 @@
             "'" . $app->db->quote(serialize($data)) . "', " .
             "'" . $state . "'" .
             ")";
-        $app->db->query($sql);
+        $app->dbmaster->query($sql);
 
         /* The new data is written, now we can delete the old one */
         $this->_delOldRecords($type, 10);
@@ -276,7 +276,7 @@
             "'" . $app->db->quote(serialize($data)) . "', " .
             "'" . $state . "'" .
             ")";
-        $app->db->query($sql);
+        $app->dbmaster->query($sql);
 
         /* The new data is written, now we can delete the old one */
         $this->_delOldRecords($type, 10);
@@ -321,7 +321,7 @@
             "'" . $app->db->quote(serialize($data)) . "', " .
             "'" . $state . "'" .
             ")";
-        $app->db->query($sql);
+        $app->dbmaster->query($sql);
 
         /* The new data is written, now we can delete the old one */
         $this->_delOldRecords($type, 10);
@@ -337,7 +337,7 @@
         $server_id = intval($conf["server_id"]);
 
         /** get the "active" Services of the server from the DB */
-        $services = $app->db->queryOneRecord("SELECT * FROM server WHERE server_id = " . $server_id);
+        $services = $app->dbmaster->queryOneRecord("SELECT * FROM server WHERE server_id = " . $server_id);
 
         /* The type of the Monitor-data */
         $type = 'services';
@@ -445,7 +445,7 @@
             "'" . $app->db->quote(serialize($data)) . "', " .
             "'" . $state . "'" .
             ")";
-        $app->db->query($sql);
+        $app->dbmaster->query($sql);
 
         /* The new data is written, now we can delete the old one */
         $this->_delOldRecords($type, 10);
@@ -525,7 +525,7 @@
             "'" . $app->db->quote(serialize($data)) . "', " .
             "'" . $state . "'" .
             ")";
-        $app->db->query($sql);
+        $app->dbmaster->query($sql);
 
         /* The new data is written, now we can delete the old one */
         $this->_delOldRecords($type, 0, 2);
@@ -571,7 +571,7 @@
             "'" . $app->db->quote(serialize($data)) . "', " .
             "'" . $state . "'" .
             ")";
-        $app->db->query($sql);
+        $app->dbmaster->query($sql);
 
         /* The new data is written, now we can delete the old one */
         $this->_delOldRecords($type, 10);
@@ -654,7 +654,7 @@
             "'" . $app->db->quote(serialize($data)) . "', " .
             "'" . $state . "'" .
             ")";
-        $app->db->query($sql);
+        $app->dbmaster->query($sql);
 
         /* The new data is written, now we can delete the old one */
         $this->_delOldRecords($type, 10);
@@ -714,7 +714,7 @@
             "'" . $app->db->quote(serialize($data)) . "', " .
             "'" . $state . "'" .
             ")";
-        $app->db->query($sql);
+        $app->dbmaster->query($sql);
 
         /* The new data is written, now we can delete the old one */
         $this->_delOldRecords($type, 0, 2);
@@ -751,7 +751,7 @@
             "'" . $app->db->quote(serialize($data)) . "', " .
             "'" . $state . "'" .
             ")";
-        $app->db->query($sql);
+        $app->dbmaster->query($sql);
 
         /* The new data is written, now we can delete the old one */
         $this->_delOldRecords($type, 10);
@@ -788,7 +788,7 @@
             "'" . $app->db->quote(serialize($data)) . "', " .
             "'" . $state . "'" .
             ")";
-        $app->db->query($sql);
+        $app->dbmaster->query($sql);
 
         /* The new data is written, now we can delete the old one */
         $this->_delOldRecords($type, 10);
@@ -825,7 +825,7 @@
             "'" . $app->db->quote(serialize($data)) . "', " .
             "'" . $state . "'" .
             ")";
-        $app->db->query($sql);
+        $app->dbmaster->query($sql);
 
         /* The new data is written, now we can delete the old one */
         $this->_delOldRecords($type, 10);
@@ -863,7 +863,7 @@
             "'" . $app->db->quote(serialize($data)) . "', " .
             "'" . $state . "'" .
             ")";
-        $app->db->query($sql);
+        $app->dbmaster->query($sql);
 
         /* The new data is written, now we can delete the old one */
         $this->_delOldRecords($type, 10);
@@ -935,7 +935,7 @@
             "'" . $app->db->quote(serialize($data)) . "', " .
             "'" . $state . "'" .
             ")";
-        $app->db->query($sql);
+        $app->dbmaster->query($sql);
 
         /* The new data is written, now we can delete the old one */
         $this->_delOldRecords($type, 10);
@@ -969,7 +969,7 @@
             "'" . $app->db->quote(serialize($data)) . "', " .
             "'" . $state . "'" .
             ")";
-        $app->db->query($sql);
+        $app->dbmaster->query($sql);
 
         /* The new data is written, now we can delete the old one */
         $this->_delOldRecords($type, 10);
@@ -1003,7 +1003,7 @@
             "'" . $app->db->quote(serialize($data)) . "', " .
             "'" . $state . "'" .
             ")";
-        $app->db->query($sql);
+        $app->dbmaster->query($sql);
 
         /* The new data is written, now we can delete the old one */
         $this->_delOldRecords($type, 10);
@@ -1114,7 +1114,7 @@
             "type =" . "'" . $app->db->quote($type) . "' " .
             "AND " .
             "created < " . $old;
-        $app->db->query($sql);
+        $app->dbmaster->query($sql);
     }
 
     /*

--
Gitblit v1.9.1