mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-23 12:24:28 +02:00
check-health: check for valid psu state data
This is required with recovery notifications
This commit is contained in:
parent
b74d465cd0
commit
63ca79b960
1 changed files with 12 additions and 9 deletions
21
check-health
21
check-health
|
@ -31,15 +31,18 @@
|
|||
}
|
||||
|
||||
:foreach PSU in={ "psu1"; "psu2" } do={
|
||||
:if ($CheckHealthLast->($PSU . "-state") = "ok" && \
|
||||
$CheckHealthCurrent->($PSU . "-state") != "ok") do={
|
||||
$SendNotification ("Health warning: " . $PSU . " state") \
|
||||
("The power supply unit '" . $PSU . "' on " . $Identity . " failed!");
|
||||
}
|
||||
:if ($CheckHealthLast->($PSU . "-state") != "ok" && \
|
||||
$CheckHealthCurrent->($PSU . "-state") = "ok") do={
|
||||
$SendNotification ("Health recovery: " . $PSU . " state") \
|
||||
("The power supply unit '" . $PSU . "' on " . $Identity . " recovered!");
|
||||
:if ([ :typeof ($CheckHealthLast->($PSU . "-state")) ] = "str" && \
|
||||
[ :typeof ($CheckHealthCurrent->($PSU . "-state")) ] = "str") do={
|
||||
:if ($CheckHealthLast->($PSU . "-state") = "ok" && \
|
||||
$CheckHealthCurrent->($PSU . "-state") != "ok") do={
|
||||
$SendNotification ("Health warning: " . $PSU . " state") \
|
||||
("The power supply unit '" . $PSU . "' on " . $Identity . " failed!");
|
||||
}
|
||||
:if ($CheckHealthLast->($PSU . "-state") != "ok" && \
|
||||
$CheckHealthCurrent->($PSU . "-state") = "ok") do={
|
||||
$SendNotification ("Health recovery: " . $PSU . " state") \
|
||||
("The power supply unit '" . $PSU . "' on " . $Identity . " recovered!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue