LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   NRPE problem with Nagios (https://www.linuxquestions.org/questions/linux-software-2/nrpe-problem-with-nagios-828832/)

babaqga 08-27-2010 10:00 AM

NRPE problem with Nagios
 
Hi guys, I have the following problem:

I am using the following baSH! script that I wrote so I can check mysql parameters:

Code:

#!/bin/sh
NRTHREADS=`"/usr/bin/mysqladmin" status -ppassword | awk '{print$4}' | bc`
if [ $NRTHREADS -gt 200 ]
then
        RC="2"
        COMMENT="CRITICAL"
elif [ $NRTHREADS -gt 150 ]
then
        RC="1"
        COMMENT="WARNING"
else
        RC="0"
        COMMENT="OK"
fi
echo "SERVICE: $COMMENT, threads: $NRTHREADS threads | threads=$NRTHREADS"

if I call the script using
Code:

# ./check_mysql_threads.sh
SERVICE: OK, threads: 3 threads | threads=3

However, if I call the script from nrpe:
Code:

#./check_nrpe -H localhost -c check_mysql_threads_remote
SERVICE: OK, threads:  threads | threads=

As one can see, the service check_mysql_threads_remote is defined on my
client in the following way:
Code:

command[check_mysql_threads_remote]=[PATH]/check_mysql_threads.sh
However, it doesn't display the results as it somehow can't find mysqladmin and make a call to it eventhough I gave it the absolute path. I have other scripts on the same client that DO WORK that are built the same way making calls, I even have a script that writes to a file outside the libexec directory, using absolute paths to find where to find the commads/scripts/files it manipulates.However, for some reason the mysqladmin is a super exception. I am wondering if any of you faced the issue and how to resolve it.

valen_tino 08-27-2010 10:49 AM

Does the nagios user have the permission to run the script that you may have created as either root or a sql user?


All times are GMT -5. The time now is 08:28 PM.