Fix OS sensor array return (#12694)

This commit is contained in:
Jellyfrog 2021-04-23 04:49:33 +02:00 committed by GitHub
parent b9b7a8caa9
commit 53d46044c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 12 deletions

View File

@ -49,6 +49,8 @@ class AirosAfLtu extends OS implements
new WirelessSensor('distance', $this->getDeviceId(), '.1.3.6.1.4.1.41112.1.10.1.4.1.23.' . $index, 'airos-af-ltu', 1, 'Distance', $entry['afLTUStaRemoteDistance'], 1, 1000), //UBNT-AFLTU-MIB::afLTUStaRemoteDistance new WirelessSensor('distance', $this->getDeviceId(), '.1.3.6.1.4.1.41112.1.10.1.4.1.23.' . $index, 'airos-af-ltu', 1, 'Distance', $entry['afLTUStaRemoteDistance'], 1, 1000), //UBNT-AFLTU-MIB::afLTUStaRemoteDistance
]; ];
} }
return [];
} }
/** /**

View File

@ -109,7 +109,6 @@ class Routeros extends OS implements
{ {
$data = $this->fetchData(); $data = $this->fetchData();
$sensors = [];
foreach ($data as $index => $entry) { foreach ($data as $index => $entry) {
if ($entry['mtxrWlApFreq'] == null) { if ($entry['mtxrWlApFreq'] == null) {
return $this->discoverSensor( return $this->discoverSensor(
@ -125,6 +124,8 @@ class Routeros extends OS implements
); );
} }
} }
return [];
} }
/** /**
@ -249,7 +250,7 @@ class Routeros extends OS implements
return $sensors; return $sensors;
} }
private function discoverSensor($type, $oid, $num_oid_base) private function discoverSensor($type, $oid, $num_oid_base): array
{ {
$data = $this->fetchData(); $data = $this->fetchData();
$sensors = []; $sensors = [];

View File

@ -120,11 +120,6 @@ parameters:
count: 2 count: 2
path: LibreNMS/Modules/Mpls.php path: LibreNMS/Modules/Mpls.php
-
message: "#^Method LibreNMS\\\\OS\\\\AirosAfLtu\\:\\:discoverWirelessDistance\\(\\) should return array but return statement is missing\\.$#"
count: 1
path: LibreNMS/OS/AirosAfLtu.php
- -
message: "#^Parameter \\#8 \\$multiplier of class LibreNMS\\\\Device\\\\WirelessSensor constructor expects int, null given\\.$#" message: "#^Parameter \\#8 \\$multiplier of class LibreNMS\\\\Device\\\\WirelessSensor constructor expects int, null given\\.$#"
count: 2 count: 2
@ -145,11 +140,6 @@ parameters:
count: 1 count: 1
path: LibreNMS/OS/Ios.php path: LibreNMS/OS/Ios.php
-
message: "#^Method LibreNMS\\\\OS\\\\Routeros\\:\\:discoverWirelessFrequency\\(\\) should return array but return statement is missing\\.$#"
count: 1
path: LibreNMS/OS/Routeros.php
- -
message: "#^Parameter \\#8 \\$multiplier of class LibreNMS\\\\Device\\\\WirelessSensor constructor expects int, null given\\.$#" message: "#^Parameter \\#8 \\$multiplier of class LibreNMS\\\\Device\\\\WirelessSensor constructor expects int, null given\\.$#"
count: 1 count: 1