netwatch-notify: pass link to notification

This is pass verbatim below the notification text.
This commit is contained in:
Christian Hesse 2024-03-13 08:37:11 +01:00
parent ccfbabde5e
commit 3d4a14d449
4 changed files with 11 additions and 3 deletions

View file

@ -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
-------------

View file

@ -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;

View file

@ -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;
}

View file

@ -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