From 5152e9a75e6e0ed4dc26358e4e608ce684147b32 Mon Sep 17 00:00:00 2001
From: Marius Burkard <m.burkard@pixcept.de>
Date: Tue, 26 Apr 2016 03:01:50 -0400
Subject: [PATCH] Merge branch 'stable-3.1'
---
server/lib/classes/monitor_tools.inc.php | 40 +++++++++++++++++++++++++++-------------
1 files changed, 27 insertions(+), 13 deletions(-)
diff --git a/server/lib/classes/monitor_tools.inc.php b/server/lib/classes/monitor_tools.inc.php
index 50eb45b..8d71d9b 100644
--- a/server/lib/classes/monitor_tools.inc.php
+++ b/server/lib/classes/monitor_tools.inc.php
@@ -62,6 +62,16 @@
$mainver = array_filter($mainver);
$mainver = current($mainver).'.'.next($mainver);
switch ($mainver){
+ case "16.04":
+ $relname = "(Xenial Xerus)";
+ $distid = 'ubuntu1604';
+ break;
+ case "15.10":
+ $relname = "(Wily Werewolf)";
+ break;
+ case "15.04":
+ $relname = "(Vivid Vervet)";
+ break;
case "14.10":
$relname = "(Utopic Unicorn)";
break;
@@ -147,6 +157,11 @@
} elseif (strstr(trim(file_get_contents('/etc/debian_version')), '7.0') || substr(trim(file_get_contents('/etc/debian_version')),0,2) == '7.' || trim(file_get_contents('/etc/debian_version')) == 'wheezy/sid') {
$distname = 'Debian';
$distver = 'Wheezy/Sid';
+ $distid = 'debian60';
+ $distbaseid = 'debian';
+ } elseif(strstr(trim(file_get_contents('/etc/debian_version')), '8') || substr(trim(file_get_contents('/etc/debian_version')),0,1) == '8') {
+ $distname = 'Debian';
+ $distver = 'Jessie';
$distid = 'debian60';
$distbaseid = 'debian';
} else {
@@ -259,7 +274,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->db->queryOneRecord('SELECT * FROM server WHERE server_id = ?', $server_id);
/*
* If the DB is down, we have to set the db to "yes".
* If we don't do this, then the monitor will NOT monitor, that the db is down and so the
@@ -355,14 +370,16 @@
$state = 'error'; // because service is down
}
}
+/*
$data['mongodbserver'] = -1;
if ($this->_checkTcp('localhost', 27017)) {
$data['mongodbserver'] = 1;
} else {
$data['mongodbserver'] = 0;
+*/
//$state = 'error'; // because service is down
/* TODO!!! check if this is a mongodbserver at all, otherwise it will always throw an error state!!! */
- }
+// }
/*
* Return the Result
@@ -658,7 +675,7 @@
// $now = time();
// $old = $now - (4 * 60); // 4 minutes
- $old = 'UNIX_TIMESTAMP() - 240';
+ $old = 240; //seconds
/*
* ATTENTION if i do NOT pay attention of the server id, i delete all data (of the type)
@@ -668,14 +685,8 @@
* even though it is the NEWEST data of this server. To avoid this i HAVE to include
* the server-id!
*/
- $sql = 'DELETE FROM monitor_data ' .
- 'WHERE ' .
- ' type =' . "'" . $app->dbmaster->quote($type) . "' " .
- 'AND ' .
- ' created < ' . $old . ' ' .
- 'AND ' .
- ' server_id = ' . $serverId;
- $app->dbmaster->query($sql);
+ $sql = 'DELETE FROM `monitor_data` WHERE `type` = ? AND `created` < UNIX_TIMESTAMP() - ? AND `server_id` = ?';
+ $app->dbmaster->query($sql, $type, $old, $serverId);
}
public function send_notification_email($template, $placeholders, $recipients) {
@@ -700,13 +711,16 @@
$mailSubject = '';
$inHeader = true;
for($l = 0; $l < count($lines); $l++) {
- if($lines[$l] == '') {
+ if(trim($lines[$l]) == '') {
$inHeader = false;
continue;
}
if($inHeader == true) {
$parts = explode(':', $lines[$l], 2);
- if(strtolower($parts[0]) == 'subject') $mailSubject = trim($parts[1]);
+ if(strtolower($parts[0]) == 'subject') {
+ $mailSubject = trim($parts[1]);
+ continue;
+ }
unset($parts);
$mailHeaders .= trim($lines[$l]) . "\n";
} else {
--
Gitblit v1.9.1