OpenWRT: Improved Network/OpenVPN/WiFi watchdog

After using the simple watchdog for a while I needed to monitor another network interface. Since the old script couldn’t be extended nicely (without creating lots of redundant code), I decided to rewrite the whole thing! This new version allows me to set up multiple watchdogs with custom commands within the configuration file. See how you can use it too:


Configuration

First create a new configuration file /etc/config/watchping:

This configures watchping with three instances. Each instance will ping the specified host and issue the restart command after the timeout expires. Customize this file to your needs, e.g. add your own hosts or disable instances you don’t need.

The scripts

Next create the folder /usr/lib/watchping/ and upload the following script:

Finally upload the init script to /etc/init.d/watchping:


Final touches

The watchping script requires fping to be installed on the router:

Check your system log and verify the watchdog started correctly:

Tested with OpenWRT 19.07

3 Kommentare

  1. Pingback:OpenWRT: FRITZ!Box reboot/reconnect script – LUANI

  2. I have a question:
    What do I have to enter in the config if I want to ping 192.168.0.4?

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert