mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Add support for Nokia ISAM (#9793)
* add mibs,first commit * adds support for Nokia ISAM Plattform * remove some comments * change os polling to multi oid * Restore file headers * Fix discovery by sysObjectID * first deactivate checks against IHUB (timos), It not necessary so long we can not provide more thatn one snmp community per device * move snmp state and temperature from pre-cache * Update os_schema.json
This commit is contained in:
23
includes/definitions/discovery/nokia-isam.yaml
Normal file
23
includes/definitions/discovery/nokia-isam.yaml
Normal file
@@ -0,0 +1,23 @@
|
||||
mib: ASAM-SYSTEM-MIB:ASAM-EQUIP-MIB
|
||||
modules :
|
||||
processors:
|
||||
data:
|
||||
-
|
||||
oid: cpu
|
||||
value: cpuLoadAverage
|
||||
num_oid: '.1.3.6.1.4.1.637.61.1.9.29.1.1.4.{{ $index }}'
|
||||
descr: CPU {{ $index }}
|
||||
|
||||
sensors:
|
||||
state:
|
||||
data:
|
||||
-
|
||||
oid: eqptFanMode
|
||||
num_oid: .1.3.6.1.4.1.637.61.1.23.1.9.0
|
||||
descr: Fan Mode
|
||||
state_name: fanMode
|
||||
states:
|
||||
- { value: 0, generic: 0, graph: 0, descr: default }
|
||||
- { value: 1, generic: 1, graph: 0, descr: eco }
|
||||
- { value: 2, generic: 0, graph: 0, descr: protect }
|
||||
- { value: 3, generic: 0, graph: 0, descr: classic }
|
24
includes/definitions/nokia-isam.yaml
Normal file
24
includes/definitions/nokia-isam.yaml
Normal file
@@ -0,0 +1,24 @@
|
||||
os: nokia-isam
|
||||
text: 'NOKIA ISAM'
|
||||
type: network
|
||||
icon: nokia
|
||||
group: nokia
|
||||
bad_ifXEntry:
|
||||
- NFXS-E
|
||||
over:
|
||||
- { graph: device_bits, text: 'Device Traffic' }
|
||||
- { graph: device_processor, text: 'CPU Usage' }
|
||||
- { graph: device_mempool, text: 'Memory Usage' }
|
||||
discovery:
|
||||
-
|
||||
sysObjectID:
|
||||
- .1.3.6.1.4.1.637.61
|
||||
mib_dir:
|
||||
- nokia
|
||||
bad_iftype:
|
||||
- aluGponOnu
|
||||
- bridge
|
||||
- ieee8023adLag
|
||||
- l2vlan
|
||||
- slip
|
||||
- softwareLoopback
|
45
includes/discovery/mempools/nokia-isam.inc.php
Normal file
45
includes/discovery/mempools/nokia-isam.inc.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* LibreNMS Nokia ISAM RAM discovery module
|
||||
*
|
||||
* 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. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if ($device['os'] == 'nokia-isam') {
|
||||
echo 'Nokia ISAM Memory: ';
|
||||
|
||||
$slotTable = [
|
||||
'4352' => 'acu:1/1/',
|
||||
'4353' => 'nt-a:',
|
||||
'4354' => 'nt-b:',
|
||||
'4355' => 'lt:1/1/1/',
|
||||
'4356' => 'lt:1/1/2/',
|
||||
'4357' => 'lt:1/1/3/',
|
||||
'4358' => 'lt:1/1/4/',
|
||||
'4359' => 'lt:1/1/5/',
|
||||
'4360' => 'lt:1/1/6/',
|
||||
'4361' => 'lt:1/1/7/',
|
||||
'4362' => 'lt:1/1/8/',
|
||||
'4481' => '4481' // FIXME define this
|
||||
];
|
||||
|
||||
$array = snmpwalk_cache_multi_oid($device, 'mem', null, 'ASAM-SYSTEM-MIB');
|
||||
|
||||
if (is_array($array)) {
|
||||
foreach ($array as $index => $entry) {
|
||||
if (is_numeric($entry['memAbsoluteUsage']) && is_numeric($entry['totalMemSize'])) {
|
||||
list($entPhysicalIndex) = explode('.', $index);
|
||||
$entPhysicalName = $entPhysicalIndex;
|
||||
|
||||
$descr = $slotTable[$index].' Memory ('.$index.')';
|
||||
|
||||
discover_mempool($valid_mempool, $device, $index, 'nokia-isam', $descr, '1', $entPhysicalIndex, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
30
includes/discovery/sensors/dbm/nokia-isam.inc.php
Normal file
30
includes/discovery/sensors/dbm/nokia-isam.inc.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
$multiplier = 1;
|
||||
$divisor = 1;
|
||||
foreach ($pre_cache['nokiaIsamSfpPort'] as $slotId => $slot) {
|
||||
$slotName = $pre_cache['nokiaIsamSlot'][$slotId]['numBasedSlot'];
|
||||
foreach ($slot as $portId => $port) {
|
||||
$portName = $slotName.$port['numBasedPort'];
|
||||
if (is_numeric($port['sfpDiagRxPower'])) {
|
||||
$oid = '.1.3.6.1.4.1.637.61.1.56.5.1.7.'.$slotId.'.'.$portId;
|
||||
$descr = $portName.' Rx Power';
|
||||
$limit_low = ($port['sfpDiagRSSIRxPowerAlmLow']/$divisor) ?: -22;
|
||||
$warn_limit_low = ($port['sfpDiagRSSIRxPowerWarnLow']/$divisor) ?: -20;
|
||||
$limit = ($port['sfpDiagRSSIRxPowerAlmHigh']/$divisor) ?: -3;
|
||||
$warn_limit = ($port['sfpDiagRSSIRxPowerWarnHigh']/$divisor) ?: -5;
|
||||
$value = $port['sfpDiagRxPower']/$divisor;
|
||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, $portName.'-rx', 'nokia-isam', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $value, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||
}
|
||||
if (is_numeric($port['sfpDiagTxPower'])) {
|
||||
$oid = '.1.3.6.1.4.1.637.61.1.56.5.1.6.'.$slotId.'.'.$portId;
|
||||
$descr = $portName.' Tx Power';
|
||||
$limit_low = ($port['sfpDiagRSSITxPowerAlmLow']/$divisor) ?: -9;
|
||||
$warn_limit_low = ($port['sfpDiagRSSITxPowerWarnLow']/$divisor) ?: -8;
|
||||
$limit = ($port['sfpDiagRSSITxPowerAlmHigh']/$divisor) ?: -3;
|
||||
$warn_limit = ($port['sfpDiagRSSITxPowerWarnHigh']/$divisor) ?: -4;
|
||||
$value = $port['sfpDiagTxPower']/$divisor;
|
||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, $portName.'-tx', 'nokia-isam', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $value, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||
}
|
||||
}
|
||||
}
|
68
includes/discovery/sensors/pre-cache/nokia-isam.inc.php
Normal file
68
includes/discovery/sensors/pre-cache/nokia-isam.inc.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
echo 'ISAM Slot/Port Mapping ';
|
||||
// Slot mapping
|
||||
// FIXME Hardcoded to Num Based Slot Numbering. This should be pulled from SNMP
|
||||
$slotTable = [
|
||||
'4352' => 'acu:1/1/',
|
||||
'4353' => 'nt-a:',
|
||||
'4354' => 'nt-b:',
|
||||
'4355' => 'lt:1/1/1/',
|
||||
'4356' => 'lt:1/1/2/',
|
||||
'4357' => 'lt:1/1/3/',
|
||||
'4358' => 'lt:1/1/4/',
|
||||
'4359' => 'lt:1/1/5/',
|
||||
'4360' => 'lt:1/1/6/',
|
||||
'4361' => 'lt:1/1/7/',
|
||||
'4362' => 'lt:1/1/8/',
|
||||
'4481' => '4481' // FIXME define this
|
||||
];
|
||||
$pre_cache['nokiaIsamSlot'] = snmpwalk_cache_multi_oid($device, 'eqptBoardContainerOffset', [], 'ASAM-EQUIP-MIB', 'nokia');
|
||||
$pre_cache['nokiaIsamSlot'] = snmpwalk_cache_multi_oid($device, 'eqptBoardIfSlotId', $pre_cache['nokiaIsamSlot'], 'ASAM-EQUIP-MIB', 'nokia');
|
||||
foreach ($pre_cache['nokiaIsamSlot'] as $slotId => $slot) {
|
||||
$pre_cache['nokiaIsamSlot'][$slotId]['numBasedSlot'] = $slotTable[$slotId];
|
||||
}
|
||||
|
||||
// Port mapping
|
||||
// FIXME Hardcoded Port Numbering for FANT-F NT Card.
|
||||
$portTable = [
|
||||
'257' => 'xfp:1',
|
||||
'258' => 'xfp:2',
|
||||
'259' => 'xfp:3',
|
||||
'260' => 'xfp:4'
|
||||
];
|
||||
|
||||
// dbm pre cache
|
||||
$pre_cache['nokiaIsamSfpPort'] = snmpwalk_cache_twopart_oid($device, 'sfpDiagAvailable', [], 'SFP-MIB', 'nokia');
|
||||
foreach ($pre_cache['nokiaIsamSfpPort'] as $slotId => $slot) {
|
||||
foreach ($slot as $portId => $port) {
|
||||
if ($portTable[$portId]) {
|
||||
$pre_cache['nokiaIsamSfpPort'][$slotId][$portId]['numBasedPort'] = $portTable[$portId];
|
||||
} else {
|
||||
$pre_cache['nokiaIsamSfpPort'][$slotId][$portId]['numBasedPort'] = $portId;
|
||||
}
|
||||
$oId = '.'.$slotId.'.'.$portId;
|
||||
$oIds = [
|
||||
'sfpDiagRxPower'.$oId,
|
||||
'sfpDiagTxPower'.$oId,
|
||||
'sfpDiagRSSIRxPowerAlmLow'.$oId,
|
||||
'sfpDiagRSSIRxPowerAlmHigh'.$oId,
|
||||
'sfpDiagRSSIRxPowerWarnLow'.$oId,
|
||||
'sfpDiagRSSIRxPowerWarnHigh'.$oId,
|
||||
'sfpDiagRSSITxPowerAlmLow'.$oId,
|
||||
'sfpDiagRSSITxPowerAlmHigh'.$oId,
|
||||
'sfpDiagRSSITxPowerWarnLow'.$oId,
|
||||
'sfpDiagRSSITxPowerWarnHigh'.$oId
|
||||
];
|
||||
if ($port['sfpDiagAvailable'] == 'noError') {
|
||||
$twopart_value = snmp_get_multi($device, $oIds, '-OQUs', 'SFP-MIB', 'nokia', []);
|
||||
foreach ($twopart_value[$slotId.'.'.$portId] as $index => $value) {
|
||||
$value = str_replace(' dBm', '', $value);
|
||||
if (is_numeric($value)) {
|
||||
$pre_cache['nokiaIsamSfpPort'][$slotId][$portId][$index] = $value;
|
||||
}
|
||||
}
|
||||
unset($twopart_value);
|
||||
}
|
||||
}
|
||||
}
|
60
includes/discovery/sensors/state/nokia-isam.inc.php
Normal file
60
includes/discovery/sensors/state/nokia-isam.inc.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
$snmp_data['nokiaIsamEqpBoardTable'] = snmpwalk_cache_oid($device, 'eqptBoardTable', [], 'ASAM-EQUIP-MIB', 'nokia', '-OQUse');
|
||||
|
||||
foreach ($snmp_data['nokiaIsamEqpBoardTable'] as $index => $data) {
|
||||
if (is_array($data)) {
|
||||
$oid = '.1.3.6.1.4.1.637.61.1.23.3.1.7.' . $index;
|
||||
$state_name = 'eqptBoardOperError';
|
||||
$state_index_id = create_state_index($state_name);
|
||||
$current = $data['eqptBoardOperError'];
|
||||
$descr = $pre_cache['nokiaIsamSlot'][$index]['numBasedSlot'] . ' ' . $data['eqptSlotActualType'] . ' (' . $data['eqptSlotPlannedType'] . ')';
|
||||
|
||||
//Create State Translation
|
||||
if ($state_index_id !== null) {
|
||||
$states = [
|
||||
[ 1, 0, 0, $state_index_id, 'no-error' ],
|
||||
[ 2, 1, 0, $state_index_id, 'type-mismatch' ],
|
||||
[ 3, 2, 0, $state_index_id, 'board-missing' ],
|
||||
[ 4, 2, 0, $state_index_id, 'board-installation-missing' ],
|
||||
[ 5, 1, 0, $state_index_id, 'no-planned-board' ],
|
||||
[ 6, 1, 0, $state_index_id, 'waiting-for-sw' ],
|
||||
[ 7, 2, 0, $state_index_id, 'init-boot-failed' ],
|
||||
[ 8, 2, 0, $state_index_id, 'init-download-failed' ],
|
||||
[ 9, 2, 0, $state_index_id, 'init-connection-failed' ],
|
||||
[ 10, 2, 0, $state_index_id, 'init-configuration-failed' ],
|
||||
[ 11, 1, 0, $state_index_id, 'board-reset-protection' ],
|
||||
[ 12, 2, 0, $state_index_id, 'invalid-parameter' ],
|
||||
[ 13, 1, 0, $state_index_id, 'temperature-alarm' ],
|
||||
[ 14, 2, 0, $state_index_id, 'tempshutdown' ],
|
||||
[ 15, 1, 0, $state_index_id, 'defense' ],
|
||||
[ 16, 1, 0, $state_index_id, 'board-not-licensed' ],
|
||||
[ 17, 2, 0, $state_index_id, 'sem-power-fail' ],
|
||||
[ 18, 2, 0, $state_index_id, 'sem-ups-fail' ],
|
||||
[ 19, 2, 0, $state_index_id, 'board-in-incompatible-slot' ],
|
||||
[ 21, 1, 0, $state_index_id, 'download-ongoing' ],
|
||||
[ 255, 2, 0, $state_index_id, 'unknown-error' ],
|
||||
];
|
||||
foreach ($states as $value) {
|
||||
$insert = [
|
||||
'state_value' => $value[0],
|
||||
'state_generic_value' => $value[1],
|
||||
'state_draw_graph' => $value[2],
|
||||
'state_index_id' => $value[3],
|
||||
'state_descr' => $value[4],
|
||||
];
|
||||
dbInsert($insert, 'state_translations');
|
||||
}
|
||||
}
|
||||
|
||||
//Discover Sensors
|
||||
discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $descr, '1', '1', null, null, null, null, $current);
|
||||
//Create Sensor To State Index
|
||||
create_sensor_to_state_index($device, $state_name, $index);
|
||||
}
|
||||
}
|
||||
|
||||
unset(
|
||||
$index,
|
||||
$data
|
||||
);
|
19
includes/discovery/sensors/temperature/nokia-isam.inc.php
Normal file
19
includes/discovery/sensors/temperature/nokia-isam.inc.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
$snmp_data['nokiaIsamSlotTemperature'] = snmpwalk_cache_twopart_oid($device, 'eqptBoardThermalSensorTable', [], 'ASAM-EQUIP-MIB', 'nokia');
|
||||
|
||||
$multiplier = 1;
|
||||
$divisor = 1;
|
||||
foreach ($snmp_data['nokiaIsamSlotTemperature'] as $slotId => $slot) {
|
||||
$slotName = $pre_cache['nokiaIsamSlot'][$slotId]['numBasedSlot'];
|
||||
foreach ($slot as $sensorId => $sensor) {
|
||||
if (is_numeric($sensor['eqptBoardThermalSensorActualTemperature'])) {
|
||||
$oid = '.1.3.6.1.4.1.637.61.1.23.10.1.2.'.$slotId.'.'.$sensorId;
|
||||
$descr = $slotName.' Sensor '.$sensorId;
|
||||
$limit = $sensor['eqptBoardThermalSensorShutdownThresholdHigh']/$divisor;
|
||||
$warn_limit = $sensor['eqptBoardThermalSensorTcaThresholdHigh']/$divisor;
|
||||
$value = $sensor['eqptBoardThermalSensorActualTemperature']/$divisor;
|
||||
discover_sensor($valid['sensor'], 'temperature', $device, $oid, $slotName.'.'.$sensorId.'-temp', 'nokia-isam', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $value, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||
}
|
||||
}
|
||||
}
|
23
includes/polling/mempools/nokia-isam.inc.php
Normal file
23
includes/polling/mempools/nokia-isam.inc.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* LibreNMS NOKIA ISAM RAM polling module
|
||||
*
|
||||
* 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. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
echo 'Nokia ISAM Memory: ';
|
||||
|
||||
$oid = $mempool['mempool_index'];
|
||||
|
||||
$oids = array(
|
||||
"memAbsoluteUsage.$oid",
|
||||
"totalMemSize.$oid",
|
||||
);
|
||||
$data = snmp_get_multi_oid($device, $oids, '-OUQ', 'ASAM-SYSTEM-MIB');
|
||||
|
||||
list($mempool['used'], $mempool['total']) = array_values($data);
|
||||
$mempool['free'] = ($mempool['total'] + $mempool['used']);
|
8
includes/polling/os/nokia-isam.inc.php
Normal file
8
includes/polling/os/nokia-isam.inc.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
$oids = ['eqptHolderActualType.17', 'eqptHolderSerialNumber.17', 'swEtsiVersion.0'];
|
||||
$snmp = snmp_get_multi($device, $oids, '-OQUs', 'ASAM-EQUIP-MIB:ASAM-SYSTEM-MIB');
|
||||
|
||||
$hardware = $snmp[17]['eqptHolderActualType'];
|
||||
$serial = $snmp[17]['eqptHolderSerialNumber'];
|
||||
$version = $snmp[0]['swEtsiVersion'];
|
@@ -304,6 +304,10 @@ if ($device['os'] == 'cmm') {
|
||||
require_once 'ports/cmm.inc.php';
|
||||
}
|
||||
|
||||
if ($device['os'] == 'nokia-isam') {
|
||||
require_once 'ports/nokia-isam.inc.php';
|
||||
}
|
||||
|
||||
if ($device['os'] == 'timos') {
|
||||
require_once 'ports/timos.inc.php';
|
||||
}
|
||||
|
30
includes/polling/ports/nokia-isam.inc.php
Normal file
30
includes/polling/ports/nokia-isam.inc.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* nokia-isam.inc.php
|
||||
*
|
||||
* 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 Vitali Kari
|
||||
* @author Vitali Kari <vitali.kari@gmail.com>
|
||||
*/
|
||||
|
||||
// Use proprietary asamIfExtCustomerId as ifAlias for Nokia ISAM Plattform. The default IF-MIB fields are here quite meaningless
|
||||
$isam_port_stats = snmpwalk_cache_oid($device, 'asamIfExtCustomerId', [], 'ITF-MIB-EXT', 'nokia-isam');
|
||||
|
||||
foreach ($isam_port_stats as $index => $value) {
|
||||
$port_stats[$index]['ifAlias'] = $isam_port_stats[$index]['asamIfExtCustomerId'];
|
||||
}
|
||||
unset($isam_ports_stats);
|
Reference in New Issue
Block a user