Monit restart OpenConnect

Started by dstrobel, July 09, 2018, 07:13:19 PM

Previous topic - Next topic
I am looking for a way to start and stop the OpenConnect service using Monit.

I started reading about configuring Monit to monitor a network host and that seems straight forward but now I'm stuck at the start and stop scripts. I have the OpenConnect plugin installed and just want to ping a host address on the other side of the tunnel and have the connection attempt to restart if the pings fail.

Thanks

In case this helps someone else, here is what I figured out.

Services / Monit / Service Test Settings
Create new test
Name - OpenConnect Ping
Condition - failed ping
Action - Restart

Services / Monit / Service Settings
Create new service
Enabled
Name - OpenConnect
Type - Remote Host
Address - IP Address on the other side of the VPN
Start - /usr/local/etc/rc.d/opnsense-openconnect start
Stop - /usr/local/etc/rc.d/opnsense-openconnect stop
Tests - OpenConnect Ping

Just tested it a couple times and seems to work so far.