mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* add check if adminstatus is up * added testdata * Changed ifAdminStatus state detection * updated testdata * updated testdata2 * Update fabos_6520.json * Update fabos.json * Update fabos_6520.json * Update fabos.json * fix fabos.json * fix bug in discovery include Co-authored-by: Erik <[email protected]> Co-authored-by: Tony Murray <[email protected]>
71 lines
2.2 KiB
PHP
71 lines
2.2 KiB
PHP
<?php
|
|
|
|
$fabosSfpRxPower = snmpwalk_array_num($device, '.1.3.6.1.4.1.1588.2.1.1.1.28.1.1.4'); // FA-EXT-MIB::swSfpRxPower
|
|
$fabosSfpTxPower = snmpwalk_array_num($device, '.1.3.6.1.4.1.1588.2.1.1.1.28.1.1.5'); // FA-EXT-MIB::swSfpTxPower
|
|
if (! empty($fabosSfpRxPower) || ! empty($fabosSfpTxPower)) {
|
|
$ifDescr = snmpwalk_group($device, 'ifDescr', 'IF-MIB', 0)['ifDescr'] ?? [];
|
|
$ifAdminStatus = snmpwalk_group($device, 'ifAdminStatus', 'IF-MIB', 0)['ifAdminStatus'] ?? [];
|
|
}
|
|
|
|
foreach ($fabosSfpRxPower as $oid => $entry) {
|
|
foreach ($entry as $index => $current) {
|
|
if (is_numeric($current)) {
|
|
$ifIndex = $index + 1073741823;
|
|
if ($ifAdminStatus[$ifIndex] == '1') {
|
|
discover_sensor(
|
|
$valid['sensor'],
|
|
'dbm',
|
|
$device,
|
|
".$oid.$index",
|
|
'swSfpRxPower.' . $index,
|
|
'brocade',
|
|
makeshortif($ifDescr[$ifIndex]) . ' RX',
|
|
1,
|
|
1,
|
|
-5,
|
|
null,
|
|
null,
|
|
0,
|
|
$current,
|
|
'snmp',
|
|
$ifIndex,
|
|
'ports',
|
|
null,
|
|
'Receive Power'
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
foreach ($fabosSfpTxPower as $oid => $entry) {
|
|
foreach ($entry as $index => $current) {
|
|
if (is_numeric($current)) {
|
|
$ifIndex = $index + 1073741823;
|
|
if ($ifAdminStatus[$ifIndex] == '1') {
|
|
discover_sensor(
|
|
$valid['sensor'],
|
|
'dbm',
|
|
$device,
|
|
".$oid.$index",
|
|
'swSfpTxPower.' . $index,
|
|
'brocade',
|
|
makeshortif($ifDescr[$ifIndex]) . ' TX',
|
|
1,
|
|
1,
|
|
-5,
|
|
null,
|
|
null,
|
|
0,
|
|
$current,
|
|
'snmp',
|
|
$ifIndex,
|
|
'ports',
|
|
null,
|
|
'Transmit Power'
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|