Script check DNS serve is alive

Guys, I am new in script of RouterOS. I would like to know if is possible to do um script .

Today I have one linux running my DNS server (bind9) on ip 192.168.1.2.

I would like to have a script to ping this server each minute, in case it down, I new to change the dns servers on my mikrotik (192.168.1.1), I would like to take out the DNS Servers of /ip dns and set the property /IP dhcp-client USE PEER DNS.

So this would work in case my dns server is down, correct ?

Is there another way to do this ? I 've tried to set up the 2nd and 3rd server as 8.8.8.8, 8.8.4.4, but when I unplug my linux server, mikrotik don’t go to the 8.8.8.8…

As my linux server has squid too, this would like to use to fix the proxy in case its down, so I would have to DISABLE the rule in firewall that sends all the traffic on port 80 to the squid.

cheers

You can use Netwatch to monitor a host and run a script when it goes down and another script when it comes back up

Thanks man…never seen NetWatch, will google about it.

cheers

Netwatch manual is here: http://wiki.mikrotik.com/wiki/Manual:Tools/Netwatch

Where can I learn se routerOS scripting? Is there a wiki for that too?

Thanks

http://wiki.mikrotik.com/wiki/Manual:Scripting
http://wiki.mikrotik.com/wiki/Manual:Scripting-examples

is there anyway to check a DNS request against a specific dns server? ( ie equivlent of linux: dig @192.168.1.117 -p53 netflix.com ) ?

im trying to script (or netwatch) a check to confrim that a specific DNS server is working (ie its resolving dns queries) , else change the DNS the mikrotik uses.

(a dns-crypt server, im only missing the part on how to do a DNS query against a specific dns server on the mt, if its even possible, i know how to script the rest).

thanks
EDIT 2- NICE!! looks like you can do this! put [resolve google.com server=192.168.5.2] allows you to specify the dns server used, EXACTLY what i was looking for. thanks!

EDIT; i do know about [:resolve smtp.gmail.com] (in scripts) however that will not do what i want as that uses the DNS server the MT is set to (ie in /ip dns ) , im hoping to be able to manually set which dns server my script uses to resolve from (as im trying to always test that a specific dns server is resolving dns requests , not just replying to pings) . tks