Check that the vpn is up and running in nagios
A problem I had to deal with once, was to be able to use nagios to know when the VPN stopped working. The conflict I had by just using simple private network ping checks is that I was unable to easily tell at first glance whether it was the VPN that had a problem or the whole network.
Thus, I wrote this little script that receives three arguments and is able to tell whether it is actually the VPN that has any problems. Besides, it also checks for packet loss and is able to detect if the whole public network goes down.
The three arguments that receives this check are the following:
- Public IP Address: A public IP address to ping in order to know whether the network is working properly.
- Private (VPN) IP Address: A private network IP address to ping in order to know whether the VPN is working properly.
- Number of pings: Total number of pings to send in order to know more about packet loss.
The check issues a CRITICAL only if there is 100% ICMP loss while pinging the private network and the public network is suffering less than 100% ICMP loss.
The check issues a WARNING if either the public or the private or both IP addresses suffer any kind of packet loss. It also issues a WARNING if the public network suffers 100% ICMP loss.
You can download the full source code for this check in the following link: check_vpn