mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-08-29 14:28:36 +02:00
check-health.d/state: use script name for origin in notification
This commit is contained in:
parent
2fed8f967b
commit
907358cb85
1 changed files with 4 additions and 3 deletions
|
@ -11,7 +11,8 @@
|
||||||
:global CheckHealthPlugins;
|
:global CheckHealthPlugins;
|
||||||
|
|
||||||
:set ($CheckHealthPlugins->[ :jobname ]) do={
|
:set ($CheckHealthPlugins->[ :jobname ]) do={
|
||||||
:local FuncName [ :tostr $0 ];
|
:local FuncName [ :tostr $0 ];
|
||||||
|
:local ScriptName [ :tostr $1 ];
|
||||||
|
|
||||||
:global CheckHealthLast;
|
:global CheckHealthLast;
|
||||||
:global Identity;
|
:global Identity;
|
||||||
|
@ -32,13 +33,13 @@
|
||||||
:if ([ :typeof ($CheckHealthLast->$Name) ] != "nothing") do={
|
:if ([ :typeof ($CheckHealthLast->$Name) ] != "nothing") do={
|
||||||
:if ($CheckHealthLast->$Name = "ok" && \
|
:if ($CheckHealthLast->$Name = "ok" && \
|
||||||
$Value != "ok") do={
|
$Value != "ok") do={
|
||||||
$SendNotification2 ({ origin=$FuncName; \
|
$SendNotification2 ({ origin=$ScriptName; \
|
||||||
subject=([ $SymbolForNotification "cross-mark" ] . "Health warning: " . $Name); \
|
subject=([ $SymbolForNotification "cross-mark" ] . "Health warning: " . $Name); \
|
||||||
message=("The device '" . $Name . "' on " . $Identity . " failed!") });
|
message=("The device '" . $Name . "' on " . $Identity . " failed!") });
|
||||||
}
|
}
|
||||||
:if ($CheckHealthLast->$Name != "ok" && \
|
:if ($CheckHealthLast->$Name != "ok" && \
|
||||||
$Value = "ok") do={
|
$Value = "ok") do={
|
||||||
$SendNotification2 ({ origin=$FuncName; \
|
$SendNotification2 ({ origin=$ScriptName; \
|
||||||
subject=([ $SymbolForNotification "white-heavy-check-mark" ] . "Health recovery: " . $Name); \
|
subject=([ $SymbolForNotification "white-heavy-check-mark" ] . "Health recovery: " . $Name); \
|
||||||
message=("The device '" . $Name . "' on " . $Identity . " recovered!") });
|
message=("The device '" . $Name . "' on " . $Identity . " recovered!") });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue