Add support for Infinera-Coriant Groove (#9843)

* Add support for Infinera Groove
This commit is contained in:
Nick Hilliard
2019-03-04 16:31:53 +00:00
committed by TheGreatDoc
parent 411f36a9a1
commit 09caced7ef
16 changed files with 22336 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
mib: CORIANT-GROOVE-MIB
modules:
sensors:
pre-cache:
data:
- oid:
- portId
power:
data:
-
oid: shelfTable
descr: 'Chassis Power Consumption'
value: systemPowerConsumptionCurrent
num_oid: '.1.3.6.1.4.1.42229.1.2.2.2.2.{{ $index }}'
temperature:
data:
-
oid: shelfTable
descr: 'Chassis Inlet'
value: shelfInletTemperature
num_oid: '.1.3.6.1.4.1.42229.1.2.3.1.1.1.3.{{ $index }}'
index: 'shelfInletTemperature.{{ $index }}'
skip_values: -99
-
oid: shelfTable
descr: 'Chassis Outlet'
value: shelfOutletTemperature
num_oid: '.1.3.6.1.4.1.42229.1.2.3.1.1.1.4.{{ $index }}'
index: 'shelfOutletTemperature.{{ $index }}'
skip_values: -99

View File

@@ -0,0 +1,52 @@
os: infinera-groove
text: 'Infinera Groove'
type: network
icon: infinera
mib_dir:
- infinera
discovery_modules:
ntp: false
ospf: false
stp: false
ucd-diskio: false
ucd-mib: false
ipmi: false
bgp-peers: false
services: false
vlans: false
arp-table: false
mef: false
cisco-vrf-lite: false
storage: false
fdb-table: false
wireless: false
discovery-protocols: false
hr-device: false
ipv4-addresses: false
ipv6-addresses: false
processors: false
mempools: false
ports-stack: false
ports: true
poller_modules:
ntp: false
ospf: false
stp: false
ucd-diskio: false
ucd-mib: false
ipmi: false
bgp-peers: false
services: false
libvirt-vminfo: false
vmware-vminfo: false
vlans: false
arp-table: false
mef: false
cisco-vrf-lite: false
storage: false
over:
- { graph: device_bits, text: 'Device Traffic' }
- { graph: device_temperature, text: 'Device Temperature' }
discovery:
- sysObjectID:
- .1.3.6.1.4.1.42229.1.2

View File

@@ -0,0 +1,33 @@
<?php
/**
* infinera-groove.inc.php
*
* LibreNMS chromatic_dispersion discovery module for Infinera Groove
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2019 Nick Hilliard
* @author Nick Hilliard <nick@foobar.org>
*/
foreach ($pre_cache['infineragroove_portTable'] as $index => $data) {
if (is_numeric($data['ochOsCD']) && $data['ochOsCD'] != -99) {
$descr = $data['portAlias'].' CD';
$oid = '.1.3.6.1.4.1.42229.1.2.4.1.19.1.1.23.' . $index;
$value = $data['ochOsCD'];
discover_sensor($valid['sensor'], 'chromatic_dispersion', $device, $oid, 'ochOsCD.'.$index, 'infinera-groove', $descr, null, '1', null, null, null, null, $value);
}
}

View File

@@ -0,0 +1,33 @@
<?php
/**
* infinera-groove.inc.php
*
* LibreNMS dbm discovery module for Infinera Groove
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2019 Nick Hilliard
* @author Nick Hilliard <nick@foobar.org>
*/
foreach ($pre_cache['infineragroove_portTable'] as $index => $data) {
if (is_numeric($data['portRxOpticalPower']) && $data['portRxOpticalPower'] != -99) {
$descr = $data['portAlias'].' Receive Power';
$oid = '.1.3.6.1.4.1.42229.1.2.3.6.1.1.4.' . $index;
$value = $data['portRxOpticalPower'];
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'portRxOpticalPower.'.$index, 'infinera-groove', $descr, null, '1', null, null, null, null, $value);
}
}

View File

@@ -0,0 +1,36 @@
<?php
/**
* infinera-groove.inc.php
*
* LibreNMS fanspeed discovery module for Infinera Groove
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2019 Nick Hilliard
* @author Nick Hilliard <nick@foobar.org>
*/
foreach ($pre_cache['infineragroove_slotTable'] as $index => $data) {
if (is_numeric($data['cardFanSpeedRate']) && $data['cardFanSpeedRate'] != -99) {
$infinera_slot = 'slot-'.str_replace('.', '/', $index);
$descr = 'Chassis fan '.$infinera_slot;
$oid = '.1.3.6.1.4.1.42229.1.2.3.3.1.1.7.' . $index;
$value = $data['cardFanSpeedRate'];
discover_sensor($valid['sensor'], 'load', $device, $oid, 'cardFanSpeedRate.'.$index, 'infinera-groove', $descr, null, '1', 0, 20, 80, 100, $value);
}
}
unset($infinera_slot);

