mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fixed eventlogging for poll-device
git-svn-id: http://www.observium.org/svn/observer/trunk@1244 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@ -84,7 +84,7 @@ while ($device = mysql_fetch_array($device_query)) {
|
||||
$poll_separator = ", ";
|
||||
mysql_query("UPDATE `devices` SET `status` = '".$status."' WHERE `device_id` = '".$device['device_id']."'");
|
||||
mysql_query("INSERT INTO alerts (importance, device_id, message) VALUES ('0', '" . $device['device_id'] . "', 'Device is " .($status == '1' ? 'up' : 'down') . "')");
|
||||
eventlog('Device status changed to ' . ($status == '1' ? 'Up' : 'Down'), $device['device_id']);
|
||||
log_event('Device status changed to ' . ($status == '1' ? 'Up' : 'Down'), $device['device_id'], ($status == '1' ? 'up' : 'down'));
|
||||
mail($email, "Device ".($status == '1' ? 'Up' : 'Down').": " . $device['hostname'], "Device ".($status == '1' ? 'up' : 'down').": " . $device['hostname'] . " at " . date($config['timestamp_format']), $config['email_headers']);
|
||||
|
||||
|
||||
@ -133,7 +133,7 @@ while ($device = mysql_fetch_array($device_query)) {
|
||||
{
|
||||
if ( $uptime < $device['uptime'] ) {
|
||||
notify($device,"Device rebooted: " . $device['hostname'], "Device Rebooted : " . $device['hostname'] . " " . formatUptime($uptime) . " ago.");
|
||||
eventlog('Device rebooted', $device['device_id']);
|
||||
log_event('Device rebooted after '.formatUptime($device['uptime']), $device['device_id'], 'reboot', $device['uptime']);
|
||||
}
|
||||
|
||||
$uptimerrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/uptime.rrd";
|
||||
@ -188,49 +188,49 @@ while ($device = mysql_fetch_array($device_query)) {
|
||||
if ( $serial && $serial != $device['serial'] ) {
|
||||
$poll_update .= $poll_separator . "`serial` = '".mres($serial)."'";
|
||||
$poll_separator = ", ";
|
||||
eventlog("Serial -> $serial", $device['device_id']);
|
||||
log_event("Serial -> $serial", $device['device_id'], 'system');
|
||||
}
|
||||
|
||||
if ( $sysContact && $sysContact != $device['sysContact'] ) {
|
||||
$poll_update .= $poll_separator . "`sysContact` = '".mres($sysContact)."'";
|
||||
$poll_separator = ", ";
|
||||
eventlog("Contact -> $sysContact", $device['device_id']);
|
||||
log_event("Contact -> $sysContact", $device['device_id'], 'system');
|
||||
}
|
||||
|
||||
if ( $sysName && $sysName != $device['sysName'] ) {
|
||||
$poll_update .= $poll_separator . "`sysName` = '$sysName'";
|
||||
$poll_separator = ", ";
|
||||
eventlog("sysName -> $sysName", $device['device_id']);
|
||||
log_event("sysName -> $sysName", $device['device_id'], 'system');
|
||||
}
|
||||
|
||||
if ( $sysDescr && $sysDescr != $device['sysDescr'] ) {
|
||||
$poll_update .= $poll_separator . "`sysDescr` = '$sysDescr'";
|
||||
$poll_separator = ", ";
|
||||
eventlog("sysDescr -> $sysDescr", $device['device_id']);
|
||||
log_event("sysDescr -> $sysDescr", $device['device_id'], 'system');
|
||||
}
|
||||
|
||||
if ( $sysLocation && $device['location'] != $sysLocation ) {
|
||||
$poll_update .= $poll_separator . "`location` = '$sysLocation'";
|
||||
$poll_separator = ", ";
|
||||
eventlog("Location -> $sysLocation", $device['device_id']);
|
||||
log_event("Location -> $sysLocation", $device['device_id'], 'system');
|
||||
}
|
||||
|
||||
if ( $version && $device['version'] != $version ) {
|
||||
$poll_update .= $poll_separator . "`version` = '$version'";
|
||||
$poll_separator = ", ";
|
||||
eventlog("OS Version -> $version", $device['device_id']);
|
||||
log_event("OS Version -> $version", $device['device_id'], 'system');
|
||||
}
|
||||
|
||||
if ( $features != $device['features'] ) {
|
||||
$poll_update .= $poll_separator . "`features` = '$features'";
|
||||
$poll_separator = ", ";
|
||||
eventlog("OS Features -> $features", $device['device_id']);
|
||||
log_event("OS Features -> $features", $device['device_id'], 'system');
|
||||
}
|
||||
|
||||
if ( $hardware && $hardware != $device['hardware'] ) {
|
||||
$poll_update .= $poll_separator . "`hardware` = '$hardware'";
|
||||
$poll_separator = ", ";
|
||||
eventlog("Hardware -> $hardware", $device['device_id']);
|
||||
log_event("Hardware -> $hardware", $device['device_id'], 'system');
|
||||
}
|
||||
|
||||
$poll_update .= $poll_separator . "`last_polled` = NOW()";
|
||||
|
Reference in New Issue
Block a user