mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
really fix up/down issue
git-svn-id: http://www.observium.org/svn/observer/trunk@600 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
+8
-12
@@ -154,18 +154,6 @@ while ($device = mysql_fetch_array($device_query)) {
|
|||||||
mysql_query("INSERT INTO eventlog (host, interface, datetime, message) VALUES ('" . $device['device_id'] . "', NULL, NOW(), 'Hardware -> $hardware')");
|
mysql_query("INSERT INTO eventlog (host, interface, datetime, message) VALUES ('" . $device['device_id'] . "', NULL, NOW(), 'Hardware -> $hardware')");
|
||||||
}
|
}
|
||||||
|
|
||||||
if( $device['status'] != $status ) {
|
|
||||||
$update .= $seperator . "`status` = '$status'";
|
|
||||||
$seperator = ", ";
|
|
||||||
if ($status == '1') { $stat = "Up";
|
|
||||||
mysql_query("INSERT INTO alerts (importance, device_id, message) VALUES ('0', '" . $device['device_id'] . "', 'Device is up\n')");
|
|
||||||
} else {
|
|
||||||
$stat = "Down";
|
|
||||||
mysql_query("INSERT INTO alerts (importance, device_id, message) VALUES ('9', '" . $device['device_id'] . "', 'Device is down\n')");
|
|
||||||
}
|
|
||||||
mysql_query("INSERT INTO eventlog (host, interface, datetime, message) VALUES ('" . $device['device_id'] . "', NULL, NOW(), 'Device status changed to $stat')");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($uptime) {
|
if ($uptime) {
|
||||||
|
|
||||||
if( $uptime < $device['uptime'] ) {
|
if( $uptime < $device['uptime'] ) {
|
||||||
@@ -208,6 +196,14 @@ while ($device = mysql_fetch_array($device_query)) {
|
|||||||
echo("Updating " . $device['hostname'] . "\n");
|
echo("Updating " . $device['hostname'] . "\n");
|
||||||
$update_result = mysql_query($update_query);
|
$update_result = mysql_query($update_query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( $device['status'] != $status ) {
|
||||||
|
$update .= $seperator . "`status` = '$status'";
|
||||||
|
$seperator = ", ";
|
||||||
|
mysql_query("INSERT INTO alerts (importance, device_id, message) VALUES ('0', '" . $device['device_id'] . "', 'Device is " . ($status == '1' ? 'up' : 'down') . "')");
|
||||||
|
mysql_query("INSERT INTO eventlog (host, interface, datetime, message) VALUES ('" . $device['device_id'] . "', NULL, NOW(), 'Device status changed to " . ($status == '1' ? 'Up' : 'Down') . "')");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$poller_end = utime(); $poller_run = $poller_end - $poller_start; $poller_time = substr($poller_run, 0, 5);
|
$poller_end = utime(); $poller_run = $poller_end - $poller_start; $poller_time = substr($poller_run, 0, 5);
|
||||||
|
|||||||
Reference in New Issue
Block a user