mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
netwatch-notify: use $SendNotification2
This commit is contained in:
parent
81f84353cd
commit
557016387c
1 changed files with 6 additions and 6 deletions
|
@ -15,7 +15,7 @@
|
||||||
:global IfThenElse;
|
:global IfThenElse;
|
||||||
:global LogPrintExit2;
|
:global LogPrintExit2;
|
||||||
:global ParseKeyValueStore;
|
:global ParseKeyValueStore;
|
||||||
:global SendNotification;
|
:global SendNotification2;
|
||||||
:global SymbolForNotification;
|
:global SymbolForNotification;
|
||||||
:global ValidateSyntax;
|
:global ValidateSyntax;
|
||||||
|
|
||||||
|
@ -38,9 +38,9 @@
|
||||||
:local Count ($Metric->"count");
|
:local Count ($Metric->"count");
|
||||||
:set ($Metric->"count") 0;
|
:set ($Metric->"count") 0;
|
||||||
:if ($Metric->"notified" = true) do={
|
:if ($Metric->"notified" = true) do={
|
||||||
$SendNotification ([ $SymbolForNotification "white-heavy-check-mark" ] . "Netwatch Notify: " . $HostName . " up") \
|
$SendNotification2 ({ subject=([ $SymbolForNotification "white-heavy-check-mark" ] . "Netwatch Notify: " . $HostName . " up"); \
|
||||||
("Host " . $HostName . " (" . $HostVal->"host" . ") is up since " . $HostVal->"since" . ".\n" . \
|
message=("Host " . $HostName . " (" . $HostVal->"host" . ") is up since " . $HostVal->"since" . ".\n" . \
|
||||||
"It was down for " . $Count . " checks since " . ($Metric->"since") . ".");
|
"It was down for " . $Count . " checks since " . ($Metric->"since") . ".") });
|
||||||
:if ([ :typeof ($HostInfo->"up-hook") ] = "str") do={
|
:if ([ :typeof ($HostInfo->"up-hook") ] = "str") do={
|
||||||
:if ([ $ValidateSyntax ($HostInfo->"up-hook") ] = true) do={
|
:if ([ $ValidateSyntax ($HostInfo->"up-hook") ] = true) do={
|
||||||
$LogPrintExit2 info $0 ("Running hook on host " . $HostName . " up: " . ($HostInfo->"up-hook")) false;
|
$LogPrintExit2 info $0 ("Running hook on host " . $HostName . " up: " . ($HostInfo->"up-hook")) false;
|
||||||
|
@ -76,8 +76,8 @@
|
||||||
($Metric->"notified" = true) ("already notified.") ($Count - $Metric->"count" . " to go.") ] \
|
($Metric->"notified" = true) ("already notified.") ($Count - $Metric->"count" . " to go.") ] \
|
||||||
("parent host " . $Parent . " is down.") ]) false;
|
("parent host " . $Parent . " is down.") ]) false;
|
||||||
:if ($ParentNotified = false && $Metric->"count" >= $Count && $Metric->"notified" != true) do={
|
:if ($ParentNotified = false && $Metric->"count" >= $Count && $Metric->"notified" != true) do={
|
||||||
$SendNotification ([ $SymbolForNotification "cross-mark" ] . "Netwatch Notify: " . $HostName . " down") \
|
$SendNotification2 ({ subject=([ $SymbolForNotification "cross-mark" ] . "Netwatch Notify: " . $HostName . " down"); \
|
||||||
("Host " . $HostName . " (" . $HostVal->"host" . ") is down since " . $HostVal->"since" . ".");
|
message=("Host " . $HostName . " (" . $HostVal->"host" . ") is down since " . $HostVal->"since" . ".") });
|
||||||
:set ($Metric->"notified") true;
|
:set ($Metric->"notified") true;
|
||||||
:if ([ :typeof ($HostInfo->"down-hook") ] = "str") do={
|
:if ([ :typeof ($HostInfo->"down-hook") ] = "str") do={
|
||||||
:if ([ $ValidateSyntax ($HostInfo->"down-hook") ] = true) do={
|
:if ([ $ValidateSyntax ($HostInfo->"down-hook") ] = true) do={
|
||||||
|
|
Loading…
Reference in a new issue