script check internet mikrotik

 checking internet connection with script and multiple host to check.

The script below can be applied to the scheduler directly or placed in the system script and called from the scheduler.

this script, check 3 seconds every host, and you can see at log

you can change another option command at = :log warning "ping timeout"

with another command like send to mail or change gateway.

/system script add name=ping_multi_host source={
:if ([/ping 1.1.1.1 count=3] = 0 && [/ping 1.0.0.1 count=3] = 0 && [/ping 8.8.8.8 count=3] = 0) do={:log warning "ping timeout"} else={:log warning "ping lancar"}
}

I gave an example of a system script, then called the script from the scheduler every 5 minutes.

/system scheduler add name=pingcheck interval=5m on-event="/system script run ping_multi_host"

0 Response to "script check internet mikrotik"

Post a Comment