mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix bug of alerting by ping.php (#9311)
* Fix bug of alert by ping.php. Fix bug of alert by ping.php. Please refer to the Help ticket for more information: https://community.librenms.org/t/please-help-with-for-fast-ping-checks-problems/5586
This commit is contained in:
@@ -244,16 +244,20 @@ class PingCheck implements ShouldQueue
|
||||
$device->last_ping = Carbon::now();
|
||||
$device->last_ping_timetaken = isset($data['rtt']) ? $data['rtt'] : 0;
|
||||
|
||||
if ($device->isDirty('status')) {
|
||||
if ($changed = $device->isDirty('status')) {
|
||||
// if changed, update reason
|
||||
$device->status_reason = $device->status ? '' : 'icmp';
|
||||
$type = $device->status ? 'up' : 'down';
|
||||
log_event('Device status changed to ' . ucfirst($type) . " from icmp check.", $device->toArray(), $type);
|
||||
|
||||
log_event('Device status changed to ' . ucfirst($type) . " from icmp check.", $device->toArray(), $type);
|
||||
echo "Device $device->hostname changed status to $type, running alerts\n";
|
||||
}
|
||||
|
||||
$device->save();
|
||||
|
||||
if ($changed) {
|
||||
RunRules($device->device_id);
|
||||
}
|
||||
$device->save(); // only saves if needed (which is every time because of last_ping)
|
||||
|
||||
// add data to rrd
|
||||
data_update($device->toArray(), 'ping-perf', $this->rrd_tags, ['ping' => $device->last_ping_timetaken]);
|
||||
|
Reference in New Issue
Block a user