As you can see in the screenshot, the service check on the left works fine and takes 16 seconds to execute, on the right is fails after 2 seconds.

Now this is the bit that is confusing me. When I run the check from the CLI of the new server it works perfectly, but fails to work from the GUI
Code: Select all
[root@nagxit02 libexec]# /usr/local/nagios/libexec/check_internet
OK - Internet Bearer is via Primary
Code: Select all
#!/bin/bash
# set -x
# Check if the Internet Bearer has switched from Primary to Backup
#
# Check which Bearer is being used
# ----------------------------------------------------------
sudo traceroute -I 8.8.8.8 > /tmp/traceroute.txt
# Alert if it's the wrong one
# ----------------------------------------------------------
cat /tmp/traceroute.txt | grep "111.111.111.111" > /dev/null 2>&1
Primary=$?
if [ ${Primary} -eq 0 ]; then
echo "OK - Internet Bearer is via Primary"
exit 0;
fi
cat /tmp/traceroute.txt | grep "111.111.111.111" > /dev/null 2>&1
Backup=$?
if [ ${Backup} -eq 0 ]; then
echo "WARNING - Internet Bearer is on Backup"
exit 1;
fi
echo "CRITICAL - Internet Bearer is DOWN !!"
cat /tmp/traceroute.txt
exit 2
"/usr/local/nagios/libexec/check_internet" 35L, 887C