View File

@@ -0,0 +1,56 @@
<?php
/**
* infinera-groove.inc.php
*
* LibreNMS sensor pre-cache module for Infinera Groove
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2019 Nick Hilliard
* @author Nick Hilliard <nick@foobar.org>
*/
if (!is_array($pre_cache['infineragroove_portTable'])) {
echo 'Caching OIDs:';
$pre_cache['infineragroove_portTable'] = array();
echo ' portTable';
$pre_cache['infineragroove_portTable'] = snmpwalk_cache_multi_oid($device, 'portTable', $pre_cache['infineragroove_portTable'], 'CORIANT-GROOVE-MIB');
echo ' OchOsTable';
$pre_cache['infineragroove_portTable'] = snmpwalk_cache_multi_oid($device, 'OchOsTable', $pre_cache['infineragroove_portTable'], 'CORIANT-GROOVE-MIB');
}
foreach (array_keys($pre_cache['infineragroove_portTable']) as $index) {
$indexids = explode('.', $index);
if (isset($pre_cache['infineragroove_portTable'][$index]['ochOsAdminStatus'])) {
$pre_cache['infineragroove_portTable'][$index]['portAlias'] = 'och-os-';
} else {
$pre_cache['infineragroove_portTable'][$index]['portAlias'] = 'port-';
}
$pre_cache['infineragroove_portTable'][$index]['portAlias'] .= $indexids[0].'/'.$indexids[1].'/'.$indexids[3];
unset($indexids);
}
if (!is_array($pre_cache['infineragroove_slotTable'])) {
$pre_cache['infineragroove_slotTable'] = array();
echo ' slotTable';
$pre_cache['infineragroove_slotTable'] = snmpwalk_cache_multi_oid($device, 'slotTable', $pre_cache['infineragroove_slotTable'], 'CORIANT-GROOVE-MIB');
echo ' cardTable';
$pre_cache['infineragroove_slotTable'] = snmpwalk_cache_multi_oid($device, 'cardTable', $pre_cache['infineragroove_slotTable'], 'CORIANT-GROOVE-MIB');
}
echo "\n";

View File

@@ -0,0 +1,33 @@
<?php
/**
* infinera-groove.inc.php
*
* LibreNMS snr discovery module for Infinera Groove
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2019 Nick Hilliard
* @author Nick Hilliard <nick@foobar.org>
*/
foreach ($pre_cache['infineragroove_portTable'] as $index => $data) {
if (is_numeric($data['ochOsOSNR']) && $data['ochOsOSNR'] != -99) {
$descr = $data['portAlias'].' Optical SNR';
$oid = '.1.3.6.1.4.1.42229.1.2.4.1.19.1.1.24.' . $index;
$value = $data['ochOsOSNR'];
discover_sensor($valid['sensor'], 'snr', $device, $oid, 'ochOsOSNR.'.$index, 'infinera-groove', $descr, null, '1', null, null, null, null, $value);
}
}

View File

@@ -0,0 +1,46 @@
<?php
/**
* infinera-groove.inc.php
*
* LibreNMS state discovery module for Infinera Groove
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2019 Nick Hilliard
* @author Nick Hilliard <nick@foobar.org>
*/
// create state index
$state_name = 'cardMode';
$states = array(
array('value' => 0, 'generic' => 3, 'graph' => 0, 'descr' => 'notapplicable'),
array('value' => 1, 'generic' => 0, 'graph' => 0, 'descr' => 'normal'),
array('value' => 2, 'generic' => 1, 'graph' => 0, 'descr' => 'regen'),
);
create_state_index($state_name, $states);
$num_oid = '.1.3.6.1.4.1.42229.1.2.3.3.1.1.10.';
foreach ($pre_cache['infineragroove_slotTable'] as $index => $data) {
if (is_array($data) && isset($data['cardMode'])) {
// discover sensors
$descr = 'slot-'.str_replace('.', '/', $index).' ('.$data['slotActualCardType'].')';
discover_sensor($valid['sensor'], 'state', $device, $num_oid.$index, $index, $state_name, $descr, '1', '1', null, null, null, null, $data['cardMode'], 'snmp', $index);
// create sensor to state index
create_sensor_to_state_index($device, $state_name, $index);
}
}

