NRPE issue

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: NRPE issue

Post by lmiltchev »

I would recommend removing the "custom check_nrpe_1arg" command, and reading my previous post one more time.

I will give you an example that works, and then you can decide if you want to set up your system in similar way.

On the REMOTE machine I have:

In the "nrpe.cfg":

Code: Select all

command[check_users]=/usr/local/nagios/libexec/check_users $ARG1$
command[check_load_nrpe]=/usr/local/nagios/libexec/check_load $ARG1$
On my NAGIOS server, I have:

Command definition:

Code: Select all

command_line                             $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ $ARG2$
Service definition:

Code: Select all

check_command			check_nrpe!check_users!-a '-w 3 -c 5'

Code: Select all

check_command			check_nrpe!check_load_nrpe!-a '-w 15,10,5 -c 30,20,10'
Running checks from the command line on my Nagios server:

Code: Select all

./check_nrpe -H <client_IP> -c check_users -a '-w 3 -c 5'
USERS OK - 1 users currently logged in |users=1;3;5;0

./check_nrpe -H <client_IP> -c check_load_nrpe -a '-w 15,10,5 -c 30,20,10'
OK - load average: 0.32, 0.63, 0.63|load1=0.320;15.000;30.000;0; load5=0.630;10.000;20.000;0; load15=0.630;5.000;10.000;0;
Be sure to check out our Knowledgebase for helpful articles and solutions!
jiggityjog
Posts: 20
Joined: Mon Apr 22, 2013 5:14 pm

Re: NRPE issue

Post by jiggityjog »

Hey lmiltchev, thanks for the input and sorry for such a delayed response. It's taken awhile to test everything thoroughly. I can definitely query things through the command line on the monitoring host with your set-up (which I happen to find preferable, notably keeping the arguments centrally located.)

However, I am still unable to retrieve information from the GUI. Status information reports '(No output returned from plugin)' from CPU Load (yet I have another service working but it has no arguments). Things are currently configured like this:

Monitoring Host

Code: Select all

define service{
use  generic-service
host_name mortall
service_description CPU Load NRPE
check command check_nrpe!check_load!-a '-w 15,10,5 -c 30,20,10'
}
Remote Host, I've tried the following combinations

Code: Select all

command[check_load_nrpe]=/usr/lib/nagios/plugins/check_load $ARG1$ 
command[check_load_nrpe]=/usr/lib/nagios/plugins/check_load $ARG1$ $ARG1$
command[check_load_nrpe]=/usr/lib/nagios/plugins/check_load -w $ARG1$ -c $ARG1$
However, I also have, on the monitoring host, defined: check_command check_nrpe!check_apt!-a
Which, incidentally, reports just fine. Which indicates to me an argument issue.

The GUI does make this note:

Code: Select all

Note:
This plugin requires that you have the NRPE daemon running on the remote host.
You must also have configured the daemon to associate a specific plugin command
with the [command] option you are specifying here. Upon receipt of the
[command] argument, the NRPE daemon will run the appropriate plugin command and
send the plugin output and return code back to *this* plugin. This allows you
to execute plugins on remote hosts and 'fake' the results to make Nagios think
the plugin is being run locally.
I was considering putting a '-c [command-name]' somewhere, but it's a bit confusing as to where. The exclamation mark delimiters, I thought, covered this.

One other error that keeps popping up when I try to use the GUI:

Code: Select all

Error: Could not stat() command file '/var/lib/nagios3/rw/nagios.cmd'!
The external command file may be missing, Nagios may not be running, and/or Nagios may not be checking external commands.
An error occurred while attempting to commit your command for processing.
User avatar
gshergill
Posts: 231
Joined: Tue Aug 07, 2012 5:08 am

Re: NRPE issue

Post by gshergill »

Hi jiggityjog,

You have in the service definition;

Code: Select all

check command check_nrpe!check_load!-a '-w 15,10,5 -c 30,20,10'
But your Remote host nrpe.cfg has;

Code: Select all

command[check_load_nrpe]=/usr/lib/nagios/plugins/check_load $ARG1$
You should have in your service definition;

Code: Select all

check_command check_nrpe!check_load_nrpe!-a '-w 15,10,5 -c 30,20,10'
You didn't use "check_load_nrpe". Also, you missed out the "_" between check and command.

