mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 10:04:19 +02:00
netwatch-notify: support note in notification
This commit is contained in:
parent
3b5026ea8d
commit
650c362ed9
|
@ -88,6 +88,13 @@ powered off, but accessibility is of interest.
|
|||
|
||||
Go and get your coffee ☕️ before sending the print job.
|
||||
|
||||
### Add a note in notification
|
||||
|
||||
For some extra information it is possible to add a text note. This is
|
||||
included verbatim into the notification.
|
||||
|
||||
/tool/netwatch/add comment="notify, name=example, note=Do not touch!" host=10.0.0.31;
|
||||
|
||||
Also notification settings are required for
|
||||
[e-mail](mod/notification-email.md),
|
||||
[matrix](mod/notification-matrix.md) and/or
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
:local 0 "global-functions";
|
||||
|
||||
# expected configuration version
|
||||
:global ExpectedConfigVersion 95;
|
||||
:global ExpectedConfigVersion 96;
|
||||
|
||||
# global variables not to be changed by user
|
||||
:global GlobalFunctionsReady false;
|
||||
|
|
|
@ -112,6 +112,9 @@ $ScriptLock $0;
|
|||
:local Message ("The " . $Type . " '" . $Name . "' (" . $HostDetails . \
|
||||
") is up since " . $HostVal->"since" . ".\n" . \
|
||||
"It was down for " . $CountDown . " checks since " . ($Metric->"since") . ".");
|
||||
:if ([ :typeof ($HostInfo->"note") ] = "str") do={
|
||||
:set Message ($Message . "\n\nNote:\n" . ($HostInfo->"note"));
|
||||
}
|
||||
:if ([ :typeof ($HostInfo->"up-hook") ] = "str") do={
|
||||
:set Message ($Message . "\n\n" . [ $NetwatchNotifyHook $Name $Type "up" \
|
||||
($HostInfo->"up-hook") ]);
|
||||
|
@ -162,6 +165,9 @@ $ScriptLock $0;
|
|||
($ParentUp = false || $ParentUp > 2) && $Metric->"notified" != true) do={
|
||||
:local Message ("The " . $Type . " '" . $Name . "' (" . $HostDetails . \
|
||||
") is down since " . $HostVal->"since" . ".");
|
||||
:if ([ :typeof ($HostInfo->"note") ] = "str") do={
|
||||
:set Message ($Message . "\n\nNote:\n" . ($HostInfo->"note"));
|
||||
}
|
||||
:if ([ :typeof ($HostInfo->"down-hook") ] = "str") do={
|
||||
:set Message ($Message . "\n\n" . [ $NetwatchNotifyHook $Name $Type "down" \
|
||||
($HostInfo->"down-hook") ]);
|
||||
|
|
|
@ -9,8 +9,10 @@
|
|||
|
||||
# Changes for global-config to be added to notification on script updates
|
||||
:global GlobalConfigChanges {
|
||||
96="Added support for notes in 'netwatch-notify', these are included verbatim into the notification.";
|
||||
};
|
||||
|
||||
# Migration steps to be applied on script updates
|
||||
:global GlobalConfigMigration {
|
||||
0;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue