mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix location for devices with broken snmp (#12544)
AirOS devices with old firmware did not return SNMP results as they should. This compromise should minimize extra snmp queries. (Although there are more)
This commit is contained in:
@@ -83,7 +83,7 @@ trait YamlOSDiscovery
|
||||
public function fetchLocation(): Location
|
||||
{
|
||||
$os_yaml = $this->getDiscovery('os');
|
||||
$name = $os_yaml['location'] ?? 'SNMPv2-MIB::sysLocation.0';
|
||||
$name = $os_yaml['location'] ?? null;
|
||||
$lat = $os_yaml['lat'] ?? null;
|
||||
$lng = $os_yaml['long'] ?? null;
|
||||
|
||||
@@ -94,7 +94,7 @@ trait YamlOSDiscovery
|
||||
Log::debug('Yaml location data:', $data);
|
||||
|
||||
return new Location([
|
||||
'location' => $this->findFirst($data, $name, $numeric),
|
||||
'location' => $this->findFirst($data, $name, $numeric) ?? snmp_get($this->getDeviceArray(), 'SNMPv2-MIB::sysLocation.0', '-Oqv'),
|
||||
'lat' => $this->findFirst($data, $lat, $numeric),
|
||||
'lng' => $this->findFirst($data, $lng, $numeric),
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user