Add and extend support for Hirshmann devices (#15588)

* Added models in hirshmann definition file
* Added Hirschmann_ms4128.snmprec to ~/tests/snmpsim
* Generic SysObjectID
* Some devices are not replying with all the table data
* fix tests accordingly
* add more sensors
* Move Temperature to YAML

Discovery and polling are currently buggy, this will fix it and make it capable of handling more than one temp sensor.
History of temperatures will be lost here.

---------

Co-authored-by: PipoCanaja <38363551+PipoCanaja@users.noreply.github.com>
This commit is contained in:
Christophe Guillaumie
2023-12-04 19:33:30 +01:00
committed by GitHub
parent b0a355e8ba
commit 21ccfa4096
8 changed files with 5932 additions and 73 deletions

View File

@@ -8,11 +8,62 @@ modules:
descr: 'Main Memory'
precision: 1024
os:
hardware: HMPRIV-MGMT-SNMP-MIB::hmPNIOOrderID.0
version: HMPRIV-MGMT-SNMP-MIB::hmPNIOSoftwareRelease.0
hardware:
- HMPRIV-MGMT-SNMP-MIB::hmPNIOOrderID.0
- HMPRIV-MGMT-SNMP-MIB::hmSysGroupDescription.1
version:
- HMPRIV-MGMT-SNMP-MIB::hmPNIOSoftwareRelease.0
- HMPRIV-MGMT-SNMP-MIB::hmSysVersion.0
serial: HMPRIV-MGMT-SNMP-MIB::hmSysGroupSerialNum.1
processors:
data:
-
oid: hmCpuUtilization
num_oid: '.1.3.6.1.4.1.248.14.2.15.2.1.{{ $index }}'
sensors:
temperature:
data:
-
oid: hmSFPTable
value: hmSfpTemperature
index: 'hmSfpTemperature{{ $index }}'
group: SFP
num_oid: '.1.3.6.1.4.1.248.14.1.1.13.1.12.{{ $index }}'
descr: 'Temperature {{ $hmSfpInfoPartId }} {{ $subindex0 }}/{{ $subindex1 }}'
-
oid: hmTempTable
value: hmTemperature
index: '{{ $index }}'
num_oid: '.1.3.6.1.4.1.248.14.2.5.1.{{ $index }}'
descr: 'Temperature {{ $index }}'
low_limit: hmTempLwrLimit
high_limit: hmTempUprLimit
dbm:
data:
-
oid: hmSFPTable
value: hmSfpTxPowerdBm
index: 'hmSfpTxPowerdBm{{ $index }}'
group: 'SFP {{ $subindex0 }}/{{ $subindex1 }}'
descr: 'Power TX {{ $hmSfpInfoPartId }} {{ $subindex0 }}/{{ $subindex1 }}'
num_oid: '.1.3.6.1.4.1.248.14.1.1.13.1.34.{{ $index }}'
-
oid: hmSFPTable
value: hmSfpRxPowerdBm
index: 'hmSfpRxPowerdBm{{ $index }}'
group: 'SFP {{ $subindex0 }}/{{ $subindex1 }}'
descr: 'Power RX {{ $hmSfpInfoPartId }} {{ $subindex0 }}/{{ $subindex1 }}'
num_oid: '.1.3.6.1.4.1.248.14.1.1.13.1.35.{{ $index }}'
state:
data:
-
oid: hmRS2OperMode
num_oid: '.1.3.6.1.4.1.248.14.1.10.1.{{ $index }}'
descr: 'Operation Mode {{ $index }}'
state_name: hmRS2OperMode
states:
- { descr: normal, graph: 1, value: 1, generic: 0 }
- { descr: standby-active, graph: 1, value: 2, generic: 0 }
- { descr: standby-inactive, graph: 1, value: 3, generic: 3 }
- { descr: redundancy-manager-active, graph: 1, value: 4, generic: 0 }
- { descr: redundancy-manager-inactive, graph: 1, value: 5, generic: 3 }

View File

@@ -1,5 +1,5 @@
os: hirschmann
text: 'Hirschmann Railswitch'
text: 'Hirschmann'
type: network
icon: hirschmann
over:
@@ -9,4 +9,4 @@ over:
discovery:
-
sysObjectID:
- .1.3.6.1.4.1.248.14.10.41
- .1.3.6.1.4.1.248.14.10

View File

@@ -20,7 +20,7 @@ if ($device['os'] == 'hirschmann') {
foreach ($oid as $index => $entry) {
//Discover Sensors
discover_sensor($valid['sensor'], 'state', $device, $cur_oid . $index, 'hmPowerSupplyStatus' . $index, $state_name, 'Power Supply ' . $oid[$index]['hmPSID'], 1, 1, null, null, null, null, $oid[$index]['hmPowerSupplyStatus'] ?? null, 'snmp', 'hmPowerSupplyStatus' . $index);
discover_sensor($valid['sensor'], 'state', $device, $cur_oid . $index, 'hmPowerSupplyStatus' . $index, $state_name, 'Power Supply ' . (isset($entry['hmPSID']) ? $entry['hmPSID'] : $index), 1, 1, null, null, null, null, $entry['hmPowerSupplyStatus'] ?? null, 'snmp', 'hmPowerSupplyStatus' . $index);
//Create Sensor To State Index
create_sensor_to_state_index($device, $state_name, 'hmPowerSupplyStatus' . $index);

View File

@@ -1,31 +0,0 @@
<?php
if ($device['os'] == 'hirschmann') {
echo 'Hirschmann Device: ';
$descr = 'Temperature';
$temperature = snmp_get($device, 'HMPRIV-MGMT-SNMP-MIB::hmTemperature.0', '-Oqv');
$temperature_high = snmp_get($device, 'HMPRIV-MGMT-SNMP-MIB::hmTempUprLimit.0', '-Oqv');
$temperature_low = snmp_get($device, 'HMPRIV-MGMT-SNMP-MIB::hmTempLwrLimit.0', '-Oqv');
$temperature_low_warn = $temperature_low + 10;
$temperature_high_warn = $temperature_high - 10;
if ($descr != '' && is_numeric($temperature)) {
discover_sensor(
$valid['sensor'],
'temperature',
$device,
'HMPRIV-MGMT-SNMP-MIB::hmTemperature.0',
'1',
'hirschmann',
$descr,
'1',
'1',
$temperature_low,
$temperature_low_warn,
$temperature_high_warn,
$temperature_high,
$temperature
);
}
}

View File

@@ -1,7 +0,0 @@
<?php
if ($device['os'] == 'hirschmann') {
echo 'Hirschmann Device: ';
$sensor_value = snmp_get($device, 'HMPRIV-MGMT-SNMP-MIB::hmTemperature.0', '-Oqv');
}

View File

@@ -1982,8 +1982,8 @@
"ifName": "1/1/1",
"portName": null,
"ifIndex": 1,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "true",
"ifOperStatus": "down",
"ifOperStatus_prev": "down",
@@ -2082,8 +2082,8 @@
"ifName": "1/1/2",
"portName": null,
"ifIndex": 2,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "true",
"ifOperStatus": "down",
"ifOperStatus_prev": "down",
@@ -2382,8 +2382,8 @@
"ifName": "1/1/5",
"portName": null,
"ifIndex": 5,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "true",
"ifOperStatus": "down",
"ifOperStatus_prev": "down",
@@ -2482,8 +2482,8 @@
"ifName": "1/1/6",
"portName": null,
"ifIndex": 6,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "true",
"ifOperStatus": "down",
"ifOperStatus_prev": "down",
@@ -2582,8 +2582,8 @@
"ifName": "1/1/7",
"portName": null,
"ifIndex": 7,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "true",
"ifOperStatus": "down",
"ifOperStatus_prev": "down",
@@ -2682,8 +2682,8 @@
"ifName": "1/1/8",
"portName": null,
"ifIndex": 8,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "true",
"ifOperStatus": "down",
"ifOperStatus_prev": "down",
@@ -2782,8 +2782,8 @@
"ifName": "1/1/9",
"portName": null,
"ifIndex": 9,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "true",
"ifOperStatus": "down",
"ifOperStatus_prev": "down",
@@ -2982,8 +2982,8 @@
"ifName": "1/1/11",
"portName": null,
"ifIndex": 11,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "true",
"ifOperStatus": "down",
"ifOperStatus_prev": "down",
@@ -3082,8 +3082,8 @@
"ifName": "1/1/12",
"portName": null,
"ifIndex": 12,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "true",
"ifOperStatus": "down",
"ifOperStatus_prev": "down",
@@ -3782,8 +3782,8 @@
"ifName": "CPU Interface: 1/4/1",
"portName": null,
"ifIndex": 53,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "true",
"ifOperStatus": "up",
"ifOperStatus_prev": "up",
@@ -4032,18 +4032,18 @@
"sensor_deleted": 0,
"sensor_class": "temperature",
"poller_type": "snmp",
"sensor_oid": "HMPRIV-MGMT-SNMP-MIB::hmTemperature.0",
"sensor_index": "1",
"sensor_oid": ".1.3.6.1.4.1.248.14.2.5.1.0",
"sensor_index": "0",
"sensor_type": "hirschmann",
"sensor_descr": "Temperature",
"sensor_descr": "Temperature 0",
"group": null,
"sensor_divisor": 1,
"sensor_multiplier": 1,
"sensor_current": 43,
"sensor_limit": 70,
"sensor_limit_warn": 60,
"sensor_limit_warn": null,
"sensor_limit_low": 0,
"sensor_limit_low_warn": 10,
"sensor_limit_low_warn": null,
"sensor_alert": 1,
"sensor_custom": "No",
"entPhysicalIndex": null,
@@ -4353,18 +4353,18 @@
"sensor_deleted": 0,
"sensor_class": "temperature",
"poller_type": "snmp",
"sensor_oid": "HMPRIV-MGMT-SNMP-MIB::hmTemperature.0",
"sensor_index": "1",
"sensor_oid": ".1.3.6.1.4.1.248.14.2.5.1.0",
"sensor_index": "0",
"sensor_type": "hirschmann",
"sensor_descr": "Temperature",
"sensor_descr": "Temperature 0",
"group": null,
"sensor_divisor": 1,
"sensor_multiplier": 1,
"sensor_current": 43,
"sensor_limit": 70,
"sensor_limit_warn": 60,
"sensor_limit_warn": null,
"sensor_limit_low": 0,
"sensor_limit_low_warn": 10,
"sensor_limit_low_warn": null,
"sensor_alert": 1,
"sensor_custom": "No",
"entPhysicalIndex": null,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff