bug: Fixed high/low calculations (#8603)

* changed limit values in routeros.yaml to allow for the divisor value of 10

* changed the code so divisor/multiplier is only used for oids

* updated json test file
This commit is contained in:
Tom Sealey
2018-04-23 21:30:13 +01:00
committed by Neil Lathwood
co-authored by Neil Lathwood
parent fa035be4c9
commit ecfdb681a9
2 changed files with 27 additions and 11 deletions
+7 -3
View File
@@ -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;
}
}
}
+20 -8
View File
@@ -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"
}
}