mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-08-03 01:34:32 +02:00
check-health: make threshold for voltage configurable
This commit is contained in:
parent
09ce75c5b1
commit
f40bb2c8c8
5 changed files with 11 additions and 7 deletions
|
@ -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) ]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue