Install the packages watchcat and luci-app-watchcat.
Watchcat is a ping-watchdog utility that allows you to set up rules for when a ping to a particular host fails.
The following modes of operation are available
mode - the mode this watchcat instance is in.
ping_rebootrestart_ifaceperiodic_reboot
period - the way this parameter is used depends on the mode watchcat is in:
Period examples
10 or 10s5m1h7d
pinghosts - In Ping Reboot and Restart Interface modes, the host(s) to ping/monitor
pingperiod - how often to ping
Ping Period examples
10 or 10s5m1h7d
pingsize - the size of packet to use for pings.
Supported ping size values
small - 1 bytewindows - 32 bytesstandard - 56 bytesbig - 248 byteshuge - 1492 bytesjumbo - 9000 bytes
interface - the interface to ping via, and also, in Restart Interface mode the one to restart.
If unset, it will use the default route's interface.
Interface examples
eth1wwan0
forcedelay - in Ping Reboot and Periodic Reboot modes, the amount of time to try a graceful reboot before a sysreq reboot is activated as a fail safe.
mmifacename - name of a ModemManager interface to restart - if set it will restart the ModemManager service when that interface goes down.
Modem Manager Interface Name example
mobiledata
unlockbands - if set to 1 it will issue mmcli -m any --set-current-bands=any when the rule is activated
Possible unlockbands values
0 - disabled (default)1 - enabled
Note restart_iface mode, interface, pingsize, mmifacename unlockbands parameters are available after commit: https://github.com/openwrt/packages/commit/d5047303d6ad052f0249350a205015d149882e0e
The following are examples of a config watchcat stanza for a rule in the /etc/config/watchcat configuration file:
- Ping host 192.168.1.1 (gateway) every 30s (30 seconds) via the interface eth1.1 and reboot if it fails for 5m (5 minutes) or longer and wait up to 1m (1 minute) for a soft reboot before requesting a hard reboot:
config watchcat option interface 'eth1.1' option period '5m' option mode 'ping_reboot' option pinghosts '192.168.1.1' option pingperiod '30s' option forcedelay '1m'
- Reboot the device every 3d (3 days) and wait up to 2m (2 minutes) for a soft reboot before requesting a hard reboot:
config watchcat option mode 'periodic_reboot' option period '3d' option forcedelay '2m'