aboutsummaryrefslogtreecommitdiffstats
path: root/check-health
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2020-01-24 08:08:52 +0100
committerGravatar Christian Hesse <mail@eworm.de>2020-01-24 08:16:54 +0100
commit6e5e0e72bd695d0e7dd546a24c3afba31ab32cae (patch)
treedb7da48282814e651b2a37be67b70ab731cb4f81 /check-health
parent958bfa7ce8d57089b3d66b76eca1c7382f8b4119 (diff)
check-health: always calculate on the lower voltage value
This makes sure an alert is triggered in both directions. Before we could have: 24.0V to 21.8V -> OK 21.8V to 24.0V -> Alert!
Diffstat (limited to 'check-health')
-rw-r--r--check-health2
1 files changed, 1 insertions, 1 deletions
diff --git a/check-health b/check-health
index fb59740..95a92d7 100644
--- a/check-health
+++ b/check-health
@@ -22,7 +22,7 @@
:if ([ :typeof ($CheckHealthLast->$Voltage) ] = "num" && \
[ :typeof ($CheckHealthCurrent->$Voltage) ] = "num") do={
:if ($CheckHealthLast->$Voltage * (100 + $CheckHealthVoltagePercent) / 100 < $CheckHealthCurrent->$Voltage || \
- $CheckHealthLast->$Voltage * 100 / (100 + $CheckHealthVoltagePercent) > $CheckHealthCurrent->$Voltage) do={
+ $CheckHealthLast->$Voltage > $CheckHealthCurrent->$Voltage * (100 + $CheckHealthVoltagePercent) / 100) do={
$SendNotification ("Health warning: " . $Voltage) \
("The " . $Voltage . " on " . $Identity . " jumped more than " . $CheckHealthVoltagePercent . "%.\n\n" . \
"old value: " . [ $FormatVoltage ($CheckHealthLast->$Voltage) ] . "\n" . \