tbrehm
2008-12-09 eaa00d8cb42b07a7f6a6c48504e94edb552df97d
server/mods-available/monitor_core_module.inc.php
@@ -156,12 +156,12 @@
        $sql = "INSERT INTO monitor_data (server_id, type, created, data, state) " .
            "VALUES (".
        $server_id . ", " .
            "'" . $app->db->quote($type) . "', " .
            "'" . $app->dbmaster->quote($type) . "', " .
        time() . ", " .
            "'" . $app->db->quote(serialize($data)) . "', " .
            "'" . $app->dbmaster->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);
@@ -220,12 +220,12 @@
        $sql = "INSERT INTO monitor_data (server_id, type, created, data, state) " .
            "VALUES (".
        $server_id . ", " .
            "'" . $app->db->quote($type) . "', " .
            "'" . $app->dbmaster->quote($type) . "', " .
        time() . ", " .
            "'" . $app->db->quote(serialize($data)) . "', " .
            "'" . $app->dbmaster->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);
@@ -271,12 +271,12 @@
        $sql = "INSERT INTO monitor_data (server_id, type, created, data, state) " .
            "VALUES (".
        $server_id . ", " .
            "'" . $app->db->quote($type) . "', " .
            "'" . $app->dbmaster->quote($type) . "', " .
        time() . ", " .
            "'" . $app->db->quote(serialize($data)) . "', " .
            "'" . $app->dbmaster->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);
@@ -316,12 +316,12 @@
        $sql = "INSERT INTO monitor_data (server_id, type, created, data, state) " .
            "VALUES (".
        $server_id . ", " .
            "'" . $app->db->quote($type) . "', " .
            "'" . $app->dbmaster->quote($type) . "', " .
        time() . ", " .
            "'" . $app->db->quote(serialize($data)) . "', " .
            "'" . $app->dbmaster->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';
@@ -440,12 +440,12 @@
        $sql = "INSERT INTO monitor_data (server_id, type, created, data, state) " .
            "VALUES (".
        $server_id . ", " .
            "'" . $app->db->quote($type) . "', " .
            "'" . $app->dbmaster->quote($type) . "', " .
        time() . ", " .
            "'" . $app->db->quote(serialize($data)) . "', " .
            "'" . $app->dbmaster->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);
@@ -520,12 +520,12 @@
        $sql = "INSERT INTO monitor_data (server_id, type, created, data, state) " .
            "VALUES (".
        $server_id . ", " .
            "'" . $app->db->quote($type) . "', " .
            "'" . $app->dbmaster->quote($type) . "', " .
        time() . ", " .
            "'" . $app->db->quote(serialize($data)) . "', " .
            "'" . $app->dbmaster->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);
@@ -566,12 +566,12 @@
        $sql = "INSERT INTO monitor_data (server_id, type, created, data, state) " .
            "VALUES (".
        $server_id . ", " .
            "'" . $app->db->quote($type) . "', " .
            "'" . $app->dbmaster->quote($type) . "', " .
        time() . ", " .
            "'" . $app->db->quote(serialize($data)) . "', " .
            "'" . $app->dbmaster->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);
@@ -649,12 +649,12 @@
        $sql = "INSERT INTO monitor_data (server_id, type, created, data, state) " .
            "VALUES (".
        $server_id . ", " .
            "'" . $app->db->quote($type) . "', " .
            "'" . $app->dbmaster->quote($type) . "', " .
        time() . ", " .
            "'" . $app->db->quote(serialize($data)) . "', " .
            "'" . $app->dbmaster->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);
