diff --git a/includes/discovery/functions.inc.php b/includes/discovery/functions.inc.php index 74a9cc0206..6ff6886896 100644 --- a/includes/discovery/functions.inc.php +++ b/includes/discovery/functions.inc.php @@ -1047,9 +1047,13 @@ function discovery_process(&$valid, $device, $sensor_type, $pre_cache) $limits = ['low_limit', 'low_warn_limit', 'warn_limit', 'high_limit']; foreach ($limits as $limit) { - $$limit = is_numeric($data[$limit]) ? $data[$limit] : dynamic_discovery_get_value($limit, $index, $data, $pre_cache, 'null'); - if (is_numeric($$limit)) { - $$limit = ($$limit / $divisor) * $multiplier; + if (is_numeric($data[$limit])) { + $$limit = $data[$limit]; + } else { + $$limit = dynamic_discovery_get_value($limit, $index, $data, $pre_cache, 'null'); + if (is_numeric($$limit)) { + $$limit = ($$limit / $divisor) * $multiplier; + } } } diff --git a/tests/data/routeros.json b/tests/data/routeros.json index 6117105ab9..95ecb12828 100644 --- a/tests/data/routeros.json +++ b/tests/data/routeros.json @@ -2704,10 +2704,10 @@ "sensor_divisor": "10", "sensor_multiplier": "1", "sensor_current": "33", - "sensor_limit": "7", - "sensor_limit_warn": "6.5", - "sensor_limit_low": "-4", - "sensor_limit_low_warn": "-3.5", + "sensor_limit": "70", + "sensor_limit_warn": "65", + "sensor_limit_low": "-40", + "sensor_limit_low_warn": "-35", "sensor_alert": "1", "sensor_custom": "No", "entPhysicalIndex": null, @@ -3074,10 +3074,10 @@ "sensor_divisor": "10", "sensor_multiplier": "1", "sensor_current": "33", - "sensor_limit": "7", - "sensor_limit_warn": "6.5", - "sensor_limit_low": "-4", - "sensor_limit_low_warn": "-3.5", + "sensor_limit": "70", + "sensor_limit_warn": "65", + "sensor_limit_low": "-40", + "sensor_limit_low_warn": "-35", "sensor_alert": "1", "sensor_custom": "No", "entPhysicalIndex": null, @@ -4274,5 +4274,17 @@ } ] } + }, + "bgp-peers": { + "discovery": { + "devices": [ + { + "bgpLocalAs": null + } + ], + "bgpPeers": [], + "bgpPeers_cbgp": [] + }, + "poller": "matches discovery" } }