mirror of
https://github.com/librenms/librenms.git
synced 2024-09-21 10:28:13 +00:00
Show which host marked a device as down. (#15209)
* Show which host marked a device as down. One of my pollers can't reach a device, it'd be nice to know which one is causing the issue. * Only show the actor in a distributed setup * Use distributed poller name as its now ensured * Use node_id * Change to avoid extra dns lookups * Update DeviceObserver.php * Update DeviceObserver.php --------- Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
parent
087d588102
commit
91bc3bf479
@ -7,6 +7,7 @@ use App\ApiClients\Oxidized;
|
||||
use App\Models\Device;
|
||||
use App\Models\Eventlog;
|
||||
use File;
|
||||
use LibreNMS\Config;
|
||||
use LibreNMS\Enum\Severity;
|
||||
use Log;
|
||||
|
||||
@ -41,7 +42,9 @@ class DeviceObserver
|
||||
if ($device->isDirty(['status', 'status_reason'])) {
|
||||
$type = $device->status ? 'up' : 'down';
|
||||
$reason = $device->status ? $device->getOriginal('status_reason') : $device->status_reason;
|
||||
Eventlog::log('Device status changed to ' . ucfirst($type) . " from $reason check.", $device, $type);
|
||||
$polled_by = Config::get('distributed_poller') ? (' by ' . \config('librenms.node_id')) : '';
|
||||
|
||||
Eventlog::log(sprintf('Device status changed to %s from %s check%s.', ucfirst($type), $reason, $polled_by), $device, $type);
|
||||
}
|
||||
|
||||
// key attribute changes
|
||||
|
Loading…
Reference in New Issue
Block a user