From c7034ca5af26b70a06739978e0ea2f7fcf83f611 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 24 Jan 2020 08:17:42 +0100 Subject: check-health: never divide, always multiply With RouterOS we have integral numbers only. This prevent from having friction that is cut off. --- check-health | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'check-health') diff --git a/check-health b/check-health index 95a92d7..07ec366 100644 --- a/check-health +++ b/check-health @@ -21,8 +21,8 @@ :foreach Voltage in={ "battery"; "psu1-voltage"; "psu2-voltage"; "voltage" } do={ :if ([ :typeof ($CheckHealthLast->$Voltage) ] = "num" && \ [ :typeof ($CheckHealthCurrent->$Voltage) ] = "num") do={ - :if ($CheckHealthLast->$Voltage * (100 + $CheckHealthVoltagePercent) / 100 < $CheckHealthCurrent->$Voltage || \ - $CheckHealthLast->$Voltage > $CheckHealthCurrent->$Voltage * (100 + $CheckHealthVoltagePercent) / 100) do={ + :if ($CheckHealthLast->$Voltage * (100 + $CheckHealthVoltagePercent) < $CheckHealthCurrent->$Voltage * 100 || \ + $CheckHealthLast->$Voltage * 100 > $CheckHealthCurrent->$Voltage * (100 + $CheckHealthVoltagePercent)) do={ $SendNotification ("Health warning: " . $Voltage) \ ("The " . $Voltage . " on " . $Identity . " jumped more than " . $CheckHealthVoltagePercent . "%.\n\n" . \ "old value: " . [ $FormatVoltage ($CheckHealthLast->$Voltage) ] . "\n" . \ -- cgit v1.2.3-54-g00ecf