Problem monitoring IPSEC with NRPEv2
o1netadmin last edited by
I have created a script to check for the existence of an IPSEC tunnel. The script works fine from the command line on the pfsense system, even when logged in as the nagios user. However, when calling it from my Nagios system using check_nrpe it does not work. It always returns that the tunnel is not found. This is because the command '/usr/local/sbin/ipsec statusall' does not return any information when it's run through NRPE. Any ideas on how to fix this?
Here's my check_ipsec script…
#!/bin/sh # . $PROGPATH/utils.sh exitstatus=$STATE_WARNING #default endpoint=$1 result=`/usr/local/sbin/ipsec statusall | grep ESTABLISHED | grep $endpoint` if [ "$result" != "" ] then echo "Ipsec vpn tunnel check ok: $endpoint\n$result\n" exitstatus=$STATE_OK else echo "CRITICAL - Ipsec vpn tunnel not found: $endpoint\n$result\n" exitstatus=$STATE_CRITICAL fi exit $exitstatus