Random Project

Some corrections to the script

Although the script worked flawlessly locally, I had to edit it as follows to correct the logic:

if [[ “$eroutes” -eq “2” ]]
then
echo “OK – All 2 tunnels are up an running”
exit $STATE_OK
elif [[ “$eroutes” -gt “2” ]]
then
echo “WARNING – More than 2 ($eroutes) tunnels are up an running”
exit $STATE_WARNING
else
echo “CRITICAL – Only $eroutes tunnels from 2 are up an running – $(location)”
exit $STATE_CRITICAL
fi

Besides this, I had to do the following to fetch the results via NRPE plugin remotely:

chown nagios /var/run/pluto/pluto.clt

Now I’m able to view the proper results over my NAGIOS monitoring console.

Hope this helps someone.