| | |
| | | /* |
| | | * Calls the single Monitoring steps |
| | | */ |
| | | $this->_monitorEmailQuota(); |
| | | $this->_monitorHDQuota(); |
| | | $this->_monitorServer(); |
| | | $this->_monitorOsVer(); |
| | |
| | | $this->_monitorRaid(); |
| | | $this->_monitorRkHunter(); |
| | | $this->_monitorFail2ban(); |
| | | $this->_monitorIPTables(); |
| | | $this->_monitorSysLog(); |
| | | } |
| | | |
| | | private function _monitorEmailQuota() { |
| | | global $app; |
| | | |
| | | /* |
| | | * 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; |
| | |
| | | 'VALUES (' . |
| | | $res['server_id'] . ', ' . |
| | | "'" . $app->dbmaster->quote($res['type']) . "', " . |
| | | time() . ', ' . |
| | | '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($type, $res['server_id']); |
| | | $this->_delOldRecords($res['type'], $res['server_id']); |
| | | } |
| | | |
| | | private function _monitorServer() { |
| | |
| | | 'VALUES (' . |
| | | $res['server_id'] . ', ' . |
| | | "'" . $app->dbmaster->quote($res['type']) . "', " . |
| | | time() . ', ' . |
| | | '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($type, $res['server_id']); |
| | | $this->_delOldRecords($res['type'], $res['server_id']); |
| | | } |
| | | |
| | | private function _monitorOsVer() { |
| | |
| | | 'VALUES (' . |
| | | $res['server_id'] . ', ' . |
| | | "'" . $app->dbmaster->quote($res['type']) . "', " . |
| | | time() . ', ' . |
| | | '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($type, $res['server_id']); |
| | | $this->_delOldRecords($res['type'], $res['server_id']); |
| | | } |
| | | |
| | | private function _monitorIspcVer() { |
| | |
| | | 'VALUES (' . |
| | | $res['server_id'] . ', ' . |
| | | "'" . $app->dbmaster->quote($res['type']) . "', " . |
| | | time() . ', ' . |
| | | '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($type, $res['server_id']); |
| | | $this->_delOldRecords($res['type'], $res['server_id']); |
| | | } |
| | | |
| | | private function _monitorDiskUsage() { |
| | |
| | | 'VALUES (' . |
| | | $res['server_id'] . ', ' . |
| | | "'" . $app->dbmaster->quote($res['type']) . "', " . |
| | | time() . ', ' . |
| | | '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($type, $res['server_id']); |
| | | $this->_delOldRecords($res['type'], $res['server_id']); |
| | | } |
| | | |
| | | private function _monitorMemUsage() { |
| | |
| | | 'VALUES (' . |
| | | $res['server_id'] . ', ' . |
| | | "'" . $app->dbmaster->quote($res['type']) . "', " . |
| | | time() . ', ' . |
| | | '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($type, $res['server_id']); |
| | | $this->_delOldRecords($res['type'], $res['server_id']); |
| | | } |
| | | |
| | | private function _monitorCpu() { |
| | |
| | | 'VALUES (' . |
| | | $res['server_id'] . ', ' . |
| | | "'" . $app->dbmaster->quote($res['type']) . "', " . |
| | | time() . ', ' . |
| | | '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($type, $res['server_id']); |
| | | $this->_delOldRecords($res['type'], $res['server_id']); |
| | | } |
| | | |
| | | private function _monitorServices() { |
| | |
| | | 'VALUES (' . |
| | | $res['server_id'] . ', ' . |
| | | "'" . $app->dbmaster->quote($res['type']) . "', " . |
| | | time() . ', ' . |
| | | '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($type, $res['server_id']); |
| | | $this->_delOldRecords($res['type'], $res['server_id']); |
| | | } |
| | | |
| | | private function _monitorOpenVzHost() { |
| | |
| | | 'VALUES (' . |
| | | $res['server_id'] . ', ' . |
| | | "'" . $app->dbmaster->quote($res['type']) . "', " . |
| | | time() . ', ' . |
| | | '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($type, $res['server_id']); |
| | | $this->_delOldRecords($res['type'], $res['server_id']); |
| | | } |
| | | |
| | | private function _monitorOpenVzUserBeancounter() { |
| | |
| | | 'VALUES (' . |
| | | $res['server_id'] . ', ' . |
| | | "'" . $app->dbmaster->quote($res['type']) . "', " . |
| | | time() . ', ' . |
| | | '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($type, $res['server_id']); |
| | | $this->_delOldRecords($res['type'], $res['server_id']); |
| | | } |
| | | |
| | | private function _monitorSystemUpdate() { |
| | | /* |
| | | * This monitoring is expensive, so do it only once an hour |
| | | */ |
| | | $min = date('i'); |
| | | $min = @date('i'); |
| | | if ($min != 0) |
| | | return; |
| | | |
| | |
| | | 'VALUES (' . |
| | | $res['server_id'] . ', ' . |
| | | "'" . $app->dbmaster->quote($res['type']) . "', " . |
| | | time() . ', ' . |
| | | '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($type, $res['server_id']); |
| | | $this->_delOldRecords($res['type'], $res['server_id']); |
| | | } |
| | | |
| | | private function _monitorMailQueue() { |
| | |
| | | 'VALUES (' . |
| | | $res['server_id'] . ', ' . |
| | | "'" . $app->dbmaster->quote($res['type']) . "', " . |
| | | time() . ', ' . |
| | | '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($type, $res['server_id']); |
| | | $this->_delOldRecords($res['type'], $res['server_id']); |
| | | } |
| | | |
| | | private function _monitorRaid() { |
| | |
| | | 'VALUES (' . |
| | | $res['server_id'] . ', ' . |
| | | "'" . $app->dbmaster->quote($res['type']) . "', " . |
| | | time() . ', ' . |
| | | '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($type, $res['server_id']); |
| | | $this->_delOldRecords($res['type'], $res['server_id']); |
| | | } |
| | | |
| | | private function _monitorRkHunter() { |
| | | /* |
| | | * This monitoring is expensive, so do it only once a day |
| | | */ |
| | | $min = date('i'); |
| | | $hour = date('H'); |
| | | $min = @date('i'); |
| | | $hour = @date('H'); |
| | | if (!($min == 0 && $hour == 23)) |
| | | return; |
| | | /* |
| | |
| | | 'VALUES (' . |
| | | $res['server_id'] . ', ' . |
| | | "'" . $app->dbmaster->quote($res['type']) . "', " . |
| | | time() . ', ' . |
| | | '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($type, $res['server_id']); |
| | | $this->_delOldRecords($res['type'], $res['server_id']); |
| | | } |
| | | |
| | | 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 |
| | |
| | | 'VALUES (' . |
| | | $res['server_id'] . ', ' . |
| | | "'" . $app->dbmaster->quote($res['type']) . "', " . |
| | | time() . ', ' . |
| | | '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($type, $res['server_id']); |
| | | $this->_delOldRecords($res['type'], $res['server_id']); |
| | | } |
| | | |
| | | private function _monitorSysLog() { |
| | |
| | | 'VALUES (' . |
| | | $res['server_id'] . ', ' . |
| | | "'" . $app->dbmaster->quote($res['type']) . "', " . |
| | | time() . ', ' . |
| | | '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($type, $res['server_id']); |
| | | $this->_delOldRecords($res['type'], $res['server_id']); |
| | | } |
| | | |
| | | private function _monitorMailLog() { |
| | |
| | | 'VALUES (' . |
| | | $res['server_id'] . ', ' . |
| | | "'" . $app->dbmaster->quote($res['type']) . "', " . |
| | | time() . ', ' . |
| | | '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($type, $res['server_id']); |
| | | $this->_delOldRecords($res['type'], $res['server_id']); |
| | | } |
| | | |
| | | private function _monitorMailWarnLog() { |
| | |
| | | 'VALUES (' . |
| | | $res['server_id'] . ', ' . |
| | | "'" . $app->dbmaster->quote($res['type']) . "', " . |
| | | time() . ', ' . |
| | | '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($type, $res['server_id']); |
| | | $this->_delOldRecords($res['type'], $res['server_id']); |
| | | } |
| | | |
| | | private function _monitorMailErrLog() { |
| | |
| | | 'VALUES (' . |
| | | $res['server_id'] . ', ' . |
| | | "'" . $app->dbmaster->quote($res['type']) . "', " . |
| | | time() . ', ' . |
| | | '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($type, $res['server_id']); |
| | | $this->_delOldRecords($res['type'], $res['server_id']); |
| | | } |
| | | |
| | | private function _monitorMessagesLog() { |
| | |
| | | 'VALUES (' . |
| | | $res['server_id'] . ', ' . |
| | | "'" . $app->dbmaster->quote($res['type']) . "', " . |
| | | time() . ', ' . |
| | | '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($type, $res['server_id']); |
| | | $this->_delOldRecords($res['type'], $res['server_id']); |
| | | } |
| | | |
| | | private function _monitorISPCCronLog() { |
| | |
| | | 'VALUES (' . |
| | | $res['server_id'] . ', ' . |
| | | "'" . $app->dbmaster->quote($res['type']) . "', " . |
| | | time() . ', ' . |
| | | '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($type, $res['server_id']); |
| | | $this->_delOldRecords($res['type'], $res['server_id']); |
| | | } |
| | | |
| | | private function _monitorFreshClamLog() { |
| | |
| | | 'VALUES (' . |
| | | $res['server_id'] . ', ' . |
| | | "'" . $app->dbmaster->quote($res['type']) . "', " . |
| | | time() . ', ' . |
| | | '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($type, $res['server_id']); |
| | | $this->_delOldRecords($res['type'], $res['server_id']); |
| | | } |
| | | |
| | | private function _monitorClamAvLog() { |
| | |
| | | 'VALUES (' . |
| | | $res['server_id'] . ', ' . |
| | | "'" . $app->dbmaster->quote($res['type']) . "', " . |
| | | time() . ', ' . |
| | | '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($type, $res['server_id']); |
| | | $this->_delOldRecords($res['type'], $res['server_id']); |
| | | } |
| | | |
| | | private function _monitorIspConfigLog() { |
| | |
| | | 'VALUES (' . |
| | | $res['server_id'] . ', ' . |
| | | "'" . $app->dbmaster->quote($res['type']) . "', " . |
| | | time() . ', ' . |
| | | '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($type, $res['server_id']); |
| | | $this->_delOldRecords($res['type'], $res['server_id']); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | } |
| | | |
| | | ?> |
| | | ?> |