Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Infinera-Coriant Groove #9843

Merged
merged 2 commits into from Mar 4, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Binary file not shown.
Binary file not shown.
@@ -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
@@ -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
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
@@ -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";
@@ -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);
}
}
@@ -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);
}
}
@@ -0,0 +1,35 @@
<?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 'CORIANT-GROOVE-MIB: ';
// CORIANT-GROOVE-MIB::neType.0
$hardware = snmp_get($device, '.1.3.6.1.4.1.42229.1.2.2.1.3.0', '-OQv', '+CORIANT-GROOVE-MIB', 'infinera-groove');
// CORIANT-GROOVE-MIB::softwareloadSwloadVersion.1
$version = snmp_get($device, '.1.3.6.1.4.1.42229.1.2.9.2.1.1.3.1', '-OQv', '+CORIANT-GROOVE-MIB', 'infinera-groove');

This comment has been minimized.

Copy link
@TheGreatDoc

TheGreatDoc Mar 4, 2019

Contributor

Can you move this to a snmp_get_multi?

// CORIANT-GROOVE-MIB::inventoryManufacturerNumber.shelf.1.0.0.0
$serial = snmp_get($device, '.1.3.6.1.4.1.42229.1.2.3.12.1.1.16.1.1.0.0.0', '-OQv', '+CORIANT-GROOVE-MIB', 'infinera-groove');
@@ -312,6 +312,10 @@
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']]);
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.