Check failing to run correctly on new XI server
Posted: Tue Aug 18, 2020 9:02 am
OK so on the left is our current production XI server on CentOS 6 on the right is the new build on CentOS 7. it is almost complete but i have this one issue that is bugging me.
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
The script is a custom script I wrote that basically goes out and periodically checks our internet bearer status over our 10GB link, if our main site fails, the internet will fail over to our secondary site, if both fail it should go critical.
Any idea how i can get this to run correctly in the GUI, worth noting that the other 8000+ checks are working fine.
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