You should try a straight copy and paste into your .cfgs what lmiltchev posted and only change the plugin locations (e.g. /usr/lib/...).

Kind Regards,

Gary Shergill
jiggityjog
Posts: 20
Joined: Mon Apr 22, 2013 5:14 pm

Re: NRPE issue

Post by jiggityjog »

Hey gshergill,

I made a mistake while typing, sorry. Since these servers are on virtual machines I find it easier to just type out my config settings.
However since I keep bungling that up, I just ssh'd over, so here is exactly what I have (which, incidentally, seems like what you suggested, and might demonstrate how I got my wires crossed):

on nrpe.cfg

Code: Select all

command[check_load]=/usr/lib/nagios/plugins/check_load $ARG1$
command[check_load_nrpe]=/usr/lib/nagios/plugins/check_load $ARG1$
command[check_apt]=/usr/lib/nagios/plugins/check_apt
on services.cfg

Code: Select all

define service{
	use	generic-service
	host_name	mortalla
	service_description	CPU Load
	check_command	check_nrpe!check_load!-a '-w 15,10,5 -c 30,20,10'
}

define service{
	use	generic-service
	host_name	mortalla
	service_description	CPU Load NRPE
	check_command	check_nrpe!check_load_nrpe!-a '-w 15,10,5 -c 30,20,10'
}

define service{
	use	generic-service
	host_name	mortalla
	service_description	apt
	check_command	check_nrpe!check_apt!-a
}

lmiltchev's server commands work great, but the website interface won't comply ((No output returned from plugin)).

It's weird because I remember even managing things, like a simple restart of nagios (System > Process info), being super simple before where now I get the error I mentioned earlier. (I've changed check_external_commands to 1) Actually one problem now is that these services seem to be in a HARD state and nagios no longer does checks when I alter the commands (even after service nagios-nrpe-server reload/restart, service nagios3 reload/restart).

UPDATE: I solved the external command issue using this page: http://technosophos.com/content/nagios- ... ile-debian
Though I had to apply chmod recursively to the /nagios3/rw directory. I ended up looking through the permissions on the plugins (monitoring and remote host), noticed they were all default (for ubuntu server anyway). So I tried chowning them to nagios:www-data, then recursively doing a chmod g+x. Still no luck.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: NRPE issue

Post by lmiltchev »

Did you restart xinetd after you modified the nrpe.cfg?

What kind of output are you getting, when you cd into the plugins directory on your nagios server and run the following commands?

Code: Select all

./check_nrpe -H <client_IP> -t 30 -c check_load -a '-w 15,10,5 -c 30,20,10'
./check_nrpe -H <client_IP> -t 30 -c check_load_nrpe -a '-w 15,10,5 -c 30,20,10'
Be sure to check out our Knowledgebase for helpful articles and solutions!
jiggityjog
Posts: 20
Joined: Mon Apr 22, 2013 5:14 pm

Re: NRPE issue

Post by jiggityjog »

I actually don't even bother with xinetd...

I've uploaded a screenshot of my output.
Attachments
nagios-o.jpg
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: NRPE issue

Post by lmiltchev »

So, you get this output when you run the checks from the command line, but you have errors in the GUI?
Be sure to check out our Knowledgebase for helpful articles and solutions!
jiggityjog
Posts: 20
Joined: Mon Apr 22, 2013 5:14 pm

Re: NRPE issue

Post by jiggityjog »

Yes, here's a screenshot:
Attachments
nagios-o2.jpg
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: NRPE issue

Post by lmiltchev »

Try to run the same commands as nagios user (not as root) from the command line, and post the output. Also, show the permissions of the check_nrpe:

Code: Select all

ls -la /usr/lib/nagios/plugins/check_nrpe
Be sure to check out our Knowledgebase for helpful articles and solutions!
jiggityjog
Posts: 20
Joined: Mon Apr 22, 2013 5:14 pm

Re: NRPE issue

Post by jiggityjog »

I'm not exactly sure what you mean by run check_nrpe as the nagios user. I tried changing the password for nagios, then logging in. That didn't really work...

Something about the check_nrpe command looks wrong, but I'm beat and my day's over so I'll be back on this tomorrow.
UPDATE: missed the -c. doh!

thanks for the assistance!
Attachments
nagfix.jpg
nagio4.jpg
nagio3.jpg
nagio3.jpg (7.61 KiB) Viewed 4108 times
Locked