From 3d4a14d44935fff6777a97afb4b598238c57b47e Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Wed, 13 Mar 2024 08:37:11 +0100 Subject: netwatch-notify: pass link to notification This is pass verbatim below the notification text. --- doc/netwatch-notify.md | 7 +++++++ global-functions.rsc | 2 +- netwatch-notify.rsc | 4 ++-- news-and-changes.rsc | 1 + 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/doc/netwatch-notify.md b/doc/netwatch-notify.md index 6f3e1ce..806bb3a 100644 --- a/doc/netwatch-notify.md +++ b/doc/netwatch-notify.md @@ -111,6 +111,13 @@ included verbatim into the notification. /tool/netwatch/add comment="notify, name=example, note=Do not touch!" host=10.0.0.31; +### Add a link in notification + +It is possible to add a link in notification, that is added below the +formatted notification text. + + /tool/netwatch/add comment="notify, name=example.com, resolve=example.com, link=https://example.com/"; + Tips & Tricks ------------- diff --git a/global-functions.rsc b/global-functions.rsc index d33e3e2..e4d0fd2 100644 --- a/global-functions.rsc +++ b/global-functions.rsc @@ -12,7 +12,7 @@ :local ScriptName [ :jobname ]; # expected configuration version -:global ExpectedConfigVersion 123; +:global ExpectedConfigVersion 124; # global variables not to be changed by user :global GlobalFunctionsReady false; diff --git a/netwatch-notify.rsc b/netwatch-notify.rsc index 9536dd7..adcfc37 100644 --- a/netwatch-notify.rsc +++ b/netwatch-notify.rsc @@ -144,7 +144,7 @@ } $SendNotification2 ({ origin=[ $EitherOr ($HostInfo->"origin") $ScriptName ]; silent=($HostInfo->"silent"); \ subject=([ $SymbolForNotification "white-heavy-check-mark" ] . "Netwatch Notify: " . $Name . " up"); \ - message=$Message }); + message=$Message; link=($HostInfo->"link") }); } :set ($Metric->"notified") false; :set ($Metric->"parent") ($HostInfo->"parent"); @@ -199,7 +199,7 @@ :if ($HostInfo->"no-down-notification" != true) do={ $SendNotification2 ({ origin=[ $EitherOr ($HostInfo->"origin") $ScriptName ]; silent=($HostInfo->"silent"); \ subject=([ $SymbolForNotification "cross-mark" ] . "Netwatch Notify: " . $Name . " down"); \ - message=$Message }); + message=$Message; link=($HostInfo->"link") }); } :set ($Metric->"notified") true; } diff --git a/news-and-changes.rsc b/news-and-changes.rsc index 6b0a538..1f1094d 100644 --- a/news-and-changes.rsc +++ b/news-and-changes.rsc @@ -48,6 +48,7 @@ 121="The 'wifiwave2' scripts are finally gone. Development continues with 'wifi' in RouterOS 7.13 and later."; 122="The global configuration was enhanced to support loading snippets. Configuration can be split off to scripts where name starts with 'global-config-overlay.d/'."; 123="Introduced new function '\$LogPrint', and deprecated '\$LogPrintExit2'. Please update custom scripts if you use it."; + 124="Added support for links in 'netwatch-notify', these are added below the formatted notification text."; }; # Migration steps to be applied on script updates -- cgit v1.2.3-70-g09d2