I have an OpenVPN server machine which resides on an isolated network, a NAT rule in the company's firewall is redirecting all traffic on port 1194 (tcp) from the public IP I chose to the internal address of the OpenVPN server machine. I'd like to create a Nagios check which will monitor the availability of the OpenVPN server. What would be the best method to monitor it, considering that the check will run from the world (a Nagios server) rather than from within the company?
I do it remotely, via
NAGIOS
, using a local plugin calledcheck_openvpn.pl
, invoked vianrpe
, which in turn uses OpenVPN's built-in management capability to report on its detailed status.Since you're using TCP as the VPN bearer, you could do a simple TCP connectivity check on port 1194 (as Dennis notes in his answer) but the advantage of this plugin is it runs a fairly rigorous check of OpenVPN, and reports the CNs currently connected to the server. If it's reporting at that level, I can have confidence that the server is completely up and offering service to the world at large, which a simple connectivity check wouldn't give me.
The plugin came from this page at NAGIOS exchange; the author's website is apparently http://emergeworld.blogspot.com.
The gory details are: the following entry in the NAGIOS server's config (plus appropriate connecting logic):
Then this in the OpenVPN server's
nrpe.cfg
:Then this at the end of the OpeVPN server's `.conf' file:
Note the
11940
common to the both the previous data; that's the port number for the management interface. The password in thenrpe.cfg
entry above (shown asXXXXXXX
) should also appear in the file/etc/openvpn/man.pass
.For OpenVPN, I simply monitor whether it is listening on the usual port: