aboutsummaryrefslogtreecommitdiffstats
path: root/check-health
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2019-10-14 19:06:21 +0200
committerGravatar Christian Hesse <mail@eworm.de>2019-10-14 19:13:31 +0200
commitf40bb2c8c85adaa1ee84bb693b76a7a7e334f54a (patch)
tree4d27ef162d4705d52d15b4eff0fedb7e1c6783af /check-health
parent09ce75c5b10b61bd8fbc15c61895add2ac36f1a8 (diff)
check-health: make threshold for voltage configurablechange-10
Diffstat (limited to 'check-health')
-rw-r--r--check-health7
1 files changed, 4 insertions, 3 deletions
diff --git a/check-health b/check-health
index 8cfe47a..3b5c0de 100644
--- a/check-health
+++ b/check-health
@@ -6,6 +6,7 @@
:global CheckHealthLast;
:global CheckHealthTemperature;
+:global CheckHealthVoltagePercent;
:global Identity;
:global SendNotification;
@@ -20,10 +21,10 @@
:foreach Voltage in={ "psu1-voltage"; "psu2-voltage"; "voltage" } do={
:if ([ :typeof ($CheckHealthLast->$Voltage) ] = "num" && \
[ :typeof ($CheckHealthCurrent->$Voltage) ] = "num") do={
- :if ($CheckHealthLast->$Voltage * 115 / 100 < $CheckHealthCurrent->$Voltage || \
- $CheckHealthLast->$Voltage * 100 / 115 > $CheckHealthCurrent->$Voltage) do={
+ :if ($CheckHealthLast->$Voltage * (100 + $CheckHealthVoltagePercent) / 100 < $CheckHealthCurrent->$Voltage || \
+ $CheckHealthLast->$Voltage * 100 / (100 + $CheckHealthVoltagePercent) > $CheckHealthCurrent->$Voltage) do={
$SendNotification ("Health warning: " . $Voltage) \
- ("The " . $Voltage . " on " . $Identity . " jumped more than 15%.\n\n" . \
+ ("The " . $Voltage . " on " . $Identity . " jumped more than " . $CheckHealthVoltagePercent . "%.\n\n" . \
"old value: " . [ $FormatVoltage ($CheckHealthLast->$Voltage) ] . "\n" . \
"new value: " . [ $FormatVoltage ($CheckHealthCurrent->$Voltage) ]);
}