mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2024-05-11 05:55:19 +00:00
netwatch-notify: allow to give different origin for hosts...
... to use differing notification settings. Add an origin name in netwatch configuration: /tool/netwatch/add comment="notify, name=dns-google, origin=netwatch-notify-google" address=8.8.8.8; /tool/netwatch/add comment="notify, name=dns-cloudflare, origin=netwatch-notify-cloudflare" address=1.1.1.1; Then configure the notification settings in `global-config-overlay`: :global EmailGeneralToOverride { "netwatch-notify-google"="google@example.com"; "netwatch-notify-cloudflare"="cloudflare@example.com"; } I think it is best to handle this as a hidden setting... Handle with care!
This commit is contained in:
@ -115,9 +115,8 @@ $ScriptLock $0;
|
||||
:set Message ($Message . "\n\n" . [ $NetwatchNotifyHook $Name $Type "up" \
|
||||
($HostInfo->"up-hook") ]);
|
||||
}
|
||||
$SendNotification2 ({ origin=$0; silent=($HostInfo->"silent"); \
|
||||
subject=([ $SymbolForNotification "white-heavy-check-mark" ] . "Netwatch Notify: " . \
|
||||
$Name . " up"); \
|
||||
$SendNotification2 ({ origin=[ $EitherOr ($HostInfo->"origin") $0 ]; silent=($HostInfo->"silent"); \
|
||||
subject=([ $SymbolForNotification "white-heavy-check-mark" ] . "Netwatch Notify: " . $Name . " up"); \
|
||||
message=$Message });
|
||||
}
|
||||
:set ($Metric->"notified") false;
|
||||
@ -169,9 +168,8 @@ $ScriptLock $0;
|
||||
($HostInfo->"down-hook") ]);
|
||||
}
|
||||
:if ($HostInfo->"no-down-notification" != true) do={
|
||||
$SendNotification2 ({ origin=$0; silent=($HostInfo->"silent"); \
|
||||
subject=([ $SymbolForNotification "cross-mark" ] . "Netwatch Notify: " . \
|
||||
$Name . " down"); \
|
||||
$SendNotification2 ({ origin=[ $EitherOr ($HostInfo->"origin") $0 ]; silent=($HostInfo->"silent"); \
|
||||
subject=([ $SymbolForNotification "cross-mark" ] . "Netwatch Notify: " . $Name . " down"); \
|
||||
message=$Message });
|
||||
}
|
||||
:set ($Metric->"notified") true;
|
||||
|
Reference in New Issue
Block a user