mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2024-05-11 05:55:19 +00:00
check-health: never divide, always multiply
With RouterOS we have integral numbers only. This prevent from having friction that is cut off.
This commit is contained in:
@ -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" . \
|
||||
|
Reference in New Issue
Block a user