diff options
author | Christian Hesse <mail@eworm.de> | 2020-01-24 08:17:42 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2020-01-24 08:17:42 +0100 |
commit | c7034ca5af26b70a06739978e0ea2f7fcf83f611 (patch) | |
tree | fa93ce185bd3491ee53c9f1d5f2c23e869551665 | |
parent | 6e5e0e72bd695d0e7dd546a24c3afba31ab32cae (diff) |
check-health: never divide, always multiply
With RouterOS we have integral numbers only. This prevent from having
friction that is cut off.
-rw-r--r-- | check-health | 4 |
1 files changed, 2 insertions, 2 deletions
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" . \ |