NRPE installation

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.
krishnar
Posts: 13
Joined: Sun Nov 06, 2016 4:08 pm

NRPE installation

Post 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 ?
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: NRPE installation

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
krishnar
Posts: 13
Joined: Sun Nov 06, 2016 4:08 pm

Re: NRPE installation

Post 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.
krishnar
Posts: 13
Joined: Sun Nov 06, 2016 4:08 pm

Re: NRPE installation

Post 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$ 
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: NRPE installation

Post 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'
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: NRPE installation

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
krishnar
Posts: 13
Joined: Sun Nov 06, 2016 4:08 pm

Re: NRPE installation

Post 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:
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NRPE installation

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: NRPE installation

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
krishnar
Posts: 13
Joined: Sun Nov 06, 2016 4:08 pm

Re: NRPE installation

Post by krishnar »

-bash-4.2$ ./check_nrpe -h | head -7

NRPE Plugin for Nagios
Copyright (c) 1999-2008 Ethan Galstad (nagios@nagios.org)
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$
Locked