I placed the following script below in the following directory on the remote server (check_informix.sh)
/usr/local/nagios/libexec
Code: Select all
#!/bin/bash
#
# check_ifx - plugin to validate that Informix is online # # parameters # 1) Informix directory # 2) Informix server
print_use(){
echo -e "USE: check_ifx informixdir informixserver\\n"
echo -e "\t informixdir = Informix directory"
echo -e "\t informixserver = server name"
}
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
if [ $# -lt 2 ]
then
print_use
exit $STATE_UNKNOWN
fi
if [ $# -gt 2 ]
then
print_use
exit $STATE_UNKNOWN
fi
export INFORMIXDIR=$1
export INFORMIXSERVER=$2
result=`$INFORMIXDIR/bin/onstat -`
for cmd in $result
do
if [ $cmd = On-Line ]
then
echo $result
exit 0
fi
done
echo $result
exit 3
chown nagios.nagios /usr/local/nagios/libexec/check_informix.sh
Then added this to the bottom of your /usr/local/nagios/etc/nrpe.cfg:
command[check_informix]=/usr/local/nagios/libexec/check_informix.sh
Then restart the nrpe service:
systemctl restart xinetd
I then tried to test the script by running this command from the remote server and got this error
[root@huey libexec]# /usr/local/nagios/libexec/check_informix.sh /usr/informix hueynet
-bash: /usr/local/nagios/libexec/check_informix.sh: Permission denied
Here are the permission
[root@huey libexec]# ls -la
total 4
drwxr-xr-x. 2 root root 31 Nov 15 06:58 .
drwxr-xr-x. 3 root root 21 Nov 14 22:36 ..
-rw-r-----. 1 nagios nagios 684 Nov 15 06:58 check_informix.sh
[root@huey libexec]#
From the Nagios server I tried to run this command and got this error
[root@nag etc]# /usr/local/nagios/libexec/check_nrpe -H 192.168.1.42 -c check_informix.sh
connect to address 192.168.1.42 port 5666: No route to host
Please advise so I can get this working. At one time I had this working and worked with one of your reps, however since then we had to wipe and rebuild the servers. Here is the ticket reference "Need to Monitor Informix" and this was back in July 2017. Waiting for assistance with this. Need to get this working again.
Thank you,