Page 1 of 2

NRPE installation

Posted: Fri Apr 07, 2017 12:09 pm
by krishnar
Hi All,

I need help with installing NRPE is my lab Nagios Server. I have follow these instruction to install NRPE:

Code: Select all

wget https://github.com/NagiosEnterprises/nrpe/archive/3.0.1.tar.gz
gunzip  3.0.1.tar.gz 
tar -xf 3.0.1.tar 
cd nrpe-3.0.1/
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make all
make install
This configuration install NRPE plug to /usr/local/nagios folder. However, my Nagios is running in /opt/nagios.

Is there any way I can change the installation path to /opt/nagios ?

Re: NRPE installation

Posted: Fri Apr 07, 2017 1:09 pm
by tgriep
When you run the configure script, you can change the destination of where the Agent is installed by using the prefix option.
In your case, you would run the following to install in the /opt/nagios folder.

Code: Select all

./configure --with-nagios-user=nagios --with-nagios-group=nagios --prefix=/opt/nagios

Re: NRPE installation

Posted: Fri Apr 07, 2017 1:35 pm
by krishnar
Thank you for helping me..I have got one more query.

Code: Select all

[user@krishnar1 etc]$ cat nrpe.cfg | egrep ^command.*check_users
command[check_users]=/usr/local/nagios/libexec/check_users -w $ARG1$ -c $ARG2$
I have the above config in my remote host. I am not able to do the check from Nagios Core with passing the arguments.

-bash-4.2$ ./check_nrpe -H 172.31.116.108 -4 -c check_users -a 1 2
NRPE: Command 'check_users!1!2' not defined
-bash-4.2$

But this works fine!

-bash-4.2$ ./check_nrpe -H 172.31.116.108 -4 -c check_users
USERS OK - 1 users currently logged in |users=1;5;10;0
-bash-4.2$

Any help would be appreciated.

Re: NRPE installation

Posted: Fri Apr 07, 2017 1:54 pm
by krishnar
After NRPE service restart in Remote host:

Code: Select all

-bash-4.2$ ./check_nrpe -H 172.31.116.108 -4 -c check_users
check_users: Warning threshold must be a positive integer
Usage:
check_users -w <users> -c <users>
-bash-4.2$ 
-bash-4.2$ 
-bash-4.2$ ./check_nrpe -H 172.31.116.108 -4 -c check_users -a 5 10
check_users: Warning threshold must be a positive integer
Usage:
check_users -w <users> -c <users>
-bash-4.2$ 

Re: NRPE installation

Posted: Fri Apr 07, 2017 1:56 pm
by tgriep
There is a setting in the nrpe.cfg file called dont_blame_nrpe option. If it is set to 0, this disables the ability to pass arguments to the NRPE Agent and could be causing your issue.
Set that option to a 1 and restart the nrpe agent and see if you can pass arguments with the check_nrpe command.
You always have to restart the nrpe agent if you edit the nrpe,cfg file, BTW.

Also, try running your command like the following and see if that works.

Code: Select all

./check_nrpe -H 172.31.116.108 -4 -c check_users -a '5 10'

Re: NRPE installation

Posted: Fri Apr 07, 2017 1:57 pm
by lmiltchev
Change this line (in the nrpe.cfg file) from this:

Code: Select all

dont_blame_nrpe=0
to this:

Code: Select all

dont_blame_nrpe=1
and restart nrpe service (if nrpe is running as a standalone daemon) or xinet.

Let us know if this helped.

Re: NRPE installation

Posted: Fri Apr 07, 2017 3:07 pm
by krishnar
Oops..I forgot to mention that earlier..I had already enabled that option and restarted NRPE daemon in remote host after making changes to nrpe.cfg.

Code: Select all

[user@krishnar1 etc]$ grep blame nrpe.cfg
dont_blame_nrpe=1
# command arguments *AND* the dont_blame_nrpe directive in this
[user@krishnar1 etc]$ 
[user@krishnar1 etc]$ grep command_sub nrpe.cfg
allow_bash_command_substitution=1
From Nagios Core Host:
-bash-4.2$ ./check_nrpe -H 172.31.116.108 -4 -c check_users -a '5 10'
NRPE: Command 'check_users!5 10' not defined

The error says command is not defined.

This is the command definition in remote host nrpe.cfg file.

[user@krishnar1 etc]$ grep check_users nrpe.cfg
#command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_users]=/usr/local/nagios/libexec/check_users -w $ARG1$ -c $ARG2$
#command[check_users]=/usr/local/nagios/libexec/check_users -w $ARG1$ -c $ARG2$
[user@krishnar1 etc]$

Totally confused! :cry: :cry: :cry:

Re: NRPE installation

Posted: Fri Apr 07, 2017 3:43 pm
by scottwilkerson
Out of curiosity what version of check_nrpe do you have on your Nagios Core host

Code: Select all

./check_nrpe -h|head -7

Re: NRPE installation

Posted: Sun Apr 09, 2017 8:17 pm
by Box293
The ./configure command requires --enable-command-args.

This is explained under the Compile section in this guide: https://support.nagios.com/kb/article.php?id=515

You may also find this document helpful:
https://assets.nagios.com/downloads/nag ... utions.pdf

Re: NRPE installation

Posted: Mon Apr 10, 2017 11:34 am
by krishnar
-bash-4.2$ ./check_nrpe -h | head -7

NRPE Plugin for Nagios
Copyright (c) 1999-2008 Ethan Galstad ([email protected])
Version: 3.0.1
Last Modified: 09-08-2016
License: GPL v2 with exemptions (-l for more info)
SSL/TLS Available: OpenSSL 0.9.6 or higher required
-bash-4.2$