mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2024-05-11 05:55:19 +00:00
netwatch-notify: handle CNAME to multiple records
This commit is contained in:
@ -83,9 +83,9 @@ with a resolvable name:
|
||||
|
||||
/tool/netwatch/add comment="notify, name=example.com, resolve=example.com";
|
||||
|
||||
This supports multiple A or AAAA records for a name just fine, but be
|
||||
warned: A CNAME to multiple records will cause a high rate of configuration
|
||||
changes (and flash writes)!
|
||||
This supports multiple A or AAAA records for a name just fine, even a CNAME
|
||||
to those. But be warned: CNAME chains to multiple records will cause a high
|
||||
rate of configuration changes (and flash writes)!
|
||||
|
||||
### No notification on host down
|
||||
|
||||
|
@ -62,6 +62,15 @@
|
||||
:return true;
|
||||
}
|
||||
|
||||
:local Cname [ /ip/dns/cache/find where name=$Name type="CNAME" ];
|
||||
:if ([ :len $Cname ] > 0) do={
|
||||
:set Cname [ /ip/dns/cache/get $Cname data ];
|
||||
:set Cname [ :pick $Cname 0 ([ :len $Cname ] - 1) ];
|
||||
:if ([ :len [ /ip/dns/cache/find where name=$Cname data=$Expected ] ] > 0) do={
|
||||
:return true;
|
||||
}
|
||||
}
|
||||
|
||||
:return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user