Skip to content

Commit cb6f374

Browse files
authored
Merge branch 'master' into alert-log-ajax
2 parents aa6889c + 7dbbe90 commit cb6f374

File tree

375 files changed

+38559
-10849
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

375 files changed

+38559
-10849
lines changed

LibreNMS/Alert/Transport/Pagerduty.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function deliverAlert(array $alert_data): bool
4949
} else {
5050
// Legacy behaviour: strip tags and split into non-empty lines
5151
$safe_message = strip_tags($msg_raw) ?: 'Test';
52-
$message = array_filter(explode("\n", $safe_message), fn ($value): bool => strlen($value) > 0);
52+
$message = array_filter(explode("\n", $safe_message), fn ($value): bool => strlen((string) $value) > 0);
5353
$custom_details = ['message' => $message];
5454
}
5555
$data = [

LibreNMS/ComposerHelper.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ private static function populateEnv()
134134
];
135135

136136
if (file_exists('config.php')) {
137-
/** @phpstan-ignore include.fileNotFound */
138137
@include 'config.php';
139138
}
140139

LibreNMS/DB/Eloquent.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
namespace LibreNMS\DB;
2828

2929
use Illuminate\Database\Connection;
30+
use Illuminate\Support\Facades\Config;
3031
use Illuminate\Support\Facades\DB;
3132
use LibreNMS\Util\Laravel;
3233
use PDOException;
@@ -102,7 +103,7 @@ public static function getDriver(): ?string
102103
*/
103104
public static function setConnection($name, $db_host = null, $db_user = '', $db_pass = '', $db_name = '', $db_port = null, $db_socket = null): void
104105
{
105-
\Config::set("database.connections.$name", [
106+
Config::set("database.connections.$name", [
106107
'driver' => 'mysql',
107108
'host' => $db_host,
108109
'port' => $db_port,
@@ -116,6 +117,6 @@ public static function setConnection($name, $db_host = null, $db_user = '', $db_
116117
'strict' => true,
117118
'engine' => null,
118119
]);
119-
\Config::set('database.default', $name);
120+
Config::set('database.default', $name);
120121
}
121122
}

LibreNMS/Model.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ abstract public function isValid();
174174
*/
175175
public static function onDelete($model)
176176
{
177-
if (\App::runningInConsole()) {
177+
if (app()->runningInConsole()) {
178178
echo '-';
179179
}
180180
}
@@ -184,7 +184,7 @@ public static function onDelete($model)
184184
*/
185185
public static function onCreate($model)
186186
{
187-
if (\App::runningInConsole()) {
187+
if (app()->runningInConsole()) {
188188
echo '+';
189189
}
190190
}
@@ -194,14 +194,14 @@ public static function onCreate($model)
194194
*/
195195
public static function onUpdate($model)
196196
{
197-
if (\App::runningInConsole()) {
197+
if (app()->runningInConsole()) {
198198
echo 'U';
199199
}
200200
}
201201

202202
public static function onNoUpdate()
203203
{
204-
if (\App::runningInConsole()) {
204+
if (app()->runningInConsole()) {
205205
echo '.';
206206
}
207207
}

LibreNMS/OS/ArubaInstant.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ protected function decodeChannel($channel): int
282282
*/
283283
public function pollWirelessFrequency(array $sensors)
284284
{
285-
return $this->pollWirelessChannelAsFrequency($sensors, [$this, 'decodeChannel']);
285+
return $this->pollWirelessChannelAsFrequency($sensors, $this->decodeChannel(...));
286286
}
287287

288288
/**

LibreNMS/OS/Arubaos.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,6 @@ public function discoverWirelessUtilization()
215215
*/
216216
public function pollWirelessFrequency(array $sensors)
217217
{
218-
return $this->pollWirelessChannelAsFrequency($sensors, [$this, 'decodeChannel']);
218+
return $this->pollWirelessChannelAsFrequency($sensors, $this->decodeChannel(...));
219219
}
220220
}

LibreNMS/OS/Ceraos.php

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRateDiscovery;
3838
use LibreNMS\Interfaces\Discovery\Sensors\WirelessXpiDiscovery;
3939
use LibreNMS\OS;
40+
use SnmpQuery;
4041

4142
class Ceraos extends OS implements OSDiscovery, WirelessXpiDiscovery, WirelessFrequencyDiscovery, WirelessErrorsDiscovery, WirelessMseDiscovery, WirelessPowerDiscovery, WirelessRateDiscovery
4243
{
@@ -57,9 +58,10 @@ public function discoverOS(Device $device): void
5758
$device->location->save();
5859
}
5960

61+
$ifDescr = SnmpQuery::walk('IF-MIB::ifDescr')->valuesByIndex();
6062
$num_radios = 0;
61-
foreach (snmpwalk_group($this->getDeviceArray(), 'ifDescr', 'IF-MIB') as $interface) {
62-
if ($interface['ifDescr'] == 'Radio') {
63+
foreach ($ifDescr as $cols) {
64+
if (($cols['IF-MIB::ifDescr'] ?? null) === 'Radio') {
6365
$num_radios++;
6466
}
6567
}
@@ -74,7 +76,7 @@ public function discoverWirelessXpi()
7476
$sensors = [];
7577
$divisor = 100;
7678

77-
$xpi = snmpwalk_group($this->getDeviceArray(), 'genEquipRadioStatusXPI', 'MWRM-RADIO-MIB');
79+
$xpi = SnmpQuery::walk('MWRM-RADIO-MIB::genEquipRadioStatusXPI')->valuesByIndex();
7880
foreach ($xpi as $index => $data) {
7981
$sensors[] = new WirelessSensor(
8082
'xpi',
@@ -83,7 +85,7 @@ public function discoverWirelessXpi()
8385
'ceraos',
8486
$index,
8587
$ifNames[$index],
86-
$data['genEquipRadioStatusXPI'] / $divisor,
88+
$data['MWRM-RADIO-MIB::genEquipRadioStatusXPI'] / $divisor,
8789
1,
8890
$divisor
8991
);
@@ -96,7 +98,7 @@ public function discoverWirelessFrequency()
9698
{
9799
$sensors = [];
98100
// MWRM-RADIO-MIB::genEquipRfuCfgTxFreq
99-
$tx = snmpwalk_group($this->getDeviceArray(), 'genEquipRfuCfgTxFreq', 'MWRM-RADIO-MIB');
101+
$tx = SnmpQuery::walk('MWRM-RADIO-MIB::genEquipRfuCfgTxFreq')->valuesByIndex();
100102
$TxRadio = 0;
101103
foreach ($tx as $index => $data) {
102104
$TxRadio++;
@@ -113,7 +115,7 @@ public function discoverWirelessFrequency()
113115
);
114116
}
115117
// MWRM-RADIO-MIB::genEquipRfuCfgRxFreq
116-
$rx = snmpwalk_group($this->getDeviceArray(), 'genEquipRfuCfgRxFreq', 'MWRM-RADIO-MIB');
118+
$rx = SnmpQuery::walk('MWRM-RADIO-MIB::genEquipRfuCfgRxFreq')->valuesByIndex();
117119
$RxRadio = 0;
118120
foreach ($rx as $index => $data) {
119121
$RxRadio++;
@@ -145,7 +147,7 @@ public function discoverWirelessRate()
145147

146148
$sensors = [];
147149

148-
$tx = snmpwalk_group($this->getDeviceArray(), 'genEquipRadioMRMCCurrTxBitrate', 'MWRM-RADIO-MIB');
150+
$tx = SnmpQuery::walk('MWRM-RADIO-MIB::genEquipRadioMRMCCurrTxBitrate')->valuesByIndex();
149151
foreach ($tx as $index => $data) {
150152
$sensors[] = new WirelessSensor(
151153
'rate',
@@ -154,12 +156,12 @@ public function discoverWirelessRate()
154156
'ceraos-tx',
155157
$index,
156158
$ifNames[$index] . ' TX Bitrate',
157-
$data['genEquipRadioMRMCCurrTxBitrate'],
159+
$data['MWRM-RADIO-MIB::genEquipRadioMRMCCurrTxBitrate'],
158160
1000
159161
);
160162
}
161163

162-
$rx = snmpwalk_group($this->getDeviceArray(), 'genEquipRadioMRMCCurrRxBitrate', 'MWRM-RADIO-MIB');
164+
$rx = SnmpQuery::walk('MWRM-RADIO-MIB::genEquipRadioMRMCCurrRxBitrate')->valuesByIndex();
163165
foreach ($rx as $index => $data) {
164166
$sensors[] = new WirelessSensor(
165167
'rate',
@@ -168,7 +170,7 @@ public function discoverWirelessRate()
168170
'ceraos-rx',
169171
$index,
170172
$ifNames[$index] . ' RX Bitrate',
171-
$data['genEquipRadioMRMCCurrRxBitrate'],
173+
$data['MWRM-RADIO-MIB::genEquipRadioMRMCCurrRxBitrate'],
172174
1000
173175
);
174176
}
@@ -188,7 +190,7 @@ public function discoverWirelessErrors()
188190

189191
$sensors = [];
190192

191-
$mse = snmpwalk_group($this->getDeviceArray(), 'genEquipRadioStatusDefectedBlocks', 'MWRM-RADIO-MIB');
193+
$mse = SnmpQuery::walk('MWRM-RADIO-MIB::genEquipRadioStatusDefectedBlocks')->valuesByIndex();
192194
foreach ($mse as $index => $data) {
193195
$sensors[] = new WirelessSensor(
194196
'errors',
@@ -197,7 +199,7 @@ public function discoverWirelessErrors()
197199
'ceraos',
198200
$index,
199201
$ifNames[$index] . ' Defected Blocks',
200-
$data['genEquipRadioStatusDefectedBlocks']
202+
$data['MWRM-RADIO-MIB::genEquipRadioStatusDefectedBlocks']
201203
);
202204
}
203205

@@ -217,7 +219,7 @@ public function discoverWirelessMse()
217219
$sensors = [];
218220
$divisor = 100;
219221

220-
$mse = snmpwalk_group($this->getDeviceArray(), 'genEquipRadioStatusMSE', 'MWRM-RADIO-MIB');
222+
$mse = SnmpQuery::walk('MWRM-RADIO-MIB::genEquipRadioStatusMSE')->valuesByIndex();
221223
foreach ($mse as $index => $data) {
222224
$sensors[] = new WirelessSensor(
223225
'mse',
@@ -226,7 +228,7 @@ public function discoverWirelessMse()
226228
'ceraos',
227229
$index,
228230
$ifNames[$index],
229-
$data['genEquipRadioStatusMSE'] / $divisor,
231+
$data['MWRM-RADIO-MIB::genEquipRadioStatusMSE'] / $divisor,
230232
1,
231233
$divisor
232234
);
@@ -247,29 +249,42 @@ public function discoverWirelessPower()
247249

248250
$sensors = [];
249251

250-
$tx = snmpwalk_group($this->getDeviceArray(), 'genEquipRfuStatusTxLevel', 'MWRM-RADIO-MIB');
252+
$tx = SnmpQuery::walk('MWRM-RADIO-MIB::genEquipRfuStatusTxLevel')->valuesByIndex();
251253
foreach ($tx as $index => $data) {
252254
$sensors[] = new WirelessSensor(
253255
'power',
254256
$this->getDeviceId(),
255257
'.1.3.6.1.4.1.2281.10.5.1.1.3.' . $index,
256258
'ceraos-tx',
257259
$index,
258-
$ifNames[$index] . ' TX Level',
259-
$data['genEquipRfuStatusTxLevel']
260+
$ifNames[$index] . ' TX',
261+
$data['MWRM-RADIO-MIB::genEquipRfuStatusTxLevel']
260262
);
261263
}
262264

263-
$rx = snmpwalk_group($this->getDeviceArray(), 'genEquipRfuStatusRxLevel', 'MWRM-RADIO-MIB');
264-
foreach ($rx as $index => $data) {
265+
$main_rx = SnmpQuery::walk('MWRM-RADIO-MIB::genEquipRfuStatusRxLevel')->valuesByIndex();
266+
foreach ($main_rx as $index => $data) {
265267
$sensors[] = new WirelessSensor(
266268
'power',
267269
$this->getDeviceId(),
268270
'.1.3.6.1.4.1.2281.10.5.1.1.2.' . $index,
269-
'ceraos-rx',
271+
'ceraos-main-rx',
272+
$index,
273+
$ifNames[$index] . ' RX Main',
274+
$data['MWRM-RADIO-MIB::genEquipRfuStatusRxLevel']
275+
);
276+
}
277+
278+
$div_rx = SnmpQuery::walk('MWRM-RADIO-MIB::genEquipRfuStatusRxLevelDiversity')->valuesByIndex();
279+
foreach ($div_rx as $index => $data) {
280+
$sensors[] = new WirelessSensor(
281+
'power',
282+
$this->getDeviceId(),
283+
'.1.3.6.1.4.1.2281.10.5.1.1.10.' . $index,
284+
'ceraos-diversity-rx',
270285
$index,
271-
$ifNames[$index] . ' RX Level',
272-
$data['genEquipRfuStatusRxLevel']
286+
$ifNames[$index] . ' RX Diversity',
287+
$data['MWRM-RADIO-MIB::genEquipRfuStatusRxLevelDiversity']
273288
);
274289
}
275290

LibreNMS/OS/FsBdcom.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
/**
4+
* FsBdcom.php
5+
*
6+
* BDCOM OS (FS version)
7+
*
8+
* This program is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU General Public License as published by
10+
* the Free Software Foundation, either version 3 of the License, or
11+
* (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
16+
* GNU General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU General Public License
19+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
20+
*
21+
* @link https://www.librenms.org
22+
*
23+
* @copyright 2026 Frederik Kriewitz
24+
* @author Frederik Kriewitz <frederik@kriewitz.eu>
25+
*/
26+
27+
namespace LibreNMS\OS;
28+
29+
class FsBdcom extends Bdcom
30+
{
31+
// No changes needed, inherits everything from Bdcom (OEM)
32+
}

LibreNMS/OS/Iosxe.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function discoverIsIs(): Collection
106106
'isisISAdjNeighSysID' => $this->formatIsIsId($adjacency_data['CISCO-IETF-ISIS-MIB::ciiISAdjNeighSysID'] ?? ''),
107107
'isisISAdjNeighPriority' => $adjacency_data['CISCO-IETF-ISIS-MIB::ciiISAdjNeighPriority'] ?? '',
108108
'isisISAdjLastUpTime' => $this->parseAdjacencyTime($adjacency_data['CISCO-IETF-ISIS-MIB::ciiISAdjLastUpTime'] ?? 0),
109-
'isisISAdjAreaAddress' => implode(',', array_map([$this, 'formatIsIsId'], $adjacency_data['CISCO-IETF-ISIS-MIB::ciiISAdjAreaAddress'] ?? [])),
109+
'isisISAdjAreaAddress' => implode(',', array_map($this->formatIsIsId(...), $adjacency_data['CISCO-IETF-ISIS-MIB::ciiISAdjAreaAddress'] ?? [])),
110110
'isisISAdjIPAddrType' => implode(',', $adjacency_data['CISCO-IETF-ISIS-MIB::ciiISAdjIPAddrType'] ?? []),
111111
'isisISAdjIPAddrAddress' => implode(',', array_map(fn ($ip) => (string) IP::fromHexString($ip, true), $adjacency_data['CISCO-IETF-ISIS-MIB::ciiISAdjIPAddrAddress'] ?? [])),
112112
]));

LibreNMS/Util/Laravel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
namespace LibreNMS\Util;
2828

29-
use App;
29+
use Illuminate\Support\Facades\App;
3030
use Illuminate\Support\Facades\Log;
3131
use Symfony\Component\HttpFoundation\HeaderBag;
3232

0 commit comments

Comments
 (0)