mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Improved Infinera Groove discovery (#9913)
* Improvements for infinera groove - add support for 3.0.1 and prior versions - add support for subports and fibre-channel - fix bug relating to OS version detection - updated unit test snmprec
This commit is contained in:
committed by
PipoCanaja
parent
eb82a153d9
commit
8d67bb776e
@@ -50,3 +50,10 @@ over:
|
|||||||
discovery:
|
discovery:
|
||||||
- sysObjectID:
|
- sysObjectID:
|
||||||
- .1.3.6.1.4.1.42229.1.2
|
- .1.3.6.1.4.1.42229.1.2
|
||||||
|
- sysObjectID:
|
||||||
|
- .1.3.6.1.4.1.8072.3.2.10
|
||||||
|
snmpget:
|
||||||
|
oid: CORIANT-GROOVE-MIB::softwareloadSwloadProduct.1
|
||||||
|
mib_dir: infinera
|
||||||
|
op: 'contains'
|
||||||
|
value: 'Groove'
|
||||||
|
@@ -27,12 +27,20 @@ echo 'infinera-groove: ';
|
|||||||
|
|
||||||
$oid_list = [
|
$oid_list = [
|
||||||
'neType.0',
|
'neType.0',
|
||||||
|
'softwareloadSwloadState.1',
|
||||||
|
'softwareloadSwloadState.2',
|
||||||
'softwareloadSwloadVersion.1',
|
'softwareloadSwloadVersion.1',
|
||||||
|
'softwareloadSwloadVersion.2',
|
||||||
'inventoryManufacturerNumber.shelf.1.0.0.0',
|
'inventoryManufacturerNumber.shelf.1.0.0.0',
|
||||||
];
|
];
|
||||||
|
|
||||||
$data = snmp_get_multi($device, $oid_list, '-OUQs', 'CORIANT-GROOVE-MIB');
|
$data = snmp_get_multi($device, $oid_list, '-OUQs', 'CORIANT-GROOVE-MIB');
|
||||||
|
|
||||||
$version = $data[1]['softwareloadSwloadVersion'];
|
foreach (array_keys($data) as $dkey) {
|
||||||
|
if (isset($data[$dkey]['softwareloadSwloadState']) && $data[$dkey]['softwareloadSwloadState'] == 'active') {
|
||||||
|
$version = $data[$dkey]['softwareloadSwloadVersion'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
$hardware = $data[0]['neType'];
|
$hardware = $data[0]['neType'];
|
||||||
$serial = $data['shelf.1.0.0.0']['inventoryManufacturerNumber'];
|
$serial = $data['shelf.1.0.0.0']['inventoryManufacturerNumber'];
|
||||||
|
@@ -26,41 +26,46 @@
|
|||||||
|
|
||||||
echo 'Port types:';
|
echo 'Port types:';
|
||||||
|
|
||||||
foreach (array ('100', '40', '10') as $infineratype) {
|
foreach (array ('eth100g', 'eth40g', 'eth10g', 'fc16g', 'fc8g') as $infineratype) {
|
||||||
if (!is_array($cg_stats)) {
|
echo ' '.$infineratype;
|
||||||
echo ' eth'.$infineratype.'g';
|
preg_match('/[a-z]+(\d+)g/i', $infineratype, $matches);
|
||||||
$cg_stats = snmpwalk_cache_multi_oid($device, 'eth'.$infineratype.'gEntry', $cg_stats, 'CORIANT-GROOVE-MIB');
|
$infspeed = $matches[1];
|
||||||
$cg_stats = snmpwalk_cache_multi_oid($device, 'eth'.$infineratype.'gStatistics', $cg_stats, 'CORIANT-GROOVE-MIB');
|
|
||||||
}
|
$cg_stats = snmpwalk_cache_multi_oid($device, $infineratype.'Entry', $cg_stats, 'CORIANT-GROOVE-MIB');
|
||||||
|
$cg_stats = snmpwalk_cache_multi_oid($device, $infineratype.'Statistics', $cg_stats, 'CORIANT-GROOVE-MIB');
|
||||||
|
|
||||||
$required = array(
|
$required = array(
|
||||||
'ifAlias' => 'eth'.$infineratype.'gAliasName',
|
'ifAlias' => $infineratype.'AliasName',
|
||||||
'ifAdminStatus' => 'eth'.$infineratype.'gAdminStatus',
|
'ifAdminStatus' => $infineratype.'AdminStatus',
|
||||||
'ifOperStatus' => 'eth'.$infineratype.'gOperStatus',
|
'ifOperStatus' => $infineratype.'OperStatus',
|
||||||
'ifType' => 'Ethernet',
|
'ifType' => 'Ethernet',
|
||||||
'ifHCInBroadcastPkts' => 'eth'.$infineratype.'gStatisticsEntryInBroadcastPackets',
|
'ifHCInBroadcastPkts' => $infineratype.'StatisticsEntryInBroadcastPackets',
|
||||||
'ifHCInMulticastPkts' => 'eth'.$infineratype.'gStatisticsEntryInMulticastPackets',
|
'ifHCInMulticastPkts' => $infineratype.'StatisticsEntryInMulticastPackets',
|
||||||
'ifHCInOctets' => 'eth'.$infineratype.'gStatisticsEntryInOctets',
|
'ifHCInOctets' => $infineratype.'StatisticsEntryInOctets',
|
||||||
'ifHCInUcastPkts' => 'eth'.$infineratype.'gStatisticsEntryInPackets',
|
'ifHCInUcastPkts' => $infineratype.'StatisticsEntryInPackets',
|
||||||
'ifHCOutBroadcastPkts' => 'eth'.$infineratype.'gStatisticsEntryOutBroadcastPackets',
|
'ifHCOutBroadcastPkts' => $infineratype.'StatisticsEntryOutBroadcastPackets',
|
||||||
'ifHCOutMulticastPkts' => 'eth'.$infineratype.'gStatisticsEntryOutMulticastPackets',
|
'ifHCOutMulticastPkts' => $infineratype.'StatisticsEntryOutMulticastPackets',
|
||||||
'ifHCOutOctets' => 'eth'.$infineratype.'gStatisticsEntryOutOctets',
|
'ifHCOutOctets' => $infineratype.'StatisticsEntryOutOctets',
|
||||||
'ifHCOutUcastPkts' => 'eth'.$infineratype.'gStatisticsEntryOutPackets',
|
'ifHCOutUcastPkts' => $infineratype.'StatisticsEntryOutPackets',
|
||||||
'ifHighSpeed' => $infineratype*1000,
|
'ifHighSpeed' => $infspeed * 1000,
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($cg_stats as $index => $tmp_stats) {
|
foreach ($cg_stats as $index => $tmp_stats) {
|
||||||
$indexids = explode('.', $index);
|
$indexids = explode('.', $index);
|
||||||
|
|
||||||
if (!isset($cg_stats[$index]['eth'.$infineratype.'gAdminStatus'])) {
|
if (!isset($cg_stats[$index][$infineratype.'AdminStatus'])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 100g ports use shelfId, slotId, portId
|
// The CLI port name is not available in SNMP
|
||||||
// 40g and 10g ports use shelfId, slotId, portId, subportId
|
$descr = ( strpos($infineratype, 'eth') === false ) ? $infineratype : $infspeed.'gbe';
|
||||||
$descr = $infineratype.'gbe-'.$indexids[0].'/'.$indexids[1].'/'.$indexids[3];
|
|
||||||
if ($infineratype != 100) {
|
// 100g and 40g ports use shelfId, slotId, portId
|
||||||
$descr .= '/'.$indexids[4];
|
// 10g, fc16g and fc8g ports append the subportId with '.'
|
||||||
|
$descr .= '-'.$indexids[0].'/'.$indexids[1].'/'.$indexids[3];
|
||||||
|
|
||||||
|
if ($infspeed < 40) {
|
||||||
|
$descr .= '.'.$indexids[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
// librenms expects the index to be bigint(20) => we grab 3 decimal
|
// librenms expects the index to be bigint(20) => we grab 3 decimal
|
||||||
@@ -78,7 +83,7 @@ foreach (array ('100', '40', '10') as $infineratype) {
|
|||||||
|
|
||||||
foreach ($required as $normaloid => $infineraoid) {
|
foreach ($required as $normaloid => $infineraoid) {
|
||||||
// this is a bit hacky
|
// this is a bit hacky
|
||||||
if (preg_match('/^eth/', $required[$normaloid])) {
|
if (preg_match('/^(eth|fc)\d+/i', $required[$normaloid])) {
|
||||||
$port_stats[$lindex][$normaloid] = $cg_stats[$index][$infineraoid];
|
$port_stats[$lindex][$normaloid] = $cg_stats[$index][$infineraoid];
|
||||||
} else {
|
} else {
|
||||||
$port_stats[$lindex][$normaloid] = $required[$normaloid];
|
$port_stats[$lindex][$normaloid] = $required[$normaloid];
|
||||||
|
@@ -595,4 +595,7 @@
|
|||||||
1.3.6.1.4.1.42229.1.2.4.1.35.1.1.38.1.1.0.4.0|4|0
|
1.3.6.1.4.1.42229.1.2.4.1.35.1.1.38.1.1.0.4.0|4|0
|
||||||
1.3.6.1.4.1.42229.1.2.4.1.35.1.1.38.1.1.0.5.0|4|2380132734405
|
1.3.6.1.4.1.42229.1.2.4.1.35.1.1.38.1.1.0.5.0|4|2380132734405
|
||||||
1.3.6.1.4.1.42229.1.2.4.1.35.1.1.38.1.1.0.6.0|4|185727261573
|
1.3.6.1.4.1.42229.1.2.4.1.35.1.1.38.1.1.0.6.0|4|185727261573
|
||||||
|
1.3.6.1.4.1.42229.1.2.9.2.1.1.2.1|2|1
|
||||||
|
1.3.6.1.4.1.42229.1.2.9.2.1.1.2.2|2|2
|
||||||
1.3.6.1.4.1.42229.1.2.9.2.1.1.3.1|4|FP3.0.3
|
1.3.6.1.4.1.42229.1.2.9.2.1.1.3.1|4|FP3.0.3
|
||||||
|
1.3.6.1.4.1.42229.1.2.9.2.1.1.3.2|4|FP3.0.1
|
||||||
|
Reference in New Issue
Block a user