mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2024-05-11 05:55:19 +00:00
netwatch-notify: RouterOS v7 path syntax
This commit is contained in:
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
$ScriptLock $0;
|
$ScriptLock $0;
|
||||||
|
|
||||||
:if ([ / system resource get uptime ] < 5m) do={
|
:if ([ /system/resource/get uptime ] < 5m) do={
|
||||||
$LogPrintExit2 info $0 ("System just booted, giving netwatch some time to settle.") true;
|
$LogPrintExit2 info $0 ("System just booted, giving netwatch some time to settle.") true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,8 +54,8 @@ $ScriptLock $0;
|
|||||||
:set NetwatchNotify [ :toarray "" ];
|
:set NetwatchNotify [ :toarray "" ];
|
||||||
}
|
}
|
||||||
|
|
||||||
:foreach Host in=[ / tool netwatch find where comment~"notify" disabled=no ] do={
|
:foreach Host in=[ /tool/netwatch/find where comment~"notify" disabled=no ] do={
|
||||||
:local HostVal [ / tool netwatch get $Host ];
|
:local HostVal [ /tool/netwatch/get $Host ];
|
||||||
:local HostInfo [ $ParseKeyValueStore ($HostVal->"comment") ];
|
:local HostInfo [ $ParseKeyValueStore ($HostVal->"comment") ];
|
||||||
|
|
||||||
:if ($HostInfo->"notify" = true && $HostInfo->"disabled" != true) do={
|
:if ($HostInfo->"notify" = true && $HostInfo->"disabled" != true) do={
|
||||||
@ -74,7 +74,7 @@ $ScriptLock $0;
|
|||||||
$LogPrintExit2 info $0 ("Name '" . $HostInfo->"resolve" . [ $IfThenElse ($HostInfo->"resolve" != \
|
$LogPrintExit2 info $0 ("Name '" . $HostInfo->"resolve" . [ $IfThenElse ($HostInfo->"resolve" != \
|
||||||
$HostInfo->"hostname") ("' for host '" . $HostInfo->"hostname") "" ] . \
|
$HostInfo->"hostname") ("' for host '" . $HostInfo->"hostname") "" ] . \
|
||||||
"' resolves to different address " . $Resolve . ", updating.") false;
|
"' resolves to different address " . $Resolve . ", updating.") false;
|
||||||
/ tool netwatch set host=$Resolve $Host;
|
/tool/netwatch/set host=$Resolve $Host;
|
||||||
:set ($Metric->"resolve-failed") false;
|
:set ($Metric->"resolve-failed") false;
|
||||||
}
|
}
|
||||||
} on-error={
|
} on-error={
|
||||||
|
Reference in New Issue
Block a user