aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2021-04-27 21:54:30 +0200
committerGravatar Christian Hesse <mail@eworm.de>2021-04-28 13:58:37 +0200
commite6223a3661af4ee3888f2656d103a865eb6ab27a (patch)
tree842c4866eb00a1d294c9578c15fea3c7402e3eba
parent87cbc1edadddaae330d58b23cc101d8ab5abddc6 (diff)
netwatch-notify: pass origin to $SendNotification2
-rw-r--r--netwatch-notify6
1 files changed, 4 insertions, 2 deletions
diff --git a/netwatch-notify b/netwatch-notify
index 09dbfb8..5600857 100644
--- a/netwatch-notify
+++ b/netwatch-notify
@@ -38,7 +38,8 @@
:local Count ($Metric->"count");
:set ($Metric->"count") 0;
:if ($Metric->"notified" = true) do={
- $SendNotification2 ({ subject=([ $SymbolForNotification "white-heavy-check-mark" ] . "Netwatch Notify: " . $HostName . " up"); \
+ $SendNotification2 ({ origin=$0; \
+ 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={
@@ -76,7 +77,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={
- $SendNotification2 ({ subject=([ $SymbolForNotification "cross-mark" ] . "Netwatch Notify: " . $HostName . " down"); \
+ $SendNotification2 ({ origin=$0; \
+ 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={