mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Use overwrite_ip when set on devices for ping checks (#12022)
* Use overwrite_ip when set on devices for ping checks * style changes * fix issue with overwriting tier 1 devices by moving the overwrite_ip check further upstream * style fixes * use poller target instead of custom function * style fixes
This commit is contained in:
@@ -156,14 +156,16 @@ class PingCheck implements ShouldQueue
|
||||
|
||||
/** @var Builder $query */
|
||||
$query = Device::canPing()
|
||||
->select(['devices.device_id', 'hostname', 'status', 'status_reason', 'last_ping', 'last_ping_timetaken', 'max_depth'])
|
||||
->select(['devices.device_id', 'hostname', 'overwrite_ip', 'status', 'status_reason', 'last_ping', 'last_ping_timetaken', 'max_depth'])
|
||||
->orderBy('max_depth');
|
||||
|
||||
if ($this->groups) {
|
||||
$query->whereIn('poller_group', $this->groups);
|
||||
}
|
||||
|
||||
$this->devices = $query->get()->keyBy('hostname');
|
||||
$this->devices = $query->get()->keyBy(function ($device) {
|
||||
return Device::pollerTarget(json_decode(json_encode($device), true));
|
||||
});
|
||||
|
||||
// working collections
|
||||
$this->tiered = $this->devices->groupBy('max_depth', true);
|
||||
|
Reference in New Issue
Block a user