我们正在运行一个多站点的业务,每个站点连接到一个中央OpenVPN服务器,以提供对内部系统的访问。 目前我正在使用Monit来检查OpenVPN客户端是否正在运行,如果远程服务器正在运行,但是由于一些站点运行在不稳定的4G调制解调器上,VPN连接有时会中断而不会死亡,这使得monit认为一切精细。 对VPN网关的一个简单的ping将显示连接是否正常工作,但是当我读取monit文档时,ping检查似乎不能与进程检查混合,所以我可以添加检查但不能实际用它重启进程。
有没有一些明显的方法来做到这一点,我错过了,或者有另一种方法使OpenVPN能够从这种问题自行恢复?
这是我的监督检查(基本上从手册中粘贴):
check process openvpn with pidfile /var/run/openvpn.client.pid start program = "/etc/init.d/openvpn start" stop program = "/etc/init.d/openvpn stop" if failed host *my-vpn-gateway* port 1194 type udp then restart group net depends openvpn_init depends openvpn_bin check file openvpn_init with path /etc/init.d/openvpn group net check file openvpn_bin with path /usr/sbin/openvpn group net
似乎解决方法是有两个检查:1为进程和1,以确保网关主机是可及的
check process vpn-network with pidfile /var/run/vpn-network.pid start program = "/etc/init.d/openvpn start vpn-network.com" stop program = "/etc/init.d/openvpn stop vpn-network.com" check host tap0 with address 1.1.1.1 start program = "/etc/init.d/openvpn start vpn-network.com" stop program = "/etc/init.d/openvpn stop vpn-network.com" if failed icmp type echo count 5 with timeout 15 seconds then restart ¶
来源: http : //grimore.org/unix/monit/openvpn