I am looking for some advise for how to use monit to achieve the following:
I have a remote OPNsense which uses an OPNvpn site to site tunnel to my main site.
Now when the remote OPNsense can't reach the destination gateway, i want to wait for X min and then reboot.
Now after reboot, if it doesn't reconnect - obviously the problem is somewhere else and I want to add an additional delay before rebooting again and so on. Once connection is established it shoud revert back to the default delay of course.
Do I need to write some shell script for that exercise or can monit do it out of the box?
thanks!
Under service settings add your VPN service then go to the Service Tests tab.
In the service tests tab, set your preferred condition you want to meet before doing a restart. Set the action to execute, then set the path to /sbin/shutdown -r now.
Then assign the test to your VPN service.