Are you running openvpn as a server or a client? On which OS? and which
version? I run openvpn as a client to an outside proxy service and I use
monit to re-establish the connection when it goes down. You will need a
variation on what follows but you can probably work it out:
in monit.conf I have:
'check file openvpn-client.log with path /home/share/openvpn-client.log
     if match "RESOLVE: Cannot resolve host address" then exec
"/root/reset.sh"'

so in your case you need to work out which log you're using and what the
error message is when openvpn dies and modify the above accordingly.

Then create a script (in my case this was /root/reset.sh) which stops the
openvpn connection and restarts it. Make sure the scripts contains a few
seconds sleep or delay between stop and start.


On Tue, Jul 22, 2014 at 4:30 PM, Jonathan Greenberg <[email protected]>
wrote:

> Monit-ers:
>
> I've been successful doing simple process monitoring tasks with monit,
> but I recently ran into an issue where openvpn seems to "die" without
> really crashing -- the symptom is my system networking stops seeing
> the outside world and/or my IP reverts back to my "real" IP.  openvpn
> is running, but it requires restarting it to get the networking
> working again.  I'd like to set up a monitoring tasks that monitors
> and restarts openvpn if:
> 1) No "outside" connectivity is present OR 2) my "outside" IP address
> is a specific IP (the non-openvpn one that would show up with e.g.
> http://www.whatsmyip.org/).
>
> Any suggestions on how to accomplish this?  Thanks!
>
> --j
>
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general
>
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

Reply via email to