mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Convert OS mrv-od to yaml, discover more sensors, discover entity-physical (#10266)
* Dynamic entPhysicalIndex values for YamlDiscovery
* Use degree symbol when displaying temperature values
* Adjust SNMP options for new snmp_get_multi()
The OS polling module for mrv-od was using snmpget commands with
-Ovqs, rather than -OQUs, which meant that the equal sign was
stripped in the snmpget output. But that equal sign is now used
as the explode() delimiter so it broke the construction of the
returned array for the snmp_get_multi() function.
Additionally, I removed the NBS-CMMC-MIB:: prefix which is no
longer returned by snmp_get_multi() as part of the OID. Now,
the mrv-od.inc.php OS polling module is retrieving data from
positions in the array with actual content.
* Convert mrv-od to yaml, improve sensors discovery
Converted sensors discovery for mrv-od to yaml, retaining all
functionality for pre-cache, dbm, and temperature. Replaced specific
SFF-8472 Digital Diagnostics state sensors with generic ones, given that
we are now reading out detailed values through new dbm, current, voltage
sensors.
Reasoning: the generic Digital Diagnostics state sensors report state
diagsOk, or else the worst severity level measured among all of the
Digital Diagnostics values for that optical data point. You'd really
only want to set a generic "alarm" so the box can report that it
thinks something is wrong, whereafter a human can look at the graphs
and/or the CLI to draw their conclusions about the alarm. Otherwise,
things would quickly become too spammy as you are essentially duplicating
every sensor across both regular measurements and state measurements.
Further changes:
- Increase maximum number of detected PSUs from 4 to 8 per the MIB.
- State sensor to detect (in)sufficient power budget for all modules.
- Use skip_values to hide state sensors with the notSupported value.
- Use skip_values to hide sensors which are unsupported per the MIB,
signified by the device returning special values -1 or -2147483648.
- Add dBm, temperature "over" graphs to the mrv-od device header bar.
* Add mrv-od entity-physical support
MRV does not use the ENTITY-MIB data format, so we had to reconstruct
the inventory from their proprietary format using the following tables
from their NBS-CMMC-MIB:
- nbsCmmcChassisTable
- nbsCmmcSlotTable
- nbsCmmcPortTable
Additionally, since sensors didn't have their own ifindex in the
NBS-CMMC-MIB, I went ahead and appended the last OID digit to
the "containing" ifindex create a unique number. The same was
done for the sensors in the yaml-discovery.
* Test data for mrv-od, fix 2* pre-commit.php issues
* Fix entPhysicalIndex returning 0 instead of null
Some unit test breakage was caused by 62167ebcb
which changed
the code to return 0 instead of null when {{ $index }} was
set as the entPhysicalIndex in the YamlDiscovery. So now we
detect if it returns some value which may be interpreted as
false, and if so we set null rather than 0.
This commit is contained in:
committed by
Tony Murray
parent
54e4d0910a
commit
9455a83478
292
includes/definitions/discovery/mrv-od.yaml
Normal file
292
includes/definitions/discovery/mrv-od.yaml
Normal file
@@ -0,0 +1,292 @@
|
||||
mib: NBS-CMMC-MIB
|
||||
modules:
|
||||
sensors:
|
||||
pre-cache:
|
||||
data:
|
||||
- oid:
|
||||
- nbsCmmcChassisTable
|
||||
- nbsCmmcSlotTable
|
||||
- nbsCmmcPortTable
|
||||
dbm:
|
||||
options:
|
||||
divisor: 1000
|
||||
skip_values: -2147483648
|
||||
data:
|
||||
-
|
||||
oid: nbsCmmcPortTable
|
||||
value: nbsCmmcPortRxPower
|
||||
num_oid: '.1.3.6.1.4.1.629.200.8.1.1.32.{{ $index }}'
|
||||
descr: 'Port {{ $index }} Rx Power'
|
||||
index: 'nbsCmmcPortRxPower.{{ $index }}'
|
||||
entPhysicalIndex: '{{ $nbsCmmcPortIfIndex }}32'
|
||||
-
|
||||
oid: nbsCmmcPortTable
|
||||
value: nbsCmmcPortTxPower
|
||||
num_oid: '.1.3.6.1.4.1.629.200.8.1.1.31.{{ $index }}'
|
||||
descr: 'Port {{ $index }} Tx Power'
|
||||
index: 'nbsCmmcPortTxPower.{{ $index }}'
|
||||
entPhysicalIndex: '{{ $nbsCmmcPortIfIndex }}31'
|
||||
current:
|
||||
options:
|
||||
divisor: 1000000
|
||||
skip_values: -1
|
||||
data:
|
||||
-
|
||||
oid: nbsCmmcPortTable
|
||||
value: nbsCmmcPortBiasAmps
|
||||
num_oid: '.1.3.6.1.4.1.629.200.8.1.1.33.{{ $index }}'
|
||||
descr: 'Port {{ $index }} Tx Bias Current'
|
||||
index: 'nbsCmmcPortBiasAmps.{{ $index }}'
|
||||
entPhysicalIndex: '{{ $nbsCmmcPortIfIndex }}33'
|
||||
voltage:
|
||||
options:
|
||||
divisor: 1000
|
||||
skip_values: -1
|
||||
data:
|
||||
-
|
||||
oid: nbsCmmcPortTable
|
||||
value: nbsCmmcPortSupplyVolts
|
||||
num_oid: '.1.3.6.1.4.1.629.200.8.1.1.34.{{ $index }}'
|
||||
descr: 'Port {{ $index }} Tx Supply Voltage'
|
||||
index: 'nbsCmmcPortSupplyVolts.{{ $index }}'
|
||||
entPhysicalIndex: '{{ $nbsCmmcPortIfIndex }}34'
|
||||
temperature:
|
||||
options:
|
||||
skip_values: -2147483648
|
||||
data:
|
||||
-
|
||||
oid: nbsCmmcChassisTable
|
||||
value: nbsCmmcChassisTemperature
|
||||
num_oid: '.1.3.6.1.4.1.629.200.6.1.1.15.{{ $index }}'
|
||||
low_limit: nbsCmmcChassisTemperatureMin
|
||||
high_limit: nbsCmmcChassisTemperatureLimit
|
||||
descr: 'Chassis {{ $index }} Temperature'
|
||||
index: 'nbsCmmcChassisTemperature.{{ $index }}'
|
||||
entPhysicalIndex: '{{ $nbsCmmcChassisIfIndex }}15'
|
||||
-
|
||||
oid: nbsCmmcSlotTable
|
||||
value: nbsCmmcSlotTemperature
|
||||
num_oid: '.1.3.6.1.4.1.629.200.7.1.1.34.{{ $index }}'
|
||||
descr: 'Slot {{ $index }} Temperature'
|
||||
index: 'nbsCmmcSlotTemperature.{{ $index }}'
|
||||
entPhysicalIndex: '{{ $nbsCmmcSlotIfIndex }}34'
|
||||
-
|
||||
oid: nbsCmmcPortTable
|
||||
value: nbsCmmcPortTemperature
|
||||
num_oid: '.1.3.6.1.4.1.629.200.8.1.1.30.{{ $index }}'
|
||||
descr: 'Port {{ $index }} Temperature'
|
||||
index: 'nbsCmmcPortTemperature.{{ $index }}'
|
||||
entPhysicalIndex: '{{ $nbsCmmcPortIfIndex }}30'
|
||||
state:
|
||||
data:
|
||||
-
|
||||
oid: nbsCmmcPortTable
|
||||
value: nbsCmmcPortDigitalDiags
|
||||
num_oid: '.1.3.6.1.4.1.629.200.8.1.1.38.{{ $index }}'
|
||||
descr: 'Port {{ $index }} Overall DigiDiags State'
|
||||
index: 'nbsCmmcPortDigitalDiags.{{ $index }}'
|
||||
skip_values: 1
|
||||
entPhysicalIndex: '{{ $nbsCmmcPortIfIndex }}38'
|
||||
state_name: nbsCmmcPortDigitalDiags
|
||||
states:
|
||||
- { value: 1, descr: notSupported, graph: 0, generic: 3 }
|
||||
- { value: 2, descr: diagsOk, graph: 0, generic: 0 }
|
||||
- { value: 3, descr: diagsWarning, graph: 1, generic: 1 }
|
||||
- { value: 4, descr: diagsAlarm, graph: 2, generic: 2 }
|
||||
-
|
||||
oid: nbsCmmcChassisTable
|
||||
value: nbsCmmcChassisPowerStatus
|
||||
num_oid: '.1.3.6.1.4.1.629.200.6.1.1.51.{{ $index }}'
|
||||
descr: 'Chassis {{ $index }} Power Budget Status'
|
||||
index: 'nbsCmmcChassisPowerStatus.{{ $index }}'
|
||||
skip_values: 1
|
||||
entPhysicalIndex: '{{ $nbsCmmcChassisIfIndex }}51'
|
||||
state_name: nbsCmmcChassisPowerStatus
|
||||
states:
|
||||
- { value: 1, descr: notSupported, graph: 0, generic: 3 }
|
||||
- { value: 2, descr: sufficient, graph: 1, generic: 0 }
|
||||
- { value: 3, descr: insufficient, graph: -1, generic: 2 }
|
||||
-
|
||||
oid: nbsCmmcChassisTable
|
||||
value: nbsCmmcChassisPS1Status
|
||||
num_oid: '.1.3.6.1.4.1.629.200.6.1.1.7.{{ $index }}'
|
||||
descr: 'Chassis {{ $index }} Power Supply 1'
|
||||
index: 'nbsCmmcChassisPS1Status.{{ $index }}'
|
||||
skip_values: 6
|
||||
entPhysicalIndex: '{{ $nbsCmmcChassisIfIndex }}7'
|
||||
state_name: nbsCmmcChassisPSStatus
|
||||
states:
|
||||
- { value: 1, descr: notInstalled, graph: 0, generic: 2 }
|
||||
- { value: 2, descr: acBad, graph: -1, generic: 2 }
|
||||
- { value: 3, descr: dcBad, graph: -1, generic: 2 }
|
||||
- { value: 4, descr: acGood, graph: 1, generic: 0 }
|
||||
- { value: 5, descr: dcGood, graph: 1, generic: 0 }
|
||||
- { value: 6, descr: notSupported, graph: 0, generic: 3 }
|
||||
- { value: 7, descr: good, graph: 1, generic: 0 }
|
||||
- { value: 8, descr: bad, graph: -1, generic: 2 }
|
||||
-
|
||||
oid: nbsCmmcChassisTable
|
||||
value: nbsCmmcChassisPS2Status
|
||||
num_oid: '.1.3.6.1.4.1.629.200.6.1.1.8.{{ $index }}'
|
||||
descr: 'Chassis {{ $index }} Power Supply 2'
|
||||
index: 'nbsCmmcChassisPS2Status.{{ $index }}'
|
||||
skip_values: 6
|
||||
entPhysicalIndex: '{{ $nbsCmmcChassisIfIndex }}8'
|
||||
state_name: nbsCmmcChassisPSStatus
|
||||
states:
|
||||
- { value: 1, descr: notInstalled, graph: 0, generic: 2 }
|
||||
- { value: 2, descr: acBad, graph: -1, generic: 2 }
|
||||
- { value: 3, descr: dcBad, graph: -1, generic: 2 }
|
||||
- { value: 4, descr: acGood, graph: 1, generic: 0 }
|
||||
- { value: 5, descr: dcGood, graph: 1, generic: 0 }
|
||||
- { value: 6, descr: notSupported, graph: 0, generic: 3 }
|
||||
- { value: 7, descr: good, graph: 1, generic: 0 }
|
||||
- { value: 8, descr: bad, graph: -1, generic: 2 }
|
||||
-
|
||||
oid: nbsCmmcChassisTable
|
||||
value: nbsCmmcChassisPS3Status
|
||||
num_oid: '.1.3.6.1.4.1.629.200.6.1.1.9.{{ $index }}'
|
||||
descr: 'Chassis {{ $index }} Power Supply 3'
|
||||
index: 'nbsCmmcChassisPS3Status.{{ $index }}'
|
||||
skip_values: 6
|
||||
entPhysicalIndex: '{{ $nbsCmmcChassisIfIndex }}9'
|
||||
state_name: nbsCmmcChassisPSStatus
|
||||
states:
|
||||
- { value: 1, descr: notInstalled, graph: 0, generic: 2 }
|
||||
- { value: 2, descr: acBad, graph: -1, generic: 2 }
|
||||
- { value: 3, descr: dcBad, graph: -1, generic: 2 }
|
||||
- { value: 4, descr: acGood, graph: 1, generic: 0 }
|
||||
- { value: 5, descr: dcGood, graph: 1, generic: 0 }
|
||||
- { value: 6, descr: notSupported, graph: 0, generic: 3 }
|
||||
- { value: 7, descr: good, graph: 1, generic: 0 }
|
||||
- { value: 8, descr: bad, graph: -1, generic: 2 }
|
||||
-
|
||||
oid: nbsCmmcChassisTable
|
||||
value: nbsCmmcChassisPS4Status
|
||||
num_oid: '.1.3.6.1.4.1.629.200.6.1.1.10.{{ $index }}'
|
||||
descr: 'Chassis {{ $index }} Power Supply 4'
|
||||
index: 'nbsCmmcChassisPS4Status.{{ $index }}'
|
||||
skip_values: 6
|
||||
entPhysicalIndex: '{{ $nbsCmmcChassisIfIndex }}10'
|
||||
state_name: nbsCmmcChassisPSStatus
|
||||
states:
|
||||
- { value: 1, descr: notInstalled, graph: 0, generic: 2 }
|
||||
- { value: 2, descr: acBad, graph: -1, generic: 2 }
|
||||
- { value: 3, descr: dcBad, graph: -1, generic: 2 }
|
||||
- { value: 4, descr: acGood, graph: 1, generic: 0 }
|
||||
- { value: 5, descr: dcGood, graph: 1, generic: 0 }
|
||||
- { value: 6, descr: notSupported, graph: 0, generic: 3 }
|
||||
- { value: 7, descr: good, graph: 1, generic: 0 }
|
||||
- { value: 8, descr: bad, graph: -1, generic: 2 }
|
||||
-
|
||||
oid: nbsCmmcChassisTable
|
||||
value: nbsCmmcChassisFan1Status
|
||||
num_oid: '.1.3.6.1.4.1.629.200.6.1.1.11.{{ $index }}'
|
||||
descr: 'Chassis {{ $index }} Fan 1'
|
||||
index: 'nbsCmmcChassisFan1Status.{{ $index }}'
|
||||
skip_values: 1
|
||||
entPhysicalIndex: '{{ $nbsCmmcChassisIfIndex }}11'
|
||||
state_name: nbsCmmcChassisFanStatus
|
||||
states:
|
||||
- { value: 1, descr: notSupported, graph: 0, generic: 3 }
|
||||
- { value: 2, descr: bad, graph: -1, generic: 2 }
|
||||
- { value: 3, descr: good, graph: 1, generic: 0 }
|
||||
- { value: 4, descr: notInstalled, graph: 0, generic: 2 }
|
||||
-
|
||||
oid: nbsCmmcChassisTable
|
||||
value: nbsCmmcChassisFan2Status
|
||||
num_oid: '.1.3.6.1.4.1.629.200.6.1.1.12.{{ $index }}'
|
||||
descr: 'Chassis {{ $index }} Fan 2'
|
||||
index: 'nbsCmmcChassisFan2Status.{{ $index }}'
|
||||
skip_values: 1
|
||||
entPhysicalIndex: '{{ $nbsCmmcChassisIfIndex }}12'
|
||||
state_name: nbsCmmcChassisFanStatus
|
||||
states:
|
||||
- { value: 1, descr: notSupported, graph: 0, generic: 3 }
|
||||
- { value: 2, descr: bad, graph: -1, generic: 2 }
|
||||
- { value: 3, descr: good, graph: 1, generic: 0 }
|
||||
- { value: 4, descr: notInstalled, graph: 0, generic: 2 }
|
||||
-
|
||||
oid: nbsCmmcChassisTable
|
||||
value: nbsCmmcChassisFan3Status
|
||||
num_oid: '.1.3.6.1.4.1.629.200.6.1.1.13.{{ $index }}'
|
||||
descr: 'Chassis {{ $index }} Fan 3'
|
||||
index: 'nbsCmmcChassisFan3Status.{{ $index }}'
|
||||
skip_values: 1
|
||||
entPhysicalIndex: '{{ $nbsCmmcChassisIfIndex }}13'
|
||||
state_name: nbsCmmcChassisFanStatus
|
||||
states:
|
||||
- { value: 1, descr: notSupported, graph: 0, generic: 3 }
|
||||
- { value: 2, descr: bad, graph: -1, generic: 2 }
|
||||
- { value: 3, descr: good, graph: 1, generic: 0 }
|
||||
- { value: 4, descr: notInstalled, graph: 0, generic: 2 }
|
||||
-
|
||||
oid: nbsCmmcChassisTable
|
||||
value: nbsCmmcChassisFan4Status
|
||||
num_oid: '.1.3.6.1.4.1.629.200.6.1.1.14.{{ $index }}'
|
||||
descr: 'Chassis {{ $index }} Fan 4'
|
||||
index: 'nbsCmmcChassisFan4Status.{{ $index }}'
|
||||
skip_values: 1
|
||||
entPhysicalIndex: '{{ $nbsCmmcChassisIfIndex }}14'
|
||||
state_name: nbsCmmcChassisFanStatus
|
||||
states:
|
||||
- { value: 1, descr: notSupported, graph: 0, generic: 3 }
|
||||
- { value: 2, descr: bad, graph: -1, generic: 2 }
|
||||
- { value: 3, descr: good, graph: 1, generic: 0 }
|
||||
- { value: 4, descr: notInstalled, graph: 0, generic: 2 }
|
||||
-
|
||||
oid: nbsCmmcChassisTable
|
||||
value: nbsCmmcChassisFan5Status
|
||||
num_oid: '.1.3.6.1.4.1.629.200.6.1.1.36.{{ $index }}'
|
||||
descr: 'Chassis {{ $index }} Fan 5'
|
||||
index: 'nbsCmmcChassisFan5Status.{{ $index }}'
|
||||
skip_values: 1
|
||||
entPhysicalIndex: '{{ $nbsCmmcChassisIfIndex }}36'
|
||||
state_name: nbsCmmcChassisFanStatus
|
||||
states:
|
||||
- { value: 1, descr: notSupported, graph: 0, generic: 3 }
|
||||
- { value: 2, descr: bad, graph: -1, generic: 2 }
|
||||
- { value: 3, descr: good, graph: 1, generic: 0 }
|
||||
- { value: 4, descr: notInstalled, graph: 0, generic: 2 }
|
||||
-
|
||||
oid: nbsCmmcChassisTable
|
||||
value: nbsCmmcChassisFan6Status
|
||||
num_oid: '.1.3.6.1.4.1.629.200.6.1.1.37.{{ $index }}'
|
||||
descr: 'Chassis {{ $index }} Fan 6'
|
||||
index: 'nbsCmmcChassisFan6Status.{{ $index }}'
|
||||
skip_values: 1
|
||||
entPhysicalIndex: '{{ $nbsCmmcChassisIfIndex }}37'
|
||||
state_name: nbsCmmcChassisFanStatus
|
||||
states:
|
||||
- { value: 1, descr: notSupported, graph: 0, generic: 3 }
|
||||
- { value: 2, descr: bad, graph: -1, generic: 2 }
|
||||
- { value: 3, descr: good, graph: 1, generic: 0 }
|
||||
- { value: 4, descr: notInstalled, graph: 0, generic: 2 }
|
||||
-
|
||||
oid: nbsCmmcChassisTable
|
||||
value: nbsCmmcChassisFan7Status
|
||||
num_oid: '.1.3.6.1.4.1.629.200.6.1.1.38.{{ $index }}'
|
||||
descr: 'Chassis {{ $index }} Fan 7'
|
||||
index: 'nbsCmmcChassisFan7Status.{{ $index }}'
|
||||
skip_values: 1
|
||||
entPhysicalIndex: '{{ $nbsCmmcChassisIfIndex }}38'
|
||||
state_name: nbsCmmcChassisFanStatus
|
||||
states:
|
||||
- { value: 1, descr: notSupported, graph: 0, generic: 3 }
|
||||
- { value: 2, descr: bad, graph: -1, generic: 2 }
|
||||
- { value: 3, descr: good, graph: 1, generic: 0 }
|
||||
- { value: 4, descr: notInstalled, graph: 0, generic: 2 }
|
||||
-
|
||||
oid: nbsCmmcChassisTable
|
||||
value: nbsCmmcChassisFan8Status
|
||||
num_oid: '.1.3.6.1.4.1.629.200.6.1.1.39.{{ $index }}'
|
||||
descr: 'Chassis {{ $index }} Fan 8'
|
||||
index: 'nbsCmmcChassisFan8Status.{{ $index }}'
|
||||
skip_values: 1
|
||||
entPhysicalIndex: '{{ $nbsCmmcChassisIfIndex }}39'
|
||||
state_name: nbsCmmcChassisFanStatus
|
||||
states:
|
||||
- { value: 1, descr: notSupported, graph: 0, generic: 3 }
|
||||
- { value: 2, descr: bad, graph: -1, generic: 2 }
|
||||
- { value: 3, descr: good, graph: 1, generic: 0 }
|
||||
- { value: 4, descr: notInstalled, graph: 0, generic: 2 }
|
@@ -2,6 +2,10 @@ os: mrv-od
|
||||
text: 'MRV OptiDriver'
|
||||
type: network
|
||||
icon: mrv
|
||||
group: mrv
|
||||
over:
|
||||
- { graph: device_dbm, text: 'dBm' }
|
||||
- { graph: device_temperature, text: 'Temperature' }
|
||||
mib_dir:
|
||||
- mrv
|
||||
discovery:
|
||||
|
360
includes/discovery/entity-physical/mrv-od.inc.php
Normal file
360
includes/discovery/entity-physical/mrv-od.inc.php
Normal file
@@ -0,0 +1,360 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS entity-physical module for the discovery of components in the MRV® OptiDriver® Optical Transport Platform
|
||||
*
|
||||
* Copyright (c) 2019 Martijn Schmidt <martijn.schmidt@gmail.com>
|
||||
*
|
||||
* 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 "\nCaching OIDs:";
|
||||
|
||||
$entity_array = [];
|
||||
echo ' MRV OptiDriver';
|
||||
$chassis_array = snmpwalk_cache_multi_oid($device, 'nbsCmmcChassisTable', $chassis_array, 'NBS-CMMC-MIB');
|
||||
$slot_array = snmpwalk_cache_multi_oid($device, 'nbsCmmcSlotTable', $slot_array, 'NBS-CMMC-MIB');
|
||||
$port_array = snmpwalk_cache_multi_oid($device, 'nbsCmmcPortTable', $port_array, 'NBS-CMMC-MIB');
|
||||
|
||||
// We use the last digit in the OID to define an entPhysicalIndex for Power Supply state sensors
|
||||
$nbsCmmcChassisPSStatus_array = [
|
||||
7 => 'nbsCmmcChassisPS1Status',
|
||||
8 => 'nbsCmmcChassisPS2Status',
|
||||
9 => 'nbsCmmcChassisPS3Status',
|
||||
10 => 'nbsCmmcChassisPS4Status',
|
||||
];
|
||||
|
||||
// We use the last digit in the OID to define an entPhysicalIndex for Fan state sensors
|
||||
$nbsCmmcChassisFanStatus_array = [
|
||||
11 => 'nbsCmmcChassisFan1Status',
|
||||
12 => 'nbsCmmcChassisFan2Status',
|
||||
13 => 'nbsCmmcChassisFan3Status',
|
||||
14 => 'nbsCmmcChassisFan4Status',
|
||||
36 => 'nbsCmmcChassisFan5Status',
|
||||
37 => 'nbsCmmcChassisFan6Status',
|
||||
38 => 'nbsCmmcChassisFan7Status',
|
||||
39 => 'nbsCmmcChassisFan8Status',
|
||||
];
|
||||
|
||||
// Define all the types of pluggable port form factors recognized by nbsCmmcPortType in NBS-CMMC-MIB,
|
||||
// if nbsCmmcPortType returns a value that is not in this array, it should be a built-in port in the card.
|
||||
$nbsCmmcPortType_array = [
|
||||
125 => 'SFP',
|
||||
147 => 'GBIC',
|
||||
197 => 'XFP',
|
||||
219 => 'QSFP+',
|
||||
220 => 'CXP',
|
||||
221 => 'CFP',
|
||||
223 => 'QSFP28',
|
||||
224 => 'CFP2',
|
||||
];
|
||||
|
||||
$nbsCmmcPortSensor_array = [
|
||||
30 => [
|
||||
'objectType' => 'nbsCmmcPortTemperature',
|
||||
'skipValue' => '-2147483648',
|
||||
'entPhysicalName' => 'Port Temperature',
|
||||
],
|
||||
31 => [
|
||||
'objectType' => 'nbsCmmcPortTxPower',
|
||||
'skipValue' => '-2147483648',
|
||||
'entPhysicalName' => 'Port Tx Power',
|
||||
],
|
||||
32 => [
|
||||
'objectType' => 'nbsCmmcPortRxPower',
|
||||
'skipValue' => '-2147483648',
|
||||
'entPhysicalName' => 'Port Rx Power',
|
||||
],
|
||||
33 => [
|
||||
'objectType' => 'nbsCmmcPortBiasAmps',
|
||||
'skipValue' => '-1',
|
||||
'entPhysicalName' => 'Port Tx Bias Current',
|
||||
],
|
||||
34 => [
|
||||
'objectType' => 'nbsCmmcPortSupplyVolts',
|
||||
'skipValue' => '-1',
|
||||
'entPhysicalName' => 'Port Tx Supply Voltage',
|
||||
],
|
||||
38 => [
|
||||
'objectType' => 'nbsCmmcPortDigitalDiags',
|
||||
'skipValue' => '1',
|
||||
'entPhysicalName' => 'Port Overall DigiDiags State',
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($chassis_array as $nbsCmmcChassis => $chassis_contents) {
|
||||
list($chassisHardwareRev, $chassisFirmwareRev) = explode(', ', $chassis_contents['nbsCmmcChassisHardwareRevision']);
|
||||
// Discover the chassis
|
||||
$entity_array[] = [
|
||||
'entPhysicalIndex' => $chassis_contents['nbsCmmcChassisIfIndex']."00",
|
||||
'entPhysicalDescr' => "MRV OptiDriver {$chassis_contents['nbsCmmcChassisModel']}",
|
||||
'entPhysicalClass' => 'chassis',
|
||||
'entPhysicalName' => "Chassis $nbsCmmcChassis",
|
||||
'entPhysicalModelName' => $chassis_contents['nbsCmmcChassisModel'],
|
||||
'entPhysicalSerialNum' => $chassis_contents['nbsCmmcChassisSerialNum'],
|
||||
'entPhysicalContainedIn' => '0',
|
||||
'entPhysicalMfgName' => 'MRV Communications',
|
||||
'entPhysicalParentRelPos' => $chassis_contents['nbsCmmcChassisIndex'],
|
||||
'entPhysicalVendorType' => $chassis_contents['nbsCmmcChassisType'],
|
||||
'entPhysicalHardwareRev' => $chassisHardwareRev,
|
||||
'entPhysicalFirmwareRev' => $chassisFirmwareRev,
|
||||
'entPhysicalIsFRU' => 'true',
|
||||
'entPhysicalAlias' => $chassis_contents['nbsCmmcChassisName'],
|
||||
];
|
||||
|
||||
// Discover the chassis temperature sensor
|
||||
if (isset($chassis_contents['nbsCmmcChassisTemperature']) && $chassis_contents['nbsCmmcChassisTemperature'] != '-2147483648') {
|
||||
$entity_array[] = [
|
||||
'entPhysicalIndex' => "{$chassis_contents['nbsCmmcChassisIfIndex']}15",
|
||||
'entPhysicalDescr' => "Chassis Temperature Sensor",
|
||||
'entPhysicalClass' => 'sensor',
|
||||
'entPhysicalName' => "Chassis Temperature",
|
||||
'entPhysicalContainedIn' => "{$chassis_contents['nbsCmmcChassisIfIndex']}00",
|
||||
'entPhysicalMfgName' => 'MRV Communications',
|
||||
'entPhysicalParentRelPos' => '-1',
|
||||
'entPhysicalIsFRU' => 'false',
|
||||
];
|
||||
}
|
||||
|
||||
// Discover the chassis power budget status sensor
|
||||
if (isset($chassis_contents['nbsCmmcChassisPowerStatus']) && $chassis_contents['nbsCmmcChassisPowerStatus'] != 'notSupported') {
|
||||
$entity_array[] = [
|
||||
'entPhysicalIndex' => "{$chassis_contents['nbsCmmcChassisIfIndex']}51",
|
||||
'entPhysicalDescr' => "Chassis Power Budget Status Sensor",
|
||||
'entPhysicalClass' => 'sensor',
|
||||
'entPhysicalName' => "Chassis Power Budget Status",
|
||||
'entPhysicalContainedIn' => "{$chassis_contents['nbsCmmcChassisIfIndex']}00",
|
||||
'entPhysicalMfgName' => 'MRV Communications',
|
||||
'entPhysicalParentRelPos' => '-1',
|
||||
'entPhysicalIsFRU' => 'false',
|
||||
];
|
||||
}
|
||||
|
||||
// Discover the chassis power supplies and state sensors
|
||||
foreach ($nbsCmmcChassisPSStatus_array as $index => $item) {
|
||||
if (isset($chassis_contents[$item]) && $chassis_contents[$item] != 'notSupported') {
|
||||
$position = substr($item, 16, 1);
|
||||
$entity_array[] = [
|
||||
'entPhysicalIndex' => $chassis_contents['nbsCmmcChassisIfIndex'].$position,
|
||||
'entPhysicalDescr' => "Power Supply",
|
||||
'entPhysicalClass' => 'powerSupply',
|
||||
'entPhysicalName' => "Power Supply $position",
|
||||
'entPhysicalContainedIn' => "{$chassis_contents['nbsCmmcChassisIfIndex']}00",
|
||||
'entPhysicalMfgName' => 'MRV Communications',
|
||||
'entPhysicalParentRelPos' => $position,
|
||||
'entPhysicalIsFRU' => 'false',
|
||||
];
|
||||
$entity_array[] = [
|
||||
'entPhysicalIndex' => $chassis_contents['nbsCmmcChassisIfIndex'].$index,
|
||||
'entPhysicalDescr' => "Power Supply State",
|
||||
'entPhysicalClass' => 'sensor',
|
||||
'entPhysicalName' => "Power Supply $position",
|
||||
'entPhysicalContainedIn' => $chassis_contents['nbsCmmcChassisIfIndex'].$position,
|
||||
'entPhysicalMfgName' => 'MRV Communications',
|
||||
'entPhysicalParentRelPos' => '-1',
|
||||
'entPhysicalIsFRU' => 'true',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// Discover the chassis fan trays and state sensors
|
||||
foreach ($nbsCmmcChassisFanStatus_array as $index => $item) {
|
||||
if (isset($chassis_contents[$item]) && $chassis_contents[$item] != 'notSupported') {
|
||||
$position = substr($item, 17, 1);
|
||||
$entity_array[] = [
|
||||
'entPhysicalIndex' => "{$chassis_contents['nbsCmmcChassisIfIndex']}0$position",
|
||||
'entPhysicalDescr' => "Fan Tray",
|
||||
'entPhysicalClass' => 'fan',
|
||||
'entPhysicalName' => "Fan Tray $position",
|
||||
'entPhysicalContainedIn' => "{$chassis_contents['nbsCmmcChassisIfIndex']}00",
|
||||
'entPhysicalMfgName' => 'MRV Communications',
|
||||
'entPhysicalParentRelPos' => $position,
|
||||
'entPhysicalIsFRU' => 'false',
|
||||
];
|
||||
$entity_array[] = [
|
||||
'entPhysicalIndex' => $chassis_contents['nbsCmmcChassisIfIndex'].$index,
|
||||
'entPhysicalDescr' => "Fan State",
|
||||
'entPhysicalClass' => 'sensor',
|
||||
'entPhysicalName' => "Fan $position",
|
||||
'entPhysicalContainedIn' => "{$chassis_contents['nbsCmmcChassisIfIndex']}0$position",
|
||||
'entPhysicalMfgName' => 'MRV Communications',
|
||||
'entPhysicalParentRelPos' => '-1',
|
||||
'entPhysicalIsFRU' => 'true',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach ($slot_array as $nbsCmmcSlot => $slot_contents) {
|
||||
// Obtain the nbsCmmcChassisIfIndex of the chassis which houses this slot
|
||||
$nbsCmmcChassisIfIndex = $chassis_array[$slot_contents['nbsCmmcSlotChassisIndex']]['nbsCmmcChassisIfIndex'];
|
||||
// Calculate the nbsCmmcSlotIfIndex since an empty slot has nbsCmmcSlotIfIndex == -1
|
||||
$nbsCmmcSlotIfIndex = $nbsCmmcChassisIfIndex + $slot_contents['nbsCmmcSlotIndex'] * 1000;
|
||||
// Discover the slot
|
||||
$entity_array[] = [
|
||||
'entPhysicalIndex' => $nbsCmmcSlotIfIndex."00",
|
||||
'entPhysicalDescr' => 'MRV OptiDriver Slot',
|
||||
'entPhysicalClass' => 'container',
|
||||
'entPhysicalName' => "Card Slot $nbsCmmcSlot",
|
||||
'entPhysicalContainedIn' => $nbsCmmcChassisIfIndex."00",
|
||||
'entPhysicalMfgName' => 'MRV Communications',
|
||||
'entPhysicalParentRelPos' => $slot_contents['nbsCmmcSlotIndex'],
|
||||
'entPhysicalIsFRU' => 'false',
|
||||
];
|
||||
if (isset($slot_contents['nbsCmmcSlotIfIndex']) && $slot_contents['nbsCmmcSlotIfIndex'] != '-1') {
|
||||
list($cardHardwareRev, $cardFirmwareRev, $cardOtherRev) = explode(', ', $slot_contents['nbsCmmcSlotHardwareRevision']);
|
||||
// Discover the card
|
||||
$entity_array[] = [
|
||||
'entPhysicalIndex' => $slot_contents['nbsCmmcSlotIfIndex']."01",
|
||||
'entPhysicalDescr' => "MRV ".ucfirst($slot_contents['nbsCmmcSlotOperationType'])." Card",
|
||||
'entPhysicalClass' => 'module',
|
||||
'entPhysicalName' => "Card $nbsCmmcSlot",
|
||||
'entPhysicalModelName' => $slot_contents['nbsCmmcSlotModel'],
|
||||
'entPhysicalSerialNum' => $slot_contents['nbsCmmcSlotSerialNum'],
|
||||
'entPhysicalContainedIn' => "{$slot_contents['nbsCmmcSlotIfIndex']}00",
|
||||
'entPhysicalMfgName' => 'MRV Communications',
|
||||
'entPhysicalParentRelPos' => '-1',
|
||||
'entPhysicalVendorType' => $slot_contents['nbsCmmcSlotType'],
|
||||
'entPhysicalHardwareRev' => "$cardHardwareRev, $cardOtherRev",
|
||||
'entPhysicalFirmwareRev' => $cardFirmwareRev,
|
||||
'entPhysicalIsFRU' => 'true',
|
||||
'entPhysicalAlias' => $slot_contents['nbsCmmcSlotName'],
|
||||
];
|
||||
|
||||
// Discover the module temperature sensor
|
||||
if (isset($slot_contents['nbsCmmcSlotTemperature']) && $slot_contents['nbsCmmcSlotTemperature'] != '-2147483648') {
|
||||
$entity_array[] = [
|
||||
'entPhysicalIndex' => "{$slot_contents['nbsCmmcSlotIfIndex']}34",
|
||||
'entPhysicalDescr' => "Card Temperature Sensor",
|
||||
'entPhysicalClass' => 'sensor',
|
||||
'entPhysicalName' => "Card Temperature",
|
||||
'entPhysicalContainedIn' => "{$slot_contents['nbsCmmcSlotIfIndex']}01",
|
||||
'entPhysicalMfgName' => 'MRV Communications',
|
||||
'entPhysicalParentRelPos' => '-1',
|
||||
'entPhysicalIsFRU' => 'false',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($port_array as $nbsCmmcPort => $port_contents) {
|
||||
// Obtain the nbsCmmcSlotIfIndex of the slot which houses this port
|
||||
$nbsCmmcSlot = $port_contents['nbsCmmcPortChassisIndex'].".".$port_contents['nbsCmmcPortSlotIndex'];
|
||||
$nbsCmmcSlotIfIndex = $slot_array[$nbsCmmcSlot]['nbsCmmcSlotIfIndex'];
|
||||
|
||||
// We only need to discover a transceiver container if the port type is pluggable
|
||||
if (array_key_exists($port_contents['nbsCmmcPortType'], $nbsCmmcPortType_array)) {
|
||||
$nbsCmmcPortType = $nbsCmmcPortType_array[$port_contents['nbsCmmcPortType']];
|
||||
|
||||
// Discover the transceiver container
|
||||
$entity_array[] = [
|
||||
'entPhysicalIndex' => $port_contents['nbsCmmcPortIfIndex']."00",
|
||||
'entPhysicalDescr' => "$nbsCmmcPortType Transceiver Container",
|
||||
'entPhysicalClass' => 'container',
|
||||
'entPhysicalName' => "Transceiver Container $nbsCmmcPort",
|
||||
'entPhysicalContainedIn' => $nbsCmmcSlotIfIndex."01",
|
||||
'entPhysicalMfgName' => 'MRV Communications',
|
||||
'entPhysicalParentRelPos' => $port_contents['nbsCmmcPortIndex'],
|
||||
'entPhysicalIsFRU' => 'false',
|
||||
];
|
||||
// Set a few variables for the port discovery
|
||||
$nbsCmmcPortContainedIn = $port_contents['nbsCmmcPortIfIndex']."00";
|
||||
$nbsCmmcPortVendorInfo = $port_contents['nbsCmmcPortVendorInfo'];
|
||||
$nbsCmmcPortIsFRU = 'true';
|
||||
$nbsCmmcPortParentRelPos = '-1';
|
||||
// If one runs a command like "show 1.1.1 | grep Part" on a port with a genuine pluggable transceiver,
|
||||
// CLI output like "Part #/Rev: SFP-10GDWZR-22/0001" indicates / is considered to be the string delimiter.
|
||||
// However, non-genuine pluggable transceivers may not adhere to this format.
|
||||
list($nbsCmmcPortModelName, $nbsCmmcPortHardwareRev) = explode('/', $port_contents['nbsCmmcPortPartRev']);
|
||||
} else {
|
||||
$nbsCmmcPortType = 'Built-in';
|
||||
|
||||
// Set a few variables for the port discovery
|
||||
$nbsCmmcPortContainedIn = $nbsCmmcSlotIfIndex."01";
|
||||
$nbsCmmcPortVendorInfo = "MRV Communications";
|
||||
$nbsCmmcPortIsFRU = 'false';
|
||||
$nbsCmmcPortParentRelPos = $port_contents['nbsCmmcPortIndex'];
|
||||
$nbsCmmcPortModelName = '';
|
||||
$nbsCmmcPortHardwareRev = '';
|
||||
}
|
||||
|
||||
if (isset($port_contents['nbsCmmcPortConnector']) && $port_contents['nbsCmmcPortConnector'] != 'removed') {
|
||||
// Determine the correct entPhysicalDescr for the port
|
||||
if (isset($port_contents['nbsCmmcPortWavelengthX']) && $port_contents['nbsCmmcPortWavelengthX'] != 'N/A') {
|
||||
$portEntPhysicalDescr = "$nbsCmmcPortType Port, {$port_contents['nbsCmmcPortWavelengthX']}nm Tx Signal, {$port_contents['nbsCmmcPortConnector']} Connector";
|
||||
} elseif (!empty($port_contents['nbsCmmcPortDescription'])) {
|
||||
$portEntPhysicalDescr = "$nbsCmmcPortType Port, {$port_contents['nbsCmmcPortDescription']}, {$port_contents['nbsCmmcPortConnector']} Connector";
|
||||
} else {
|
||||
$portEntPhysicalDescr = "$nbsCmmcPortType Port, {$port_contents['nbsCmmcPortConnector']} Connector";
|
||||
}
|
||||
|
||||
// Discover the port
|
||||
$entity_array[] = [
|
||||
'entPhysicalIndex' => "{$port_contents['nbsCmmcPortIfIndex']}01",
|
||||
'entPhysicalDescr' => $portEntPhysicalDescr,
|
||||
'entPhysicalClass' => 'port',
|
||||
'entPhysicalName' => "Port $nbsCmmcPort",
|
||||
'entPhysicalModelName' => $nbsCmmcPortModelName,
|
||||
'entPhysicalSerialNum' => $port_contents['nbsCmmcPortSerialNumber'],
|
||||
'entPhysicalContainedIn' => $nbsCmmcPortContainedIn,
|
||||
'entPhysicalMfgName' => $nbsCmmcPortVendorInfo,
|
||||
'entPhysicalParentRelPos' => $nbsCmmcPortParentRelPos,
|
||||
'entPhysicalVendorType' => $port_contents['nbsCmmcPortType'],
|
||||
'entPhysicalHardwareRev' => $nbsCmmcPortHardwareRev,
|
||||
'entPhysicalIsFRU' => $nbsCmmcPortIsFRU,
|
||||
'entPhysicalAlias' => $port_contents['nbsCmmcPortName'],
|
||||
'ifIndex' => $port_contents['nbsCmmcPortIfIndex'],
|
||||
];
|
||||
|
||||
// Discover the port sensors
|
||||
foreach ($nbsCmmcPortSensor_array as $index => $nbsCmmcPortSensor) {
|
||||
if (isset($port_contents[$nbsCmmcPortSensor['objectType']]) && $port_contents[$nbsCmmcPortSensor['objectType']] != $nbsCmmcPortSensor['skipValue']) {
|
||||
$entity_array[] = [
|
||||
'entPhysicalIndex' => $port_contents['nbsCmmcPortIfIndex'].$index,
|
||||
'entPhysicalDescr' => "{$nbsCmmcPortSensor['entPhysicalName']} Sensor",
|
||||
'entPhysicalClass' => 'sensor',
|
||||
'entPhysicalName' => $nbsCmmcPortSensor['entPhysicalName'],
|
||||
'entPhysicalContainedIn' => "{$port_contents['nbsCmmcPortIfIndex']}01",
|
||||
'entPhysicalMfgName' => $nbsCmmcPortVendorInfo,
|
||||
'entPhysicalParentRelPos' => '-1',
|
||||
'entPhysicalIsFRU' => 'false',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($entity_array as $entPhysicalIndex => $entry) {
|
||||
$entPhysicalIndex = array_key_exists('entPhysicalIndex', $entry) ? $entry['entPhysicalIndex'] : '';
|
||||
$entPhysicalDescr = array_key_exists('entPhysicalDescr', $entry) ? $entry['entPhysicalDescr'] : '';
|
||||
$entPhysicalClass = array_key_exists('entPhysicalClass', $entry) ? $entry['entPhysicalClass'] : '';
|
||||
$entPhysicalName = array_key_exists('entPhysicalName', $entry) ? $entry['entPhysicalName'] : '';
|
||||
$entPhysicalModelName = array_key_exists('entPhysicalModelName', $entry) ? $entry['entPhysicalModelName'] : '';
|
||||
$entPhysicalSerialNum = array_key_exists('entPhysicalSerialNum', $entry) ? $entry['entPhysicalSerialNum'] : '';
|
||||
$entPhysicalContainedIn = array_key_exists('entPhysicalContainedIn', $entry) ? $entry['entPhysicalContainedIn'] : '';
|
||||
$entPhysicalMfgName = array_key_exists('entPhysicalMfgName', $entry) ? $entry['entPhysicalMfgName'] : '';
|
||||
$entPhysicalParentRelPos = array_key_exists('entPhysicalParentRelPos', $entry) ? $entry['entPhysicalParentRelPos'] : '';
|
||||
$entPhysicalVendorType = array_key_exists('entPhysicalVendorType', $entry) ? $entry['entPhysicalVendorType'] : '';
|
||||
$entPhysicalHardwareRev = array_key_exists('entPhysicalHardwareRev', $entry) ? $entry['entPhysicalHardwareRev'] : '';
|
||||
$entPhysicalFirmwareRev = array_key_exists('entPhysicalFirmwareRev', $entry) ? $entry['entPhysicalFirmwareRev'] : '';
|
||||
$entPhysicalSoftwareRev = array_key_exists('entPhysicalSoftwareRev', $entry) ? $entry['entPhysicalSoftwareRev'] : '';
|
||||
$entPhysicalIsFRU = array_key_exists('entPhysicalIsFRU', $entry) ? $entry['entPhysicalIsFRU'] : '';
|
||||
$entPhysicalAlias = array_key_exists('entPhysicalAlias', $entry) ? $entry['entPhysicalAlias'] : '';
|
||||
$entPhysicalAssetID = array_key_exists('entPhysicalAssetID', $entry) ? $entry['entPhysicalAssetID'] : '';
|
||||
$ifIndex = array_key_exists('ifIndex', $entry) ? $entry['ifIndex'] : '';
|
||||
|
||||
discover_entity_physical($valid, $device, $entPhysicalIndex, $entPhysicalDescr, $entPhysicalClass, $entPhysicalName, $entPhysicalModelName, $entPhysicalSerialNum, $entPhysicalContainedIn, $entPhysicalMfgName, $entPhysicalParentRelPos, $entPhysicalVendorType, $entPhysicalHardwareRev, $entPhysicalFirmwareRev, $entPhysicalSoftwareRev, $entPhysicalIsFRU, $entPhysicalAlias, $entPhysicalAssetID, $ifIndex);
|
||||
}//end foreach
|
||||
|
||||
echo "\n";
|
||||
unset(
|
||||
$update_data,
|
||||
$insert_data,
|
||||
$entry,
|
||||
$entity_array
|
||||
);
|
@@ -1093,7 +1093,7 @@ function discovery_process(&$valid, $device, $sensor_type, $pre_cache)
|
||||
}
|
||||
|
||||
echo "Cur $value, Low: $low_limit, Low Warn: $low_warn_limit, Warn: $warn_limit, High: $high_limit".PHP_EOL;
|
||||
$entPhysicalIndex = str_replace('{{ $index }}', $index, $data['entPhysicalIndex']) ?: null;
|
||||
$entPhysicalIndex = YamlDiscovery::replaceValues('entPhysicalIndex', $index, null, $data, $pre_cache) ?: null;
|
||||
$entPhysicalIndex_measured = isset($data['entPhysicalIndex_measured']) ? $data['entPhysicalIndex_measured'] : null;
|
||||
|
||||
$sensor_name = $device['os'];
|
||||
|
@@ -1,66 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* LibreNMS Interface Power dBm module for the MRV® OptiDriver® Optical Transport Platform
|
||||
*
|
||||
* © 2017 Chris A. Evans <thecityofguanyu@outlook.com>
|
||||
*
|
||||
* 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 'MRV OptiDriver ';
|
||||
|
||||
$multiplier = 1;
|
||||
$divisor = 1000;
|
||||
|
||||
foreach ($pre_cache['mrv-od_port-table'] as $index => $entry) {
|
||||
if ($entry['nbsCmmcPortRxPower']) {
|
||||
$oid = '.1.3.6.1.4.1.629.200.8.1.1.32.' . $index;
|
||||
$descr = dbFetchCell('SELECT `ifDescr` FROM `ports` WHERE `ifName`= ? AND `device_id` = ?', [$index, $device['device_id']]) . ' Rx Power';
|
||||
$currentrx = $entry['nbsCmmcPortRxPower'];
|
||||
discover_sensor(
|
||||
$valid['sensor'],
|
||||
'dbm',
|
||||
$device,
|
||||
$oid,
|
||||
'nbsCmmcPortRxPower.'.$index,
|
||||
'mrv-od',
|
||||
$descr,
|
||||
$divisor,
|
||||
$multiplier,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
$currentrx,
|
||||
'snmp'
|
||||
);
|
||||
}
|
||||
|
||||
if ($entry['nbsCmmcPortTxPower']) {
|
||||
$oid = '.1.3.6.1.4.1.629.200.8.1.1.31.' . $index;
|
||||
$descr = dbFetchCell('SELECT `ifDescr` FROM `ports` WHERE `ifName`= ? AND `device_id` = ?', [$index, $device['device_id']]) . ' Tx Power';
|
||||
$currenttx = $entry['nbsCmmcPortTxPower'];
|
||||
discover_sensor(
|
||||
$valid['sensor'],
|
||||
'dbm',
|
||||
$device,
|
||||
$oid,
|
||||
'nbsCmmcPortTxPower.'.$index,
|
||||
'mrv-od',
|
||||
$descr,
|
||||
$divisor,
|
||||
$multiplier,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
$currenttx,
|
||||
'snmp'
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* LibreNMS Sensor pre-cache module for the MRV® OptiDriver® Optical Transport Platform
|
||||
*
|
||||
* © 2017 Chris A. Evans <thecityofguanyu@outlook.com>
|
||||
*
|
||||
* 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 'Caching nbsCmmcPortTable and NbsCmmcChassisEntry for MRV OptiDriver ';
|
||||
$pre_cache['mrv-od_port-table'] = snmpwalk_cache_multi_oid($device, 'nbsCmmcPortTable', [], 'NBS-CMMC-MIB');
|
||||
$pre_cache['mrv-od_chassis-entry'] = snmpwalk_cache_multi_oid($device, 'NbsCmmcChassisEntry', [], 'NBS-CMMC-MIB');
|
@@ -1,114 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Sensor State discovery module for the MRV® OptiDriver® Optical Transport Platform
|
||||
*
|
||||
* © 2017 Chris A. Evans <thecityofguanyu@outlook.com>
|
||||
*
|
||||
* 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 "MRV OptiDriver";
|
||||
|
||||
foreach ($pre_cache['mrv-od_port-table'] as $index => $entry) {
|
||||
// Common Rx/Tx States
|
||||
$states = [
|
||||
['value' => 1, 'generic' => 3, 'graph' => 0, 'descr' => 'notSupported'],
|
||||
['value' => 2, 'generic' => 2, 'graph' => 0, 'descr' => 'lowAlarm'],
|
||||
['value' => 3, 'generic' => 1, 'graph' => 0, 'descr' => 'lowWarning'],
|
||||
['value' => 4, 'generic' => 0, 'graph' => 0, 'descr' => 'ok'],
|
||||
['value' => 5, 'generic' => 1, 'graph' => 0, 'descr' => 'highWarning'],
|
||||
['value' => 6, 'generic' => 2, 'graph' => 0, 'descr' => 'highAlarm'],
|
||||
];
|
||||
|
||||
// RX Interface Power State
|
||||
if ($entry['nbsCmmcPortRxPowerLevel']) {
|
||||
$cur_oid = '.1.3.6.1.4.1.629.200.8.1.1.66.';
|
||||
//Create State Index
|
||||
$state_name = 'nbsCmmcPortRxPowerLevel';
|
||||
create_state_index($state_name, $states);
|
||||
|
||||
$descr = dbFetchCell('SELECT `ifDescr` FROM `ports` WHERE `ifName`= ? AND `device_id` = ?', [$index, $device['device_id']]) . ' Rx Power State';
|
||||
//Discover Sensors
|
||||
discover_sensor($valid['sensor'], 'state', $device, $cur_oid.$index, $index, $state_name, $descr, 1, 1, null, null, null, null, $entry['nbsCmmcPortRxPowerLevel'], 'snmp', $index);
|
||||
//Create Sensor To State Index
|
||||
create_sensor_to_state_index($device, $state_name, $index);
|
||||
}
|
||||
// TX Interface Power State
|
||||
if ($entry['nbsCmmcPortTxPowerLevel']) {
|
||||
$cur_oid = '.1.3.6.1.4.1.629.200.8.1.1.65.';
|
||||
//Create State Index
|
||||
$state_name = 'nbsCmmcPortTxPowerLevel';
|
||||
create_state_index($state_name, $states);
|
||||
|
||||
$descr = dbFetchCell('SELECT `ifDescr` FROM `ports` WHERE `ifName`= ? AND `device_id` = ?', [$index, $device['device_id']]) . ' Tx Power State';
|
||||
//Discover Sensors
|
||||
discover_sensor($valid['sensor'], 'state', $device, $cur_oid.$index, $index, $state_name, $descr, 1, 1, null, null, null, null, $entry['nbsCmmcPortTxPowerLevel'], 'snmp', $index);
|
||||
//Create Sensor To State Index
|
||||
create_sensor_to_state_index($device, $state_name, $index);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($pre_cache['mrv-od_chassis-entry'] as $index => $entry) {
|
||||
// Common Power Supply States
|
||||
$states = [
|
||||
['value' => 1, 'generic' => 1, 'graph' => 0, 'descr' => 'notInstalled'],
|
||||
['value' => 2, 'generic' => 2, 'graph' => 0, 'descr' => 'acBad'],
|
||||
['value' => 3, 'generic' => 2, 'graph' => 0, 'descr' => 'dcBad'],
|
||||
['value' => 4, 'generic' => 0, 'graph' => 0, 'descr' => 'acGood'],
|
||||
['value' => 5, 'generic' => 0, 'graph' => 0, 'descr' => 'dcGood'],
|
||||
['value' => 6, 'generic' => 3, 'graph' => 0, 'descr' => 'notSupported'],
|
||||
['value' => 7, 'generic' => 0, 'graph' => 0, 'descr' => 'good'],
|
||||
['value' => 8, 'generic' => 2, 'graph' => 0, 'descr' => 'bad'],
|
||||
];
|
||||
|
||||
$powerSupplies = [
|
||||
['entity' => 'nbsCmmcChassisPS1Status', 'num_oid' => '.1.3.6.1.4.1.629.200.6.1.1.7.1', 'descr' => 'Power Supply 1'],
|
||||
['entity' => 'nbsCmmcChassisPS2Status', 'num_oid' => '.1.3.6.1.4.1.629.200.6.1.1.8.1', 'descr' => 'Power Supply 2'],
|
||||
['entity' => 'nbsCmmcChassisPS3Status', 'num_oid' => '.1.3.6.1.4.1.629.200.6.1.1.9.1', 'descr' => 'Power Supply 3'],
|
||||
['entity' => 'nbsCmmcChassisPS4Status', 'num_oid' => '.1.3.6.1.4.1.629.200.6.1.1.10.1', 'descr' => 'Power Supply 4'],
|
||||
];
|
||||
|
||||
foreach ($powerSupplies as $psu) {
|
||||
if ($entry[$psu['entity']]) {
|
||||
//Create State Index
|
||||
$state_name = $psu['entity'];
|
||||
create_state_index($state_name, $states);
|
||||
|
||||
$cur_oid = $psu['num_oid'];
|
||||
$descr = $psu['descr'];
|
||||
|
||||
//Discover Sensors
|
||||
discover_sensor($valid['sensor'], 'state', $device, $cur_oid, $index, $state_name, $descr, 1, 1, null, null, null, null, $oids[$state_name], 'snmp', 1);
|
||||
//Create Sensor To State Index
|
||||
create_sensor_to_state_index($device, $state_name, $index);
|
||||
}
|
||||
}
|
||||
|
||||
$fans = [
|
||||
['entity' => 'nbsCmmcChassisFan1Status', 'num_oid' => '.1.3.6.1.4.1.629.200.6.1.1.11.1', 'descr' => 'Fan 1'],
|
||||
['entity' => 'nbsCmmcChassisFan2Status', 'num_oid' => '.1.3.6.1.4.1.629.200.6.1.1.12.1', 'descr' => 'Fan 2'],
|
||||
['entity' => 'nbsCmmcChassisFan3Status', 'num_oid' => '.1.3.6.1.4.1.629.200.6.1.1.13.1', 'descr' => 'Fan 3'],
|
||||
['entity' => 'nbsCmmcChassisFan4Status', 'num_oid' => '.1.3.6.1.4.1.629.200.6.1.1.14.1', 'descr' => 'Fan 4'],
|
||||
];
|
||||
|
||||
foreach ($fans as $fan) {
|
||||
if ($entry[$psu['entity']]) {
|
||||
//Create State Index
|
||||
$state_name = $fan['entity'];
|
||||
create_state_index($state_name, $states);
|
||||
|
||||
$cur_oid = $fan['num_oid'];
|
||||
$descr = $fan['descr'];
|
||||
|
||||
//Discover Sensors
|
||||
discover_sensor($valid['sensor'], 'state', $device, $cur_oid, $index, $state_name, $descr, 1, 1, null, null, null, null, $oids[$state_name], 'snmp', 1);
|
||||
//Create Sensor To State Index
|
||||
create_sensor_to_state_index($device, $state_name, $index);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* LibreNMS Temperature Sensor Discovery module for the MRV® OptiDriver® Optical Transport Platform
|
||||
*
|
||||
* Copyright (c) 2017 Chris A. Evans <thecityofguanyu@outlook.com>
|
||||
*
|
||||
* 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("MRV OptiDriver:");
|
||||
// Chassis temperature
|
||||
$descr = "Chassis Temperature";
|
||||
$valueoid = ".1.3.6.1.4.1.629.200.6.1.1.15.1";
|
||||
$value = snmp_get($device, 'nbsCmmcChassisTemperature.1', '-Ovqs', 'NBS-CMMC-MIB');
|
||||
if (is_numeric($value)) {
|
||||
discover_sensor($valid['sensor'], 'temperature', $device, $valueoid, 'nbsCmmcChassisTemperature.1', 'mrv-od', $descr, '1', '1', null, null, null, null, $value);
|
||||
}
|
@@ -12,9 +12,9 @@
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
$multi_get_array = snmp_get_multi($device, ['nbsCmmcChassisModel.1', 'nbsCmmcSysFwVers.0', 'nbsCmmcChassisSerialNum.1'], '-Ovqs', 'NBS-CMMC-MIB', $config['install_dir'].'/mibs/mrv');
|
||||
$hardware = $multi_get_array[1]['NBS-CMMC-MIB::nbsCmmcChassisModel'];
|
||||
$version = $multi_get_array[0]['NBS-CMMC-MIB::nbsCmmcSysFwVers'];
|
||||
$serial = $multi_get_array[1]['NBS-CMMC-MIB::nbsCmmcChassisSerialNum'];
|
||||
$multi_get_array = snmp_get_multi($device, ['nbsCmmcChassisModel.1', 'nbsCmmcSysFwVers.0', 'nbsCmmcChassisSerialNum.1'], '-OQUs', 'NBS-CMMC-MIB', $config['install_dir'].'/mibs/mrv');
|
||||
$hardware = $multi_get_array[1]['nbsCmmcChassisModel'];
|
||||
$version = $multi_get_array[0]['nbsCmmcSysFwVers'];
|
||||
$serial = $multi_get_array[1]['nbsCmmcChassisSerialNum'];
|
||||
$features = '';
|
||||
unset($multi_get_array);
|
||||
|
@@ -1708,7 +1708,7 @@ function get_units_from_sensor($sensor)
|
||||
case 'state':
|
||||
return '#';
|
||||
case 'temperature':
|
||||
return 'C';
|
||||
return '°C';
|
||||
case 'voltage':
|
||||
return 'V';
|
||||
default:
|
||||
|
4089
tests/data/mrv-od.json
Normal file
4089
tests/data/mrv-od.json
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user