FabOS remove disabled dbm sensors (#12877)

* 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]>
This commit is contained in:
Erik
2021-10-20 18:51:49 -05:00
committed by GitHub
co-authored by Erik Tony Murray
parent fb934e2ede
commit 27c124f19f
7 changed files with 26446 additions and 3207 deletions
+2 -2
View File
@@ -48,12 +48,12 @@ foreach ($ports_mapped['maps']['ifIndex'] as $ifIndex => $port_id) {
// Fill ifAlias for fibrechannel ports
if ($device['os'] == 'fabos') {
require_once 'ports/brocade.inc.php';
require base_path('includes/discovery/ports/brocade.inc.php');
}
//Shorten Ekinops Interfaces
if ($device['os'] == 'ekinops') {
require_once 'ports/ekinops.inc.php';
require base_path('includes/discovery/ports/ekinops.inc.php');
}
$default_port_group = Config::get('default_port_group');
+2 -3
View File
@@ -1,7 +1,6 @@
<?php
$brocade_stats = snmpwalk_group($device, 'swFCPortName', 'SW-MIB', 1, $brocade_stats);
foreach ($brocade_stats as $index => $port) {
foreach (snmpwalk_group($device, 'swFCPortName', 'SW-MIB') as $index => $brocade_port) {
$index_brocade = $index + 1073741823;
$port_stats[$index_brocade]['ifAlias'] = $brocade_stats[$index]['swFCPortName'];
$port_stats[$index_brocade]['ifAlias'] = $brocade_port['swFCPortName'];
}
+47 -41
View File
@@ -4,33 +4,36 @@ $fabosSfpRxPower = snmpwalk_array_num($device, '.1.3.6.1.4.1.1588.2.1.1.1.28.1.1
$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;
discover_sensor(
$valid['sensor'],
'dbm',
$device,
".$oid.$index",
'swSfpRxPower.' . $index,
'brocade',
makeshortif($ifDescr[$ifIndex]) . ' RX',
1,
1,
-35,
-30,
-3,
0,
$current,
'snmp',
$ifIndex,
'ports',
null,
'Receive Power'
);
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'
);
}
}
}
}
@@ -39,26 +42,29 @@ foreach ($fabosSfpTxPower as $oid => $entry) {
foreach ($entry as $index => $current) {
if (is_numeric($current)) {
$ifIndex = $index + 1073741823;
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');
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'
);
}
}
}
}
+2 -4
View File
@@ -1,8 +1,6 @@
<?php
$brocade_stats = snmpwalk_group($device, 'swFCPortName', 'SW-MIB', 1, $brocade_stats);
foreach ($brocade_stats as $index => $port) {
foreach (snmpwalk_group($device, 'swFCPortName', 'SW-MIB') as $index => $brocade_port) {
$index_brocade = $index + 1073741823;
$port_stats[$index_brocade]['ifAlias'] = $brocade_stats[$index]['swFCPortName'];
$port_stats[$index_brocade]['ifAlias'] = $brocade_port['swFCPortName'];
}
+61 -3157
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff