check_nrpe!check_load command failed

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.
mishomor
Posts: 15
Joined: Tue Sep 24, 2013 1:16 pm

check_nrpe!check_load command failed

Post by mishomor »

Hi guys,

I successfully installed my first Nagios Core (4.0.0) and quickly managed to add couple of Windows servers through NSC++ client. I installed NRPE plugin to monitor Linux clients and I also installed and configured nagios-nrpe on my linux clients (Centos 5.x).

My first big issue is lack of good nrpe linux.cfg examples, so I tried creating one myself just for test purposes but I got following error after I ran
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Error: Service check command 'check_nrpe!check_load' specified in service 'CPU Load' for host 'test' not defined anywhere!

Here is my simple linux.cfg file

define host{
use linux-server
host_name test
alias test-srv
address 10.65.0.55
}

define service{
use generic-service
host_name test
service_description CPU Load
check_command check_nrpe!check_load
}

I checked commands.cfg and there is no mentioning of any NRPE check. Can somebody help me add them all if possible?

All answers very much appreciated!!
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_nrpe!check_load command failed

Post by slansing »

Sure we can help you out so lets start with defining your check_nrpe command definition by the name "check_nrpe" and it will automatically take the host of that service's address and fill it in so that all your linux based nrpe service checks can call it and use it together. Start by opening your commands.cfg file. Then add the following lines as a separate definition follow how the others look:

Code: Select all

define command {
       command_name                             check_nrpe
       command_line                             $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ $ARG2$
}
So what we are saying here is check nrpe will be called in your service definition, then you will add the first argument, in your example you used "check_nrpe!check_load!"

What that is saying is that it will use the check_nrpe command_name, and pass check_load to the $ARG!$ slot. Now, to add warning and critical thresholds or additional arguments to that check command, simply add them after another "!" in the service definition, such that it will look similar to:

Code: Select all

check_nrpe!check_load!-a '-w 15,10,5 -c 30,20,10'
In fact, you could even use the above one just to see how the check output looks in the interface for a test. Hope this helps!
mishomor
Posts: 15
Joined: Tue Sep 24, 2013 1:16 pm

Re: check_nrpe!check_load command failed

Post by mishomor »

Hey slansing, thinks for quick reply!
I did as you said and configcheck returned no errors, yes! Now, when I login to nagios webinterface I am getting
(Return code of 255 is out of bounds)
mishomor
Posts: 15
Joined: Tue Sep 24, 2013 1:16 pm

Re: check_nrpe!check_load command failed

Post by mishomor »

Not sure why my previous post wasn't published, so I'll do it again.
Slansing that was it, thanks for the quick response! I now have new issue but it's definitely not related to this post so I'll open new one.

Cheers
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_nrpe!check_load command failed

Post by slansing »

Apologies on the late approving of your post, we are closed right now as the office hours are 9 am - 5 pm Central Standard Time (US) and we are not open on the weekends, however... I am up a bit late and browsing the forums. Lets try a few things. Firstly, run the following from the Nagios server's CLI:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H place.the.host.ip.here -c check_load -a '-w 15,10,5 -c 30,20,10'
This is the manual equivalent of the check your Service is running. The above assumes you are using a centos or rhel based installation, if that is not true let me know and I'll tweak the command. What we are doing here is checking to see if you get a valid result from the command line, if so, something is lost in translation between the web interface and the status being returned.
mishomor
Posts: 15
Joined: Tue Sep 24, 2013 1:16 pm

Re: check_nrpe!check_load command failed

Post by mishomor »

Ok, here is output of check command
/usr/local/nagios/libexec/check_nrpe -H test -c check_load -a '-w 15,10,5 -c 30,20,10'
CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.


Output of my /var/log/messages from client
Sep 27 22:04:11 test xinetd[15716]: START: nrpe pid=16072 from=54.200.38.61
Sep 27 22:04:11 test nrpe[16072]: Error: Request contained command arguments, but argument option is not enabled!
Sep 27 22:04:11 test nrpe[16072]: Client request was invalid, bailing out...
Sep 27 22:04:11 test xinetd[15716]: EXIT: nrpe status=0 pid=16072 duration=0(sec)
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_nrpe!check_load command failed

Post by slansing »

Ahh, the solution lies within the syslog. So lets do this, on your client open:

Code: Select all

/usr/local/nagios/nrpe.cfg
"If it is not located there let me know, different installations on different distro's can be different"

And change the dont_blame_nrpe=0 line to a "1", then save the file and issue:

Code: Select all

service xinetd restart
Now give that nagios command a shot again.
mishomor
Posts: 15
Joined: Tue Sep 24, 2013 1:16 pm

Re: check_nrpe!check_load command failed

Post by mishomor »

I tried that as soon as I check log but no go.

# /usr/local/nagios/libexec/check_nrpe -H test -c check_load -a '-w 15,10,5 -c 30,20,10'
NRPE: Unable to read output

/var/log/messages
Sep 27 22:11:47 test xinetd[16847]: xinetd Version 2.3.14 started with libwrap loadavg labeled-networking options compiled in.
Sep 27 22:11:47 test xinetd[16847]: Started working: 1 available service
Sep 27 22:11:56 test xinetd[16847]: START: nrpe pid=16849 from=54.x.x.x
Sep 27 22:11:57 test xinetd[16847]: EXIT: nrpe status=0 pid=16849 duration=1(sec)
Sep 27 22:12:24 test xinetd[16847]: START: nrpe pid=17029 from=54.x.x.x
Sep 27 22:12:24 test xinetd[16847]: EXIT: nrpe status=0 pid=17029 duration=0(sec)
Last edited by mishomor on Sat Sep 28, 2013 12:31 am, edited 1 time in total.
mishomor
Posts: 15
Joined: Tue Sep 24, 2013 1:16 pm

Re: check_nrpe!check_load command failed

Post by mishomor »

Should I keep the rest of nrpe.cfg default?
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_nrpe!check_load command failed

Post by slansing »

Hmm... can you share your nrpe.cfg from that remote host? I'll take a look inside of it and see if the internal command is defined properly. Please block out you XI server's IP from the allowed hosts list if it is forward facing.
Locked