View File

@@ -0,0 +1,38 @@
<?php
/**
* infinera-groove.inc.php
*
* LibreNMS os poller module for Infinera Groove
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2019 Nick Hilliard
* @author Nick Hilliard <nick@foobar.org>
*/
echo 'infinera-groove: ';
$oid_list = [
'neType.0',
'softwareloadSwloadVersion.1',
'inventoryManufacturerNumber.shelf.1.0.0.0',
];
$data = snmp_get_multi($device, $oid_list, '-OUQs', 'CORIANT-GROOVE-MIB');
$version = $data[1]['softwareloadSwloadVersion'];
$hardware = $data[0]['neType'];
$serial = $data['shelf.1.0.0.0']['inventoryManufacturerNumber'];

View File

@@ -312,6 +312,10 @@ if ($device['os'] == 'timos') {
require_once 'ports/timos.inc.php';
}
if ($device['os'] == 'infinera-groove') {
require_once 'ports/infinera-groove.inc.php';
}
if ($config['enable_ports_adsl']) {
$device['xdsl_count'] = dbFetchCell("SELECT COUNT(*) FROM `ports` WHERE `device_id` = ? AND `ifType` in ('adsl','vdsl')", [$device['device_id']]);
}

View File

@@ -0,0 +1,88 @@
<?php
/**
* infinera-groove.inc.php
*
* LibreNMS ports poller module for Infinera Groove
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2019 Nick Hilliard
* @author Nick Hilliard <nick@foobar.org>
*/
echo 'Port types:';
foreach (array ('100', '40', '10') as $infineratype) {
if (!is_array($cg_stats)) {
echo ' eth'.$infineratype.'g';
$cg_stats = snmpwalk_cache_multi_oid($device, 'eth'.$infineratype.'gEntry', $cg_stats, 'CORIANT-GROOVE-MIB');
$cg_stats = snmpwalk_cache_multi_oid($device, 'eth'.$infineratype.'gStatistics', $cg_stats, 'CORIANT-GROOVE-MIB');
}
$required = array(
'ifAlias' => 'eth'.$infineratype.'gAliasName',
'ifAdminStatus' => 'eth'.$infineratype.'gAdminStatus',
'ifOperStatus' => 'eth'.$infineratype.'gOperStatus',
'ifType' => 'Ethernet',
'ifHCInBroadcastPkts' => 'eth'.$infineratype.'gStatisticsEntryInBroadcastPackets',
'ifHCInMulticastPkts' => 'eth'.$infineratype.'gStatisticsEntryInMulticastPackets',
'ifHCInOctets' => 'eth'.$infineratype.'gStatisticsEntryInOctets',
'ifHCInUcastPkts' => 'eth'.$infineratype.'gStatisticsEntryInPackets',
'ifHCOutBroadcastPkts' => 'eth'.$infineratype.'gStatisticsEntryOutBroadcastPackets',
'ifHCOutMulticastPkts' => 'eth'.$infineratype.'gStatisticsEntryOutMulticastPackets',
'ifHCOutOctets' => 'eth'.$infineratype.'gStatisticsEntryOutOctets',
'ifHCOutUcastPkts' => 'eth'.$infineratype.'gStatisticsEntryOutPackets',
'ifHighSpeed' => $infineratype*1000,
);
foreach ($cg_stats as $index => $tmp_stats) {
$indexids = explode('.', $index);
if (!isset($cg_stats[$index]['eth'.$infineratype.'gAdminStatus'])) {
continue;
}
// 100g ports use shelfId, slotId, portId
// 40g and 10g ports use shelfId, slotId, portId, subportId
$descr = $infineratype.'gbe-'.$indexids[0].'/'.$indexids[1].'/'.$indexids[3];
if ($infineratype != 100) {
$descr .= '/'.$indexids[4];
}
// librenms expects the index to be bigint(20) => we grab 3 decimal
// spaces per indexid to make a numeric ifindex. This is hacky.
$lindex = '';
for ($i = 0; $i <= 4; $i++) {
$lindex .= sprintf('%03d', $indexids[$i]);
}
// convert to integer
$lindex = $lindex + 0;
$port_stats[$lindex]['ifName'] = $descr;
$port_stats[$lindex]['ifDescr'] = $descr;
foreach ($required as $normaloid => $infineraoid) {
// this is a bit hacky
if (preg_match('/^eth/', $required[$normaloid])) {
$port_stats[$lindex][$normaloid] = $cg_stats[$index][$infineraoid];
} else {
$port_stats[$lindex][$normaloid] = $required[$normaloid];
}
}
}
}