Page 1 of 3

Having Some NRPE issues with specific commands

Posted: Tue Apr 29, 2014 1:12 pm
by brandon.pal
Hi I'm running NRPE on my servers to run all scripts.

I'm trying to run "check_open_files" but am I getting "NRPE: Unable to read output"

If I run the command on the server:

Code: Select all

/usr/lib64/nagios/plugins/check_open_files.pl -w 85 -c 95
OK: 928 open files (0% of max 1000000)|opened_files=928;850000;950000
My NRPE.cfg

Code: Select all

command[check_open_files]=/usr/lib64/nagios/plugins/check_open_files.pl $ARG1$
tail /var/log/messages

Code: Select all

 Host is asking for command 'check_open_files' to be run...
Apr 29 14:09:06 dc01-cache-01 nrpe[21074]: Running command: /usr/lib64/nagios/plugins/check_open_files.pl -w 85 -c 95
Apr 29 14:09:06 dc01-cache-01 nrpe[21074]: Command completed with return code 2 and output:
Apr 29 14:09:06 dc01-cache-01 nrpe[21074]: Return Code: 2, Output: NRPE: Unable to read output
Apr 29 14:09:06 dc01-cache-01 nrpe[21074]: Connection from 10.91.100.105 closed.
I really can't figure out why it's not working.

I'm noticing issues with a few other plugins but others are running fine. I've yet to look into the other plugins but have tried everything I can think of for this one.

Any thoughts or help would be greatly appreciated.

Re: Having Some NRPE issues with specific commands

Posted: Tue Apr 29, 2014 2:08 pm
by slansing
If you are only setting $ARG1$ then you will need to specify the command on Nagios similar to this:

Code: Select all

$USER1$/check_nrpe -H $HOSTADDRESS$ -c check_open_files $ARG1$
Then you will need to place the following in the service definition in the $ARG1$ field:

Code: Select all

-a '-w 85 -c 95'
What does running the command manually from the nagios server output?:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H addr.of.remote.host -c check_open_files -a '-w 85 -c 95'

Re: Having Some NRPE issues with specific commands

Posted: Tue Apr 29, 2014 2:24 pm
by brandon.pal
Running command from nagios server:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H 10.91.101.25 -c check_open_files -a '-w 85 -c 95'
NRPE: Unable to read output
Service Management:

Check Command: check_nrpe
Command View: $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ $ARG2$
$ARG1$ : check_open_files -a '-w 30 -c 50'

Re: Having Some NRPE issues with specific commands

Posted: Tue Apr 29, 2014 2:56 pm
by brandon.pal
Could the .pl extension be causing the issues?

Re: Having Some NRPE issues with specific commands

Posted: Tue Apr 29, 2014 3:00 pm
by tmcdonald
Make sure that the perl script has a line like this at the top:

Code: Select all

#!/usr/bin/perl
or wherever your perl is located, otherwise NRPE has no idea how to run it.

Re: Having Some NRPE issues with specific commands

Posted: Tue Apr 29, 2014 3:13 pm
by brandon.pal
It's there.

Re: Having Some NRPE issues with specific commands

Posted: Tue Apr 29, 2014 5:56 pm
by abrist
Can the check be run from the remote system as user nagios?

Code: Select all

su nagios
/usr/lib64/nagios/plugins/check_open_files.pl -w 85 -c 95
echo $?
What are the permissions on the file:

Code: Select all

ls -la /usr/lib64/nagios/plugins/check_open_files.pl
Is dont_blame_nrpe set to 1?

Code: Select all

grep blame /usr/local/nagios/etc/nrpe.cfg
Note: make sure all the commands above are run from the remote system

Re: Having Some NRPE issues with specific commands

Posted: Tue Apr 29, 2014 10:12 pm
by brandon.pal
abrist wrote:Can the check be run from the remote system as user nagios?

Code: Select all

su - nagios
This account is currently not available.
abrist wrote:What are the permissions on the file:

Code: Select all

-rwxr-xr-x 1 root root 3259 Apr 29 17:30 /usr/lib64/nagios/plugins/check_open_files.pl
abrist wrote:Is dont_blame_nrpe set to 1?

Code: Select all

grep blame /etc/nagios/nrpe.cfg
dont_blame_nrpe=1
# command arguments *AND* the dont_blame_nrpe directive in this
As a note I am able to run other commands through NRPE it seems this is the only one giving me a hard time :?

Re: Having Some NRPE issues with specific commands

Posted: Wed Apr 30, 2014 11:17 am
by lmiltchev
su - nagios
This account is currently not available.
Hm-m, can you run the follwoing command and show us the output?

Code: Select all

grep nagios /etc/passwd

Re: Having Some NRPE issues with specific commands

Posted: Wed Apr 30, 2014 11:59 am
by brandon.pal
nagios:x:399:399::/var/spool/nagios:/sbin/nologin