From f40bb2c8c85adaa1ee84bb693b76a7a7e334f54a Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 14 Oct 2019 19:06:21 +0200 Subject: check-health: make threshold for voltage configurable --- check-health | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'check-health') 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) ]); } -- cgit v1.2.3-54-g00ecf