From fde6ef5f3f5a62325c01c71760d9c321ea69960f Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Sat, 12 Sep 2020 16:26:20 -0500 Subject: [PATCH] fix skip_value_lt plurality confusion (#12056) * fix skip_value_lt plurality confusion * Update atenpdu.yaml --- LibreNMS/Device/YamlDiscovery.php | 4 ++-- doc/Developing/os/Health-Information.md | 2 +- includes/definitions/discovery/harmony-enhanced.yaml | 3 +-- includes/definitions/discovery/ibmc.yaml | 6 ++---- includes/definitions/discovery/janitza.yaml | 2 +- includes/definitions/discovery/netgear.yaml | 2 -- includes/definitions/discovery/powerwalker.yaml | 9 +++------ includes/definitions/discovery/zynos.yaml | 6 ++---- misc/discovery_schema.json | 5 ++++- 9 files changed, 16 insertions(+), 23 deletions(-) diff --git a/LibreNMS/Device/YamlDiscovery.php b/LibreNMS/Device/YamlDiscovery.php index 5840f1cc6d..a36f98594b 100644 --- a/LibreNMS/Device/YamlDiscovery.php +++ b/LibreNMS/Device/YamlDiscovery.php @@ -260,10 +260,10 @@ class YamlDiscovery foreach ($skip_values as $skip_value) { if (is_array($skip_value) && $pre_cache) { // Dynamic skipping of data - $op = isset($skip_value['op']) ? $skip_value['op'] : '!='; + $op = $skip_value['op'] ?? '!='; $tmp_value = static::getValueFromData($skip_value['oid'], $index, $yaml_item_data, $pre_cache); if (Str::contains($skip_value['oid'], '.')) { - list($skip_value['oid'], $targeted_index) = explode('.', $skip_value['oid'], 2); + [$skip_value['oid'], $targeted_index] = explode('.', $skip_value['oid'], 2); $tmp_value = static::getValueFromData($skip_value['oid'], $targeted_index, $yaml_item_data, $pre_cache); } if (compare_var($tmp_value, $skip_value['value'], $op)) { diff --git a/doc/Developing/os/Health-Information.md b/doc/Developing/os/Health-Information.md index d034a21116..c7abf6ef4a 100644 --- a/doc/Developing/os/Health-Information.md +++ b/doc/Developing/os/Health-Information.md @@ -62,7 +62,7 @@ modules: sensors: airflow: options: - skip_values_lt: 0 + skip_value_lt: 0 data: - oid: airFlowSensorTable diff --git a/includes/definitions/discovery/harmony-enhanced.yaml b/includes/definitions/discovery/harmony-enhanced.yaml index 90cb993440..80a47d55b4 100644 --- a/includes/definitions/discovery/harmony-enhanced.yaml +++ b/includes/definitions/discovery/harmony-enhanced.yaml @@ -2,14 +2,13 @@ mib: MWR-ETHERNET-MIB:MWR-RADIO-MC-MIB modules: sensors: temperature: - options: - skip_values_lt: 0 data: - oid: mwrSystemTemperature num_oid: '.1.3.6.1.4.1.7262.4.5.2.2.3.{{ $index }}' descr: 'Current System Temperature' index: 'mwrSystemTemperature.{{ $index }}' + skip_value_lt: 0 state: data: - diff --git a/includes/definitions/discovery/ibmc.yaml b/includes/definitions/discovery/ibmc.yaml index 8080c5c344..a579f7a830 100644 --- a/includes/definitions/discovery/ibmc.yaml +++ b/includes/definitions/discovery/ibmc.yaml @@ -9,22 +9,20 @@ modules: descr: 'Main(s) CPU average usage' sensors: fanspeed: - options: - skip_values_lt: 0 data: - oid: fanDescriptionEntry value: fanSpeed + skip_value_lt: 0 num_oid: '.1.3.6.1.4.1.2011.2.235.1.1.8.50.1.2.{{ $index }}' descr: 'fanDevicename' index: 'fanSpeed.{{ $index }}' power: - options: - skip_values_lt: 0 data: - oid: powerSupplyDescriptionEntry value: powerSupplyInputPower + skip_value_lt: 0 num_oid: '.1.3.6.1.4.1.2011.2.235.1.1.6.50.1.8.{{ $index }}' descr: 'Power Supply {{ $index }} Input' index: 'powerSupplyIndex.{{ $index }}' diff --git a/includes/definitions/discovery/janitza.yaml b/includes/definitions/discovery/janitza.yaml index dfbea1644a..f1c21a38e2 100644 --- a/includes/definitions/discovery/janitza.yaml +++ b/includes/definitions/discovery/janitza.yaml @@ -9,7 +9,7 @@ modules: voltage: options: divisor: 10 - skip_values_lt: 40 + skip_value_lt: 40 data: - oid: uLN1 diff --git a/includes/definitions/discovery/netgear.yaml b/includes/definitions/discovery/netgear.yaml index 5f49f60bfe..b7b25a119b 100644 --- a/includes/definitions/discovery/netgear.yaml +++ b/includes/definitions/discovery/netgear.yaml @@ -8,8 +8,6 @@ modules: - boxServicesNormalTempRangeMin - boxServicesNormalTempRangeMax temperature: - options: - skip_values_lt: 0 data: - oid: boxServicesTempSensorsTable diff --git a/includes/definitions/discovery/powerwalker.yaml b/includes/definitions/discovery/powerwalker.yaml index 575a75ddc6..96fa517787 100644 --- a/includes/definitions/discovery/powerwalker.yaml +++ b/includes/definitions/discovery/powerwalker.yaml @@ -10,7 +10,6 @@ modules: descr: Battery time remaining voltage: options: - skip_values_lt: 0 divisor: 10 data: - @@ -67,7 +66,6 @@ modules: descr: Module Negative Charge frequency: options: - skip_values_lt: 0 divisor: 10 data: - @@ -97,7 +95,6 @@ modules: descr: Battery charge remaining temperature: options: - skip_values_lt: 0 divisor: 10 data: - @@ -132,7 +129,7 @@ modules: high_limit: upsEEnvironmentTemperatureHighSetPoint current: options: - skip_values_lt: 0 + skip_value_lt: 0 divisor: 10 data: - @@ -167,7 +164,7 @@ modules: descr: Negative Charge humidity: options: - skip_values_lt: 0 + skip_value_lt: 0 data: - oid: upsEEnvironmentHumidity @@ -177,7 +174,7 @@ modules: descr: Environment Current power: options: - skip_values_lt: 0 + skip_value_lt: 0 data: - oid: upsESystemInputTable diff --git a/includes/definitions/discovery/zynos.yaml b/includes/definitions/discovery/zynos.yaml index 29f3e972b5..b622906ecf 100644 --- a/includes/definitions/discovery/zynos.yaml +++ b/includes/definitions/discovery/zynos.yaml @@ -23,7 +23,7 @@ modules: sensors: fanspeed: options: - skip_values_lt: 0 + skip_value_lt: 0 data: - oid: zyxelHwMonitorFanRpmTable @@ -43,8 +43,6 @@ modules: index: 'fanRpmCurValue.{{ $index }}' low_limit: fanRpmLowThresh temperature: - options: - skip_values_lt: 0 data: - oid: zyxelHwMonitorTemperatureTable @@ -84,7 +82,7 @@ modules: value: 'Temperature' voltage: options: - skip_values_lt: 0 + skip_value_lt: 0 divisor: 1000 data: - diff --git a/misc/discovery_schema.json b/misc/discovery_schema.json index 727a1f1b05..017d55c5b3 100644 --- a/misc/discovery_schema.json +++ b/misc/discovery_schema.json @@ -442,7 +442,10 @@ } ] }, - "skip_values_lt": { + "skip_value_gt": { + "type": "integer" + }, + "skip_value_lt": { "type": "integer" } },