aboutsummaryrefslogtreecommitdiffstats
path: root/check-routeros-update.rsc
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-08-24 11:16:23 +0200
committerGravatar Christian Hesse <mail@eworm.de>2023-08-31 09:40:09 +0200
commit57027ceb26427ff34f4d022734f5196d4d3f0a04 (patch)
tree7c46fbc675aea6b902789a61aa523fbe9e04fb85 /check-routeros-update.rsc
parent7b47ed7ea5a937edef9699c1b8be3b6364c9c0c9 (diff)
check-routeros-update: show neighbor's identity in message and notification
Diffstat (limited to 'check-routeros-update.rsc')
-rw-r--r--check-routeros-update.rsc22
1 files changed, 13 insertions, 9 deletions
diff --git a/check-routeros-update.rsc b/check-routeros-update.rsc
index 0625ebd..73ce7d8 100644
--- a/check-routeros-update.rsc
+++ b/check-routeros-update.rsc
@@ -81,15 +81,19 @@ $LogPrintExit2 debug $0 ("Checking for updates...") false;
$DoUpdate;
}
- :if ($SafeUpdateNeighbor = true && [ :len [ /ip/neighbor/find where platform="MikroTik" \
- version~("^" . [ $EscapeForRegEx ($Update->"latest-version" . " (" . $Update->"channel" . ")") ]) \
- identity~$SafeUpdateNeighborIdentity ] ] > 0) do={
- $LogPrintExit2 info $0 ("Seen a neighbor running version " . $Update->"latest-version" . ", updating...") false;
- $SendNotification2 ({ origin=$0; \
- subject=([ $SymbolForNotification "sparkles" ] . "RouterOS update: " . $Update->"latest-version"); \
- message=("Seen a neighbor running version " . $Update->"latest-version" . " from " . $Update->"channel" . \
- ", updating on " . $Identity . "..."); link=$Link; silent=true });
- $DoUpdate;
+ :if ($SafeUpdateNeighbor = true) do={
+ :local Neighbors [ /ip/neighbor/find where platform="MikroTik" identity~$SafeUpdateNeighborIdentity \
+ version~("^" . [ $EscapeForRegEx ($Update->"latest-version" . " (" . $Update->"channel" . ")") ]) ];
+ :if ([ :len $Neighbors ] > 0) do={
+ :local Neighbor [ /ip/neighbor/get ($Neighbors->0) identity ];
+ $LogPrintExit2 info $0 ("Seen a neighbor (" . $Neighbor . ") running version " . \
+ $Update->"latest-version" . " from " . $Update->"channel" . ", updating...") false;
+ $SendNotification2 ({ origin=$0; \
+ subject=([ $SymbolForNotification "sparkles" ] . "RouterOS update: " . $Update->"latest-version"); \
+ message=("Seen a neighbor (" . $Neighbor . ") running version " . $Update->"latest-version" . \
+ " from " . $Update->"channel" . ", updating on " . $Identity . "..."); link=$Link; silent=true });
+ $DoUpdate;
+ }
}
:if ([ :len $SafeUpdateUrl ] > 0) do={