mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
netwatch-notify: nest conditions
The logic here was right, but RouterOS runs the checks simultaneously. This caused delays even if no resolving was needed. Nesting the checks fixes this.
This commit is contained in:
parent
c6e581d4f9
commit
0b46c508dc
1 changed files with 17 additions and 15 deletions
|
@ -66,7 +66,8 @@ $ScriptLock $0;
|
||||||
:set $Metric ($NetwatchNotify->$HostName);
|
:set $Metric ($NetwatchNotify->$HostName);
|
||||||
}
|
}
|
||||||
|
|
||||||
:if ([ :typeof ($HostInfo->"resolve") ] = "str" && [ $DNSIsResolving ] = true) do={
|
:if ([ :typeof ($HostInfo->"resolve") ] = "str") do={
|
||||||
|
:if ([ $DNSIsResolving ] = true) do={
|
||||||
:do {
|
:do {
|
||||||
:local Resolve [ :resolve ($HostInfo->"resolve") ];
|
:local Resolve [ :resolve ($HostInfo->"resolve") ];
|
||||||
:if ($Resolve != $HostVal->"host") do={
|
:if ($Resolve != $HostVal->"host") do={
|
||||||
|
@ -84,6 +85,7 @@ $ScriptLock $0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
:if ($HostVal->"status" = "up") do={
|
:if ($HostVal->"status" = "up") do={
|
||||||
:local Count ($Metric->"count");
|
:local Count ($Metric->"count");
|
||||||
|
|
Loading…
Reference in a new issue