devices - Ciena RLS 6500 (#15909)

* rls definition
* Adding discovery
* Temp Sensor Discovery
* files for discovery
* Adding and updating MIBS
* Add snmpsim
* Modified yaml for unit test
* phpfmt format
* ci changes
* fixing temp sensor
* fix json
* db schema out of date causing bad snmpsim json
* changed temperature discovery to php
* With updated snmpsim data
* index_string restored, YAML for temperature
* style
* Fixed index_string usage in JUNOS files
* Update YamlDiscovery.php
Allow filtering on "index" in skip_values
* Move DBM to YAML as well
* style
* schema update
* Slot XX Yyyyyy
remove unwanted dot
* matching tests
* schema, round 2
* states in YAML
* put temp sensor back in yaml
* enable default poll and discovery modules
---------

Co-authored-by: PipoCanaja <38363551+PipoCanaja@users.noreply.github.com>
This commit is contained in:
Heath Barnhart
2024-04-01 11:52:03 -05:00
committed by GitHub
parent af2f953c7f
commit d457f92f22
17 changed files with 19710 additions and 152 deletions

View File

@@ -0,0 +1,11 @@
os: ciena-rls
text: 'Ciena Reconfigurable Line System'
icon: ciena
over:
- { graph: device_bits, text: Traffic }
type: network
mib_dir: ciena
discovery:
-
sysObjectID:
- .1.3.6.1.4.1.1271.1.2.12

View File

@@ -0,0 +1,128 @@
mib: CIENA-PRO-SOFTWARE-MIB:CIENA-6500R-INVENTORY-MIB:CIENA-6500R-INVENTORY-AMPS-MIB
modules:
os:
hardware: SNMPv2-MIB::sysDescr.0
version: CIENA-PRO-SOFTWARE-MIB::cienaProSoftwareRunningVersion.0
sensors:
pre-cache:
data:
-
oid:
- rlsCircuitPackCtype
temperature:
data:
-
oid: rlsCircuitPackCurrTemprature
num_oid: '.1.3.6.1.4.1.1271.4.1.1.1.1.1.1.29.{{ $index_string }}'
index: 'rlsCircuitPackCurrTemprature.{{ $index_string }}'
descr: '{{ $rlsCircuitPackCtype }} Slot {{ $index }}'
state:
data:
-
oid: rlsInventoryAmpsTable
value: rlsInventoryAmpsAmpMode
num_oid: '.1.3.6.1.4.1.1271.4.1.1.1.2.1.1.1.3.{{ $index_string }}'
index: 'rlsInventoryAmpsAmpMode.{{ $index_string }}'
descr: 'Slot {{ $subindex0 }} {{ $subindex1 }}'
group: 'Amplifier Mode'
state_name: rlsInventoryAmpsAmpMode
states:
- { descr: Power, graph: 0, value: 1, generic: 0 }
- { descr: Gain, graph: 0, value: 2, generic: 0 }
- { descr: GainClamp, graph: 0, value: 3, generic: 0 }
-
oid: rlsInventoryAmpsTable
value: rlsInventoryAmpsState
num_oid: '.1.3.6.1.4.1.1271.4.1.1.1.2.1.1.1.4.{{ $index_string }}'
index: 'rlsInventoryAmpsState.{{ $index_string }}'
descr: 'Slot {{ $subindex0 }} {{ $subindex1 }}'
group: 'Amplifier State'
state_name: rlsInventoryAmpsState
states:
- { descr: Unknown, graph: 0, value: 0, generic: 3 }
- { descr: Off, graph: 0, value: 1, generic: 1 }
- { descr: APR, graph: 0, value: 2, generic: 1 }
- { descr: Normal, graph: 0, value: 3, generic: 0 }
- { descr: Clamped, graph: 0, value: 4, generic: 0 }
-
oid: rlsInventoryAmpsTable
value: rlsInventoryAmpsGainMode
num_oid: '.1.3.6.1.4.1.1271.4.1.1.1.2.1.1.1.5.{{ $index_string }}'
index: 'rlsInventoryAmpsGainMode.{{ $index_string }}'
descr: 'Slot {{ $subindex0 }} {{ $subindex1 }}'
group: 'Amplifier Gain Mode'
state_name: rlsInventoryAmpsGainMode
states:
- { descr: Low, graph: 0, value: 1, generic: 0 }
- { descr: High, graph: 0, value: 2, generic: 0 }
-
oid: rlsInventoryAmpsTable
value: rlsInventoryAmpsForcedShutdown
num_oid: '.1.3.6.1.4.1.1271.4.1.1.1.2.1.1.1.6.{{ $index_string }}'
index: 'rlsInventoryAmpsForcedShutdown.{{ $index_string }}'
descr: 'Slot {{ $subindex0 }} {{ $subindex1 }}'
group: 'Amplifier Forced Shutdown State'
state_name: rlsInventoryAmpsForcedShutdown
states:
- { descr: Disabled, graph: 0, value: 1, generic: 0 }
- { descr: Enabled, graph: 0, value: 2, generic: 1 }
dbm:
data:
-
oid: rlsInventoryAmpsTable
value: rlsInventoryAmpsInCurrPower
num_oid: '.1.3.6.1.4.1.1271.4.1.1.1.2.1.1.1.48.{{ $index_string }}'
index: 'rlsInventoryAmpsInCurrPower.{{ $index_string }}'
descr: 'Slot {{ $subindex0 }} {{ $subindex1 }}'
group: 'Amplifier Input - Current'
low_limit: rlsInventoryAmpsInputLosThreshold
-
oid: rlsInventoryAmpsTable
value: rlsInventoryAmpsInMinPower
num_oid: '.1.3.6.1.4.1.1271.4.1.1.1.2.1.1.1.49.{{ $index_string }}'
index: 'rlsInventoryAmpsInMinPower.{{ $index_string }}'
descr: 'Slot {{ $subindex0 }} {{ $subindex1 }}'
group: 'Amplifier Input - Minimum'
-
oid: rlsInventoryAmpsTable
value: rlsInventoryAmpsInMaxPower
num_oid: '.1.3.6.1.4.1.1271.4.1.1.1.2.1.1.1.50.{{ $index_string }}'
index: 'rlsInventoryAmpsInMaxPower.{{ $index_string }}'
descr: 'Slot {{ $subindex0 }} {{ $subindex1 }}'
group: 'Amplifier Input - Maximum'
-
oid: rlsInventoryAmpsTable
value: rlsInventoryAmpsOutCurrPower
num_oid: '.1.3.6.1.4.1.1271.4.1.1.1.2.1.1.1.51.{{ $index_string }}'
index: 'rlsInventoryAmpsOutCurrPower.{{ $index_string }}'
descr: 'Slot {{ $subindex0 }} {{ $subindex1 }}'
group: 'Amplifier Output - Current'
-
oid: rlsInventoryAmpsTable
value: rlsInventoryAmpsOutMinPower
num_oid: '.1.3.6.1.4.1.1271.4.1.1.1.2.1.1.1.52.{{ $index_string }}'
index: 'rlsInventoryAmpsOutMinPower.{{ $index_string }}'
descr: 'Slot {{ $subindex0 }} {{ $subindex1 }}'
group: 'Amplifier Output - Minimum'
-
oid: rlsInventoryAmpsTable
value: rlsInventoryAmpsOutMaxPower
num_oid: '.1.3.6.1.4.1.1271.4.1.1.1.2.1.1.1.53.{{ $index_string }}'
index: 'rlsInventoryAmpsOutMaxPower.{{ $index_string }}'
descr: 'Slot {{ $subindex0 }} {{ $subindex1 }}'
group: 'Amplifier Output - Maximum'
-
oid: rlsInventoryAmpsTable
value: rlsInventoryAmpsOpticalReturnLoss
num_oid: '.1.3.6.1.4.1.1271.4.1.1.1.2.1.1.1.54.{{ $index_string }}'
index: 'rlsInventoryAmpsOpticalReturnLoss.{{ $index_string }}'
descr: 'Slot {{ $subindex0 }} {{ $subindex1 }}'
group: 'Amplifier Optical Return Loss'
low_warn_limit: rlsInventoryAmpsOrlThreshold
low_limit: rlsInventoryAmpsAprThreshold
skip_values:
-
oid: index
op: 'contains'
value: 'Pre-Amp'

View File

@@ -0,0 +1,77 @@
<?php
/**
* ciena-rls.inc.php
*
* -Description-
*
* Chassis inventory for a Ciena Reconfigurable Line System (RLS).
*
* 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 <https://www.gnu.org/licenses/>.
*
* Traps when Adva objects are created. This includes Remote User Login object,
* Flow Creation object, and LAG Creation object.
*
* @link https://www.librenms.org
*
* @copyright 2024 KanREN, Inc
* @author Heath Barnhart <hbarnhart@kanren.net>
*/
$entity_array = [];
$inventory = snmpwalk_cache_multi_oid($device, 'rlsCircuitPackTable', [], 'CIENA-6500R-INVENTORY-MIB');
foreach ($inventory as $inventory => $inventoryItems) {
$entity_array[] = [
'entPhysicalIndex' => $inventory, //need to derive index from the oid
'entPhysicalDescr' => $inventoryItems['rlsCircuitPackCtype'],
'entPhysicalName' => $inventoryItems['rlsCircuitPackCtype'],
'entPhysicalModelName' => $inventoryItems['rlsCircuitPackPec'],
'entPhysicalSerialNum' => $inventoryItems['rlsCircuitPackSerialNumber'],
'entPhysicalParentRelPos' => $inventory,
'entPhysicalMfgName' => 'Ciena',
'entPhysicalAlias' => $inventoryItems['rlsCircuitPackCommonLanguageEquipmentIndentifier'],
'entPhysicalHardwareRev' => $inventoryItems['rlsCircuitPackHardwareRelease'],
'entPhysicalIsFRU' => 'true',
];
}
foreach ($entity_array as $entPhysicalIndex => $entry) {
discover_entity_physical(
$valid,
$device,
array_key_exists('entPhysicalIndex', $entry) ? $entry['entPhysicalIndex'] : '',
array_key_exists('entPhysicalDescr', $entry) ? $entry['entPhysicalDescr'] : '',
array_key_exists('entPhysicalClass', $entry) ? $entry['entPhysicalClass'] : '',
array_key_exists('entPhysicalName', $entry) ? $entry['entPhysicalName'] : '',
array_key_exists('entPhysicalModelName', $entry) ? $entry['entPhysicalModelName'] : '',
array_key_exists('entPhysicalSerialNum', $entry) ? $entry['entPhysicalSerialNum'] : '',
array_key_exists('entPhysicalContainedIn', $entry) ? $entry['entPhysicalContainedIn'] : '',
array_key_exists('entPhysicalMfgName', $entry) ? $entry['entPhysicalMfgName'] : '',
array_key_exists('entPhysicalParentRelPos', $entry) ? $entry['entPhysicalParentRelPos'] : '',
array_key_exists('entPhysicalVendorType', $entry) ? $entry['entPhysicalVendorType'] : '',
array_key_exists('entPhysicalHardwareRev', $entry) ? $entry['entPhysicalHardwareRev'] : '',
array_key_exists('entPhysicalFirmwareRev', $entry) ? $entry['entPhysicalFirmwareRev'] : '',
array_key_exists('entPhysicalSoftwareRev', $entry) ? $entry['entPhysicalSoftwareRev'] : '',
array_key_exists('entPhysicalIsFRU', $entry) ? $entry['entPhysicalIsFRU'] : '',
array_key_exists('entPhysicalAlias', $entry) ? $entry['entPhysicalAlias'] : '',
array_key_exists('entPhysicalAssetID', $entry) ? $entry['entPhysicalAssetID'] : '',
array_key_exists('ifIndex', $entry) ? $entry['ifIndex'] : ''
);
}
echo "\n";
unset(
$inventory,
$entity_array
);

View File

@@ -996,10 +996,8 @@ function discovery_process(&$valid, $os, $sensor_class, $pre_cache)
if ($skippedFromYaml === false && is_numeric($value)) {
d_echo("Sensor fetched value: $value\n");
$oid = str_replace('{{ $index }}', $index, $data['num_oid']);
// if index is a string, we need to convert it to OID
// strlen($index) as first number, and each letter converted to a number, separated by dots
$oid = str_replace('{{ $index_string }}', strlen($index) . '.' . implode('.', unpack('c*', $index)), $oid);
// process the oid (num_oid will contain index or str2num replacement calls)
$oid = trim(YamlDiscovery::replaceValues('num_oid', $index, null, $data, []));
// process the description
$descr = trim(YamlDiscovery::replaceValues('descr', $index, null, $data, $pre_cache));