aboutsummaryrefslogtreecommitdiffstats
path: root/check-health
diff options
context:
space:
mode:
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) ]);
}