Having Some NRPE issues with specific commands

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
brandon.pal
Posts: 129
Joined: Wed Feb 19, 2014 10:18 pm

Having Some NRPE issues with specific commands

Post 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.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Having Some NRPE issues with specific commands

Post 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'
brandon.pal
Posts: 129
Joined: Wed Feb 19, 2014 10:18 pm

Re: Having Some NRPE issues with specific commands

Post 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'
brandon.pal
Posts: 129
Joined: Wed Feb 19, 2014 10:18 pm

Re: Having Some NRPE issues with specific commands

Post by brandon.pal »

Could the .pl extension be causing the issues?
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Having Some NRPE issues with specific commands

Post 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.
Former Nagios employee
brandon.pal
Posts: 129
Joined: Wed Feb 19, 2014 10:18 pm

Re: Having Some NRPE issues with specific commands

Post by brandon.pal »

It's there.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Having Some NRPE issues with specific commands

Post 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
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
brandon.pal
Posts: 129
Joined: Wed Feb 19, 2014 10:18 pm

Re: Having Some NRPE issues with specific commands

Post 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 :?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Having Some NRPE issues with specific commands

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
brandon.pal
Posts: 129
Joined: Wed Feb 19, 2014 10:18 pm

Re: Having Some NRPE issues with specific commands

Post by brandon.pal »

nagios:x:399:399::/var/spool/nagios:/sbin/nologin
Locked