aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2021-04-27 20:52:26 +0200
committerGravatar Christian Hesse <mail@eworm.de>2021-04-28 13:58:37 +0200
commit557016387ce270d0c7035be85c7b432841535eda (patch)
treeee39b00933e15447e8c59387f677b143930f410f
parent81f84353cd75fb8e91e2e02d70b5ed5f17df12dd (diff)
netwatch-notify: use $SendNotification2
-rw-r--r--netwatch-notify12
1 files changed, 6 insertions, 6 deletions
diff --git a/netwatch-notify b/netwatch-notify
index ef67804..09dbfb8 100644
--- a/netwatch-notify
+++ b/netwatch-notify
@@ -15,7 +15,7 @@
:global IfThenElse;
:global LogPrintExit2;
:global ParseKeyValueStore;
-:global SendNotification;
+:global SendNotification2;
:global SymbolForNotification;
:global ValidateSyntax;
@@ -38,9 +38,9 @@
:local Count ($Metric->"count");
:set ($Metric->"count") 0;
:if ($Metric->"notified" = true) do={
- $SendNotification ([ $SymbolForNotification "white-heavy-check-mark" ] . "Netwatch Notify: " . $HostName . " up") \
- ("Host " . $HostName . " (" . $HostVal->"host" . ") is up since " . $HostVal->"since" . ".\n" . \
- "It was down for " . $Count . " checks since " . ($Metric->"since") . ".");
+ $SendNotification2 ({ subject=([ $SymbolForNotification "white-heavy-check-mark" ] . "Netwatch Notify: " . $HostName . " up"); \
+ message=("Host " . $HostName . " (" . $HostVal->"host" . ") is up since " . $HostVal->"since" . ".\n" . \
+ "It was down for " . $Count . " checks since " . ($Metric->"since") . ".") });
:if ([ :typeof ($HostInfo->"up-hook") ] = "str") do={
:if ([ $ValidateSyntax ($HostInfo->"up-hook") ] = true) do={
$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.") ] \
("parent host " . $Parent . " is down.") ]) false;
:if ($ParentNotified = false && $Metric->"count" >= $Count && $Metric->"notified" != true) do={
- $SendNotification ([ $SymbolForNotification "cross-mark" ] . "Netwatch Notify: " . $HostName . " down") \
- ("Host " . $HostName . " (" . $HostVal->"host" . ") is down since " . $HostVal->"since" . ".");
+ $SendNotification2 ({ subject=([ $SymbolForNotification "cross-mark" ] . "Netwatch Notify: " . $HostName . " down"); \
+ message=("Host " . $HostName . " (" . $HostVal->"host" . ") is down since " . $HostVal->"since" . ".") });
:set ($Metric->"notified") true;
:if ([ :typeof ($HostInfo->"down-hook") ] = "str") do={
:if ([ $ValidateSyntax ($HostInfo->"down-hook") ] = true) do={