mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Extend FS switches support, handle lowerLayerDown ifOperStatus (#10904)
* extend FS switches support * MIB compilation * HW and Ver * sensors and CPU * tests * correct version * try to handle properly "down" as not up, for OperStat like lowerLayerDown * try to handle properly "down" as not up, for OperStat like lowerLayerDown * try to handle properly "down" as not up, for OperStat like lowerLayerDown * try to replace "down" with "not up" :) * fix other ifOperStatus checks
This commit is contained in:
@@ -362,7 +362,7 @@ class Url
|
||||
return "interface-admindown";
|
||||
}
|
||||
|
||||
if ($port->ifAdminStatus == "up" && $port->ifOperStatus == "down") {
|
||||
if ($port->ifAdminStatus == "up" && $port->ifOperStatus != "up") {
|
||||
return "interface-updown";
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ class GlobeController extends WidgetController
|
||||
} elseif ($data['markers'] == 'ports') {
|
||||
foreach ($location->devices as $device) {
|
||||
list($ports_down, $ports_up) = $device->ports->partition(function ($port) {
|
||||
return $port->ifOperStatus == 'down' && $port->ifAdminStatus == 'up';
|
||||
return $port->ifOperStatus != 'up' && $port->ifAdminStatus == 'up';
|
||||
});
|
||||
$count += $device->ports->count();
|
||||
$up += $ports_up->count();
|
||||
|
||||
@@ -137,7 +137,7 @@ class Port extends DeviceRelatedModel
|
||||
['deleted', '=', 0],
|
||||
['ignore', '=', 0],
|
||||
['disabled', '=', 0],
|
||||
['ifOperStatus', '=', 'down'],
|
||||
['ifOperStatus', '!=', 'up'],
|
||||
['ifAdminStatus', '=', 'up'],
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ Description: Only select ports that are down.
|
||||
|
||||
Implies: macros.port
|
||||
|
||||
Source: `(ports.ifOperStatus = "down" AND ports.ifAdminStatus != "down" AND macros.port)`
|
||||
Source: `(ports.ifOperStatus != "up" AND ports.ifAdminStatus != "down" AND macros.port)`
|
||||
|
||||
### Port-Usage in Percent (Decimal)
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ if (Auth::user()->hasGlobalRead()) {
|
||||
|
||||
$data['up'] = array('query' => "SELECT COUNT(*) FROM ports AS I, devices AS D WHERE I.`deleted` = '0' AND D.`device_id` = I.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND I.`ifOperStatus` = 'up'",);
|
||||
|
||||
$data['down'] = array('query' => "SELECT COUNT(*) FROM ports AS I, devices AS D WHERE I.`deleted` = '0' AND D.`device_id` = I.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND I.`ifOperStatus` = 'down' AND I.`ifAdminStatus` = 'up'");
|
||||
$data['down'] = array('query' => "SELECT COUNT(*) FROM ports AS I, devices AS D WHERE I.`deleted` = '0' AND D.`device_id` = I.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND I.`ifOperStatus` <> 'up' AND I.`ifAdminStatus` = 'up'");
|
||||
|
||||
$data['shutdown'] = array('query' => "SELECT COUNT(*) FROM ports AS I, devices AS D WHERE I.`deleted` = '0' AND D.`device_id` = I.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND I.`ifAdminStatus` = 'down'");
|
||||
|
||||
@@ -27,7 +27,7 @@ if (Auth::user()->hasGlobalRead()) {
|
||||
);
|
||||
|
||||
$data['down'] = array(
|
||||
'query' => "SELECT COUNT(*) FROM ports AS I, devices AS D WHERE $perms_sql AND I.`deleted` = '0' AND I.`device_id` = D.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND I.`ifOperStatus` = 'down' AND I.`ifAdminStatus` = 'up'",
|
||||
'query' => "SELECT COUNT(*) FROM ports AS I, devices AS D WHERE $perms_sql AND I.`deleted` = '0' AND I.`device_id` = D.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND I.`ifOperStatus` <> 'up' AND I.`ifAdminStatus` = 'up'",
|
||||
'params' => $device_ids
|
||||
);
|
||||
|
||||
|
||||
32
includes/definitions/discovery/fs-switch.yaml
Normal file
32
includes/definitions/discovery/fs-switch.yaml
Normal file
@@ -0,0 +1,32 @@
|
||||
mib: FS-MIB
|
||||
modules:
|
||||
processors:
|
||||
data:
|
||||
-
|
||||
oid: cpuCurrentUti
|
||||
value: cpuCurrentUti
|
||||
num_oid: '..1.3.6.1.4.1.52642.2.1.45.1.39.2.1.{{ $index }}'
|
||||
descr: 'Processor'
|
||||
sensors:
|
||||
temperature:
|
||||
data:
|
||||
-
|
||||
oid: switchThermalTempValue
|
||||
value: switchThermalTempValue
|
||||
num_oid: '.1.3.6.1.4.1.52642.2.1.45.1.1.11.1.3.{{ $index }}'
|
||||
index: 'temp1.{{ $index }}'
|
||||
descr: 'Temperature Unit {{ $subindex0 }} sensor {{ $subindex1 }}'
|
||||
state:
|
||||
data:
|
||||
-
|
||||
oid: switchOperState
|
||||
value: switchOperState
|
||||
num_oid: '.1.3.6.1.4.1.52642.2.1.45.1.1.4.{{ $index }}'
|
||||
descr: 'Oper State'
|
||||
states:
|
||||
- { value: 1, generic: 3, descr: other, graph: 0 }
|
||||
- { value: 2, generic: 3, descr: unknown, graph: 0 }
|
||||
- { value: 3, generic: 0, descr: ok, graph: 0 }
|
||||
- { value: 4, generic: 1, descr: noncritical, graph: 0 }
|
||||
- { value: 5, generic: 2, descr: critical, graph: 0 }
|
||||
- { value: 6, generic: 2, descr: unrecoverable, graph: 0 }
|
||||
@@ -12,5 +12,6 @@ mib_dir:
|
||||
discovery:
|
||||
- sysObjectID:
|
||||
- .1.3.6.1.4.1.51134
|
||||
- .1.3.6.1.4.1.52642
|
||||
- .1.3.6.1.4.1.27975
|
||||
- .1.3.6.1.4.1.12345
|
||||
|
||||
@@ -59,7 +59,7 @@ foreach (getlocations() as $location_row) {
|
||||
} elseif (\LibreNMS\Config::get('frontpage_globe.markers') == 'ports') {
|
||||
foreach (dbFetchRows("SELECT ifName,ifOperStatus,ifAdminStatus FROM ports WHERE ports.device_id = ? && ports.ignore = 0 && ports.disabled = 0 && ports.deleted = 0", array($device['device_id'])) as $port) {
|
||||
$count++;
|
||||
if ($port['ifOperStatus'] == 'down' && $port['ifAdminStatus'] == 'up') {
|
||||
if ($port['ifOperStatus'] != 'up' && $port['ifAdminStatus'] == 'up') {
|
||||
$down++;
|
||||
$devices_down[] = $device['hostname']."/".$port['ifName']." DOWN";
|
||||
} else {
|
||||
|
||||
@@ -23,7 +23,7 @@ if ($port['ifAdminStatus'] == 'down') {
|
||||
$status = "<span class='grey'>Disabled</span>";
|
||||
}
|
||||
|
||||
if ($port['ifAdminStatus'] == 'up' && $port['ifOperStatus'] == 'down') {
|
||||
if ($port['ifAdminStatus'] == 'up' && $port['ifOperStatus'] != 'up') {
|
||||
$status = "<span class='red'>Enabled / Disconnected</span>";
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ if ($port['ifAdminStatus'] == 'down') {
|
||||
$status = "<span class='grey'>Disabled</span>";
|
||||
}
|
||||
|
||||
if ($port['ifAdminStatus'] == 'up' && $port['ifOperStatus'] == 'down') {
|
||||
if ($port['ifAdminStatus'] == 'up' && $port['ifOperStatus'] != 'up') {
|
||||
$status = "<span class='red'>Enabled / Disconnected</span>";
|
||||
}
|
||||
|
||||
|
||||
@@ -50,8 +50,7 @@ foreach (dbFetchRows($sql, $param) as $port) {
|
||||
// Mark interfaces which are OperDown (but not AdminDown) yet not ignored or disabled, or up yet ignored or disabled
|
||||
// - as to draw the attention to a possible problem.
|
||||
|
||||
|
||||
$isportbad = ($port['ifOperStatus'] == 'down' && $port['ifAdminStatus'] != 'down') ? 1 : 0;
|
||||
$isportbad = ($port['ifOperStatus'] != 'up' && $port['ifAdminStatus'] != 'down') ? 1 : 0;
|
||||
$dowecare = ($port['ignore'] == 0 && $port['disabled'] == 0) ? $isportbad : !$isportbad;
|
||||
$outofsync = $dowecare ? " class='red'" : '';
|
||||
$checked = '';
|
||||
|
||||
@@ -7,6 +7,7 @@ if (!empty($matches[2])) {
|
||||
// List of OIDs for HW recognition, add any potential HW OID here.
|
||||
$hwOidList = [
|
||||
'.1.3.6.1.4.1.27975.37.1.5.1.4.1.1',
|
||||
'FS-MIB::swProdName.0',
|
||||
];
|
||||
foreach ($hwOidList as $oid) {
|
||||
$hardware_tmp = snmp_get($device, $oid, '-OQv');
|
||||
@@ -19,6 +20,7 @@ foreach ($hwOidList as $oid) {
|
||||
// As the mib is really buggy, let's use numeric OID for now
|
||||
$verOidList = [
|
||||
'.1.3.6.1.4.1.27975.1.3.5.0', //SWITCH::version.0
|
||||
'FS-MIB::swOpCodeVer.1',
|
||||
];
|
||||
foreach ($verOidList as $oid) {
|
||||
$version_tmp = snmp_get($device, $oid, '-OQv');
|
||||
@@ -31,6 +33,7 @@ foreach ($verOidList as $oid) {
|
||||
//List of OIDs for SN, add any potential device SN OID here
|
||||
$snOidList = [
|
||||
'.1.3.6.1.4.1.27975.37.1.5.1.10.1.1',
|
||||
'.1.3.6.1.4.1.52642.2.1.45.1.1.3.1.10.1',
|
||||
];
|
||||
foreach ($snOidList as $oid) {
|
||||
$serial_tmp = snmp_get($device, $oid, '-OQv');
|
||||
|
||||
@@ -246,8 +246,9 @@ if ($device['os'] === 'f5' && (version_compare($device['version'], '11.2.0', '>=
|
||||
// if admin down or operator down since the last poll, skip polling this port
|
||||
$admin_down = $port['ifAdminStatus_prev'] === 'down' && $port_stats[$ifIndex]['ifAdminStatus'] === 'down';
|
||||
$oper_down = $port['ifOperStatus_prev'] === 'down' && $port_stats[$ifIndex]['ifOperStatus'] === 'down';
|
||||
$ll_down = $port['ifOperStatus_prev'] === 'lowerLayerDown' && $port_stats[$ifIndex]['ifOperStatus'] === 'lowerLayerDown';
|
||||
|
||||
if ($admin_down || $oper_down) {
|
||||
if ($admin_down || $oper_down || $ll_down) {
|
||||
if ($admin_down) {
|
||||
d_echo(" port $ifIndex is still admin down\n");
|
||||
} else {
|
||||
|
||||
20936
mibs/fs/FS-MIB
Normal file
20936
mibs/fs/FS-MIB
Normal file
File diff suppressed because it is too large
Load Diff
@@ -15,14 +15,14 @@
|
||||
;
|
||||
|
||||
gbnDeviceStackMib MODULE-IDENTITY
|
||||
LAST-UPDATED "2013/07/09" -- July 09, 2013
|
||||
LAST-UPDATED "201307090000Z" -- July 09, 2013
|
||||
ORGANIZATION "ADMIN"
|
||||
CONTACT-INFO "ADMIN
|
||||
E-mail: support@admin.com"
|
||||
|
||||
DESCRIPTION "gbn stack Enterprise MIB definition."
|
||||
|
||||
REVISION "2013/07/09" -- July 09, 2013
|
||||
REVISION "201307090000Z" -- July 09, 2013
|
||||
DESCRIPTION "Initial MIB creation."
|
||||
|
||||
::= { gbnDevice 5 }
|
||||
|
||||
@@ -17,14 +17,14 @@
|
||||
gbnL2Switch OBJECT IDENTIFIER ::= { gbnL2 1 }
|
||||
|
||||
gbnL2PortSecurityMib MODULE-IDENTITY
|
||||
LAST-UPDATED "2013/01/24" -- Jan 24, 2013
|
||||
LAST-UPDATED "201301240000Z" -- Jan 24, 2013
|
||||
ORGANIZATION "Admin"
|
||||
CONTACT-INFO "Admin
|
||||
E-mail: support@admin.com"
|
||||
|
||||
DESCRIPTION "gbn PortSecurity Enterprise MIB definition."
|
||||
|
||||
REVISION "2013/01/24" -- Jan 24, 2013
|
||||
REVISION "201301240000Z" -- Jan 24, 2013
|
||||
DESCRIPTION "Initial MIB creation."
|
||||
|
||||
::= { gbnL2Switch 8 }
|
||||
|
||||
@@ -12,14 +12,14 @@
|
||||
|
||||
|
||||
gbnL2PppoePlus MODULE-IDENTITY
|
||||
LAST-UPDATED "0711220000Z" -- November 22,2007
|
||||
LAST-UPDATED "200711220000Z" -- November 22,2007
|
||||
ORGANIZATION "admin Systems, Inc."
|
||||
CONTACT-INFO "admin Systems, Inc.
|
||||
E-mail: support@admin.com.cn"
|
||||
|
||||
DESCRIPTION "ADMIN Enterprise MIB definition."
|
||||
|
||||
REVISION "07110220000Z" -- November 22,2007
|
||||
REVISION "200711220000Z" -- November 22,2007
|
||||
DESCRIPTION "Initial MIB creation."
|
||||
|
||||
::= { gbnL2 6 }
|
||||
|
||||
@@ -27,14 +27,14 @@
|
||||
|
||||
|
||||
gbn8021xCmMib MODULE-IDENTITY
|
||||
LAST-UPDATED "2002/07/02" -- July 2, 2002
|
||||
LAST-UPDATED "200207020000Z" -- July 2, 2002
|
||||
ORGANIZATION "admin Systems, Inc."
|
||||
CONTACT-INFO "admin Systems, Inc.
|
||||
E-mail: support@admin.com.cn"
|
||||
|
||||
DESCRIPTION "admin CM Enterprise MIB definition."
|
||||
|
||||
REVISION "2002/07/02" -- July 2, 2002
|
||||
REVISION "200207020000Z" -- July 2, 2002
|
||||
DESCRIPTION "Initial MIB creation."
|
||||
|
||||
::= { gbnServiceAAA 1 }
|
||||
|
||||
@@ -15,14 +15,14 @@
|
||||
|
||||
|
||||
gbnMacAuthenMib MODULE-IDENTITY
|
||||
LAST-UPDATED "2010/06/01" -- Jun 01, 2010
|
||||
LAST-UPDATED "201006010000Z" -- Jun 01, 2010
|
||||
ORGANIZATION "Admin"
|
||||
CONTACT-INFO "Admin
|
||||
E-mail: support@Admin.com"
|
||||
|
||||
DESCRIPTION "gbn macauthen Enterprise MIB definition."
|
||||
|
||||
REVISION "2010/06/01" -- Jun 01, 2010
|
||||
REVISION "201006010000Z" -- Jun 01, 2010
|
||||
DESCRIPTION "Initial MIB creation."
|
||||
|
||||
::= { gbnServiceAAA 4 }
|
||||
|
||||
@@ -15,14 +15,14 @@
|
||||
|
||||
|
||||
gbnTacacsMib MODULE-IDENTITY
|
||||
LAST-UPDATED "2009/05/27" -- May 27, 2009
|
||||
LAST-UPDATED "200905270000Z" -- May 27, 2009
|
||||
ORGANIZATION "QTECH LLC"
|
||||
CONTACT-INFO "Basil Budko
|
||||
E-mail: budko@qtech.ru"
|
||||
|
||||
DESCRIPTION "admin tacacs Enterprise MIB definition."
|
||||
|
||||
REVISION "2009/05/27" -- May 27, 2009
|
||||
REVISION "200905270000Z" -- May 27, 2009
|
||||
DESCRIPTION "Initial MIB creation."
|
||||
|
||||
::= { gbnServiceAAA 3 }
|
||||
|
||||
@@ -9,7 +9,7 @@ LLDPPRIVATE-MIB DEFINITIONS ::= BEGIN
|
||||
|
||||
|
||||
lldpPrivateMIB MODULE-IDENTITY
|
||||
LAST-UPDATED "20060727Z" -- July 27, 2006
|
||||
LAST-UPDATED "200607270000Z" -- July 27, 2006
|
||||
ORGANIZATION "admin Inc."
|
||||
CONTACT-INFO
|
||||
"admin
|
||||
@@ -17,7 +17,7 @@ LLDPPRIVATE-MIB DEFINITIONS ::= BEGIN
|
||||
|
||||
DESCRIPTION "LLDP private module management."
|
||||
|
||||
REVISION "20060727Z" -- July 27, 2006
|
||||
REVISION "200607270000Z" -- July 27, 2006
|
||||
DESCRIPTION "Initial Version"
|
||||
|
||||
::= { gbnL2 5 }
|
||||
|
||||
7390
tests/data/fs-switch_s3900.json
Normal file
7390
tests/data/fs-switch_s3900.json
Normal file
File diff suppressed because it is too large
Load Diff
2152
tests/snmpsim/fs-switch_s3900.snmprec
Normal file
2152
tests/snmpsim/fs-switch_s3900.snmprec
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user