@@ -682,7 +682,7 @@
            /*
             * Fetch the output
             */
            $data['output'] = shell_exec('rkhunter --update --check --nocolors --skip-keypress');
            $data['output'] = shell_exec('rkhunter --update --checkall --nocolors --skip-keypress');
            /*
             * At this moment, there is no state (maybe later)
@@ -709,12 +709,12 @@
        $sql = "INSERT INTO monitor_data (server_id, type, created, data, state) " .
            "VALUES (".
        $server_id . ", " .
            "'" . $app->db->quote($type) . "', " .
            "'" . $app->dbmaster->quote($type) . "', " .
        time() . ", " .
            "'" . $app->db->quote(serialize($data)) . "', " .
            "'" . $app->dbmaster->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);
@@ -746,12 +746,12 @@
        $sql = "INSERT INTO monitor_data (server_id, type, created, data, state) " .
            "VALUES (".
        $server_id . ", " .
            "'" . $app->db->quote($type) . "', " .
            "'" . $app->dbmaster->quote($type) . "', " .
        time() . ", " .
            "'" . $app->db->quote(serialize($data)) . "', " .
            "'" . $app->dbmaster->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);
@@ -783,12 +783,12 @@
        $sql = "INSERT INTO monitor_data (server_id, type, created, data, state) " .
            "VALUES (".
        $server_id . ", " .
            "'" . $app->db->quote($type) . "', " .
            "'" . $app->dbmaster->quote($type) . "', " .
        time() . ", " .
            "'" . $app->db->quote(serialize($data)) . "', " .
            "'" . $app->dbmaster->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);
@@ -820,12 +820,12 @@
        $sql = "INSERT INTO monitor_data (server_id, type, created, data, state) " .
            "VALUES (".
        $server_id . ", " .
            "'" . $app->db->quote($type) . "', " .
            "'" . $app->dbmaster->quote($type) . "', " .
        time() . ", " .
            "'" . $app->db->quote(serialize($data)) . "', " .
            "'" . $app->dbmaster->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);
@@ -858,12 +858,12 @@
        $sql = "INSERT INTO monitor_data (server_id, type, created, data, state) " .
            "VALUES (".
        $server_id . ", " .
            "'" . $app->db->quote($type) . "', " .
            "'" . $app->dbmaster->quote($type) . "', " .
        time() . ", " .
            "'" . $app->db->quote(serialize($data)) . "', " .
            "'" . $app->dbmaster->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);
@@ -930,12 +930,12 @@
        $sql = "INSERT INTO monitor_data (server_id, type, created, data, state) " .
            "VALUES (".
        $server_id . ", " .
            "'" . $app->db->quote($type) . "', " .
            "'" . $app->dbmaster->quote($type) . "', " .
        time() . ", " .
            "'" . $app->db->quote(serialize($data)) . "', " .
            "'" . $app->dbmaster->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);
@@ -964,12 +964,12 @@
        $sql = "INSERT INTO monitor_data (server_id, type, created, data, state) " .
            "VALUES (".
        $server_id . ", " .
            "'" . $app->db->quote($type) . "', " .
            "'" . $app->dbmaster->quote($type) . "', " .
        time() . ", " .
            "'" . $app->db->quote(serialize($data)) . "', " .
            "'" . $app->dbmaster->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);
@@ -998,12 +998,12 @@
        $sql = "INSERT INTO monitor_data (server_id, type, created, data, state) " .
            "VALUES (".
        $server_id . ", " .
            "'" . $app->db->quote($type) . "', " .
            "'" . $app->dbmaster->quote($type) . "', " .
        time() . ", " .
            "'" . $app->db->quote(serialize($data)) . "', " .
            "'" . $app->dbmaster->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);
@@ -1111,10 +1111,10 @@
        $old = $now - ($min * 60) - ($hour * 60 * 60) - ($days * 24 * 60 * 60);
        $sql = "DELETE FROM monitor_data " .
            "WHERE " .
            "type =" . "'" . $app->db->quote($type) . "' " .
            "type =" . "'" . $app->dbmaster->quote($type) . "' " .
            "AND " .
            "created < " . $old;
        $app->db->query($sql);
        $app->dbmaster->query($sql);
    }
    /*