OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • Archive »
  • 20.1 Legacy Series »
  • How to use monit to reboot firewall when VPN gateway is not reachable for X min
« previous next »
  • Print
Pages: [1]

Author Topic: How to use monit to reboot firewall when VPN gateway is not reachable for X min  (Read 1073 times)

skywalker007

  • Full Member
  • ***
  • Posts: 133
  • Karma: 5
    • View Profile
How to use monit to reboot firewall when VPN gateway is not reachable for X min
« on: March 13, 2020, 02:59:14 pm »
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!
Logged
System1: Qotom Q310G4
System2: APU2C4

cmdr.adama

  • Jr. Member
  • **
  • Posts: 61
  • Karma: 3
    • View Profile
Re: How to use monit to reboot firewall when VPN gateway is not reachable for X min
« Reply #1 on: March 13, 2020, 04:36:13 pm »
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.
Logged

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • Archive »
  • 20.1 Legacy Series »
  • How to use monit to reboot firewall when VPN gateway is not reachable for X min
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2023 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2