Nagios only checking local

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.
Wnt2bsleepin
Posts: 21
Joined: Wed Sep 18, 2013 3:22 pm

Re: Nagios only checking local

Post by Wnt2bsleepin »

slansing wrote:
I can query the nagios system with the check NRPE command
You are running these commands from the nagios server to the NRPE server correct? Not the way you stated above?

Did you make sure to restart xinetd after making your changes?

I would also try removing the -w and -c from the arguments section of the nrpe.cfg since you are passing them in your arguments from core.
Yes, sorry for the confusion. I am running those commands from the machines with the full Nagios installation. I am querying the server with the NRPE plugin installed. I did restart xinetd after making changes.

I removed the section from the nrpe.cfg that allowed me to specify the command arguments. It is still giving me the unknown arguments error. However, I tried it with the following arguments before changing it and it gave me a different message.

Code: Select all

root@<server>:/usr/local/nagios/libexec# ./check_nrpe -H ftb.<host>.com -c check_disk -a "-w 5 -c 2 -p /home"
CHECK_NRPE: Received 0 bytes from daemon.  Check the remote server logs for error messages.
Does that mean that it is accepting the arguments?
User avatar
nscott
Posts: 1040
Joined: Wed May 11, 2011 8:54 am

Re: Nagios only checking local

Post by nscott »

In your nrpe.cfg on your remote box (NOT your Nagios box), you need to set

Code: Select all

dont_blame_nrpe=1
Currently it is not accepting arguments (a security feature). Upon doing so you may need to restart xinetd. Then try again.
Nicholas Scott
Former Nagios employee
Wnt2bsleepin
Posts: 21
Joined: Wed Sep 18, 2013 3:22 pm

Re: Nagios only checking local

Post by Wnt2bsleepin »

Turns out that I didn't compile NRPE with the following flags

Code: Select all

–enable-command-args
Once I did that, it seems to have gone through. I was then able to query the server with the command

Code: Select all

root@<host>:/usr/local/nagios/libexec# ./check_nrpe -H ftb.<remote>.com -c check_disk -a 60 80 /
DISK OK - free space: / 17661 MB (92% inode=96%);| /=1329MB;19970;19950;0;20030
However, I do not believe that the Nagios server is querying the hosts but still looking at the local machine.
User avatar
gshergill
Posts: 231
Joined: Tue Aug 07, 2012 5:08 am

Re: Nagios only checking local

Post by gshergill »

Hi Wnt2bsleepin,

Could you run the check_disk command on the nagios machine locally, and then again using nrpe? Both from the Nagios server.

Code: Select all

./check_disk -w 60 -c 80

./check_nrpe -H ftb.<remote>.com -c check_disk -a "60 80 /"
If they give the same result, from the remote server you can run the check_disk command to double check.

Thank you.

Kind Regards,

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

Re: Nagios only checking local

Post by slansing »

Thanks for the tips gshergill!

Wnt2bsleepin, let us know what your findings are.
Wnt2bsleepin
Posts: 21
Joined: Wed Sep 18, 2013 3:22 pm

Re: Nagios only checking local

Post by Wnt2bsleepin »

gshergill wrote:Hi Wnt2bsleepin,

Could you run the check_disk command on the nagios machine locally, and then again using nrpe? Both from the Nagios server.

Code: Select all

./check_disk -w 60 -c 80

./check_nrpe -H ftb.<remote>.com -c check_disk -a "60 80 /"
If they give the same result, from the remote server you can run the check_disk command to double check.

Thank you.

Kind Regards,

Gary Shergill
Sure thing. I ran this from the machine with the full Nagios installation.

Code: Select all

root@<server>:/usr/local/nagios/libexec# ./check_disk -w 60 -c 80
DISK CRITICAL - free space: / 5954 MB (43% inode=65%); /dev 488 MB (99% inode=99%); /run 198 MB (99% inode=99%); /run/lock 5 MB (100% inode=99%); /run/shm 497 MB (100% inode=99%); /boot 98 MB (45% inode=99%);| /=7645MB;14267;14247;0;14327 /dev=0MB;428;408;0;488 /run=0MB;139;119;0;199 /run/lock=0MB;-55;-75;0;5 /run/shm=0MB;437;417;0;497 /boot=117MB;167;147;0;227

Code: Select all

root@<server>:/usr/local/nagios/libexec# ./check_nrpe -H ftb.<host>.com -c check_disk -a "60 80 /"
DISK OK - free space: / 17660 MB (92% inode=96%);| /=1330MB;19970;;0;20030
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Nagios only checking local

Post by slansing »

Yes, so it looks like the nrpe command you are running to the remote system is working as intended.
Wnt2bsleepin
Posts: 21
Joined: Wed Sep 18, 2013 3:22 pm

Re: Nagios only checking local

Post by Wnt2bsleepin »

Thank you. It does appear to be working. However, on the web panel it is now saying that there is an error with the argument

Image


Here is my command configuration

Code: Select all

define command{
      command_name check_nrpe
      command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}

and my service definition

Code: Select all

define service{
        use                                       generic-service         ; Name of servi$
        host_name                            ftb.<host>.com
        service_description                Home Partition
        check_command                   check_nrpe!check_disk!30!20!/home/
        }
I feel like I am getting there.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Nagios only checking local

Post by slansing »

You are defining three additional arguments at the service level:

Code: Select all

!20!/home/
You will need to add $ARG2$, $ARG3$, and $ARG4$ along side your original $ARG1$ in the command definition like so:

Code: Select all

command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a "$ARG2$ $ARG3$ $ARG4$"
And then in the service definition make sure that all the required flags for those arguments are in place, it looks like you are passing warning and critical thresholds so you will want to change the service definition like so:

Code: Select all

check_command                check_nrpe!check_disk!-w 30!-c 20!/home/

This should get you fixed up! :)
Wnt2bsleepin
Posts: 21
Joined: Wed Sep 18, 2013 3:22 pm

Re: Nagios only checking local

Post by Wnt2bsleepin »

That worked. Thank you for the help.

Some of the plugins I have to use the local ones on the Nagios server, for example checking the ping. Others, I have to pass the command via the check_nrpe plugin. Getting the hang of it.
Locked