Site Tools


connectivity_watchdog

This is an old revision of the document!


Connectivity Watchdog

You might want to monitor your Internet connectivity. The simplest way to do this is to run a custom task script in, for example: Administration/Scheduler/Custom 1

The basic command would be something like:

/bin/ping -q -c1 8.8.4.4

(8.8.4.4. is a google DNS server) which would cover the monitoring part without performing any action.

In order to link an action to a success (&&) or failure (||) we will append the wanted condition and the command.

For example:

/bin/ping -q -c1 8.8.4.4 || /sbin/service wan restart #if ping fails, restart the wan.

/bin/ping -q -c1 8.8.4.4 || /sbin/reboot # if ping fails, reboot the device.

/bin/ping -q -c1 8.8.4.4 && /usr/bin/logger “Internet available” || /usr/bin/logger “Internet unavailable” # successful pings will log “Internet Available” where ping failures will log “Internet unavailable”.

connectivity_watchdog.1614030562.txt.gz · Last modified: 2021/02/22 21:49 by hogwild