Page 2 of 4

Re: Configuring NRPE client CentOS7

Posted: Fri Apr 26, 2019 2:56 pm
by tgriep
It might be a sudo permission problem causing the plugin from running so add the following line to the /etc/sudoers file.

Code: Select all

nagios ALL=NOPASSWD: /usr/local/nagios/libexec/check_services
You may need to change the command in the nrpe.cfg file from

Code: Select all

command[check_services]=/usr/local/nagios/libexec/check_services -p $ARG1$
to

Code: Select all

command[check_services]=sudo /usr/local/nagios/libexec/check_services -p $ARG1$
Verify that the nagios user has access to the plugin and it's folders.


If the check_services plugin is in the /usr/lib64/nagios/plugins/ folder, I suggest updating the commands to point to that folder.

Then, restart the NRPE agent and test it again.

Re: Configuring NRPE client CentOS7

Posted: Fri Apr 26, 2019 3:06 pm
by rferebee
It doesn't seem to be configured that way on my other Log Server (the one that's working).

Is there a way to just give the nagios account access to the entire libexec directory? Because, in theory, wouldn't you have to add a line for every single check in that directory so the nagios account can run it?

Re: Configuring NRPE client CentOS7

Posted: Mon Apr 29, 2019 8:55 am
by tgriep
Depending on the server, sometimes you have to allow the nagios user account sudo access if there are other security software but lets see what the differences between the servers.

I think I found the issue, the agent is not enabled to accept arguments.
Edit the /etc/nagios/nrpe.cfg file and change this from

Code: Select all

dont_blame_nrpe=0
to

Code: Select all

dont_blame_nrpe=1
Save the file and restart the NRPE agent.
Test it out and let us know how it works out.

Re: Configuring NRPE client CentOS7

Posted: Mon Apr 29, 2019 4:07 pm
by rferebee
I made the change you suggested. It did not resolve the issue.

Re: Configuring NRPE client CentOS7

Posted: Mon Apr 29, 2019 4:38 pm
by tgriep
I was hoping that would fix it but the next thing to do it to remove the existing NRPE agent from the server and install the agent from the Nagios site.

When I see NRPE running like this on a server

Code: Select all

/usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -f
That means it was installed by an RPM package from someone else and sometimes they do not compile it with the ability to accept arguments.

I suggest removing the RPM install of the NRPE agent and install this one.

Code: Select all

https://assets.nagios.com/downloads/nagiosxi/agents/linux-nrpe-agent.tar.gz
Documentation for installing it.
https://assets.nagios.com/downloads/nag ... _Agent.pdf

That will compile the NRPE agent to accept Arguments.
Also, the agent will change a bit. It will run as the nagios user and not the nrpe user and the agent and plugins will be in the /usr/local/nagios folder and sub folders.

Or, option 2 is to hard code the command in the existing nrpe config file like this.

Code: Select all

command[check_services]=/usr/local/nagios/libexec/check_services -p elasticsearch

Re: Configuring NRPE client CentOS7

Posted: Mon Apr 29, 2019 5:20 pm
by rferebee
Here's the thing. I installed the NRPE client myself using the Nagios instructions.

Re: Configuring NRPE client CentOS7

Posted: Tue Apr 30, 2019 10:15 am
by tgriep
What I feel is happening is that the Binary install of the NRPE agent is still running and that is causing the new install from running as they both cannot be running at the same time.
Make sure the other copy is removed or disabled from starting and that will allow the new one to run.

Re: Configuring NRPE client CentOS7

Posted: Thu May 02, 2019 3:36 pm
by rferebee
Would you be able to tell me how to do that?

I'm sorry, I'm not very Linux savvy. Before I started working with Nagios I had little to no Linux experience.

Re: Configuring NRPE client CentOS7

Posted: Thu May 02, 2019 4:09 pm
by tgriep
Run this command as root on the Centos7 server.

Code: Select all

yum list installed |grep nrpe
You should see something like this

Code: Select all

nrpe.x86_64                             3.2.1-8.el7                    @epel
That means that the nrpe binary package is installed.

To stop it, run this

Code: Select all

systemctl stop nrpe
To remove it, run this

Code: Select all

yum remove nrpe
Then check to see if the compiled version is installed, the following commands should show valid output.

Code: Select all

ls -l /etc/xinetd.d/nrpe
ls -l /usr/local/nagios/bin/nrpe
ls -l /usr/local/nagios/etc/nrpe.cfg
If they are all there, edit this file

Code: Select all

/etc/xinetd.d/nrpe
Verify that is is set like this (Replace xxx.xxx.xxx.xxx with the IP address of the Nagios server)

Code: Select all

service nrpe
{
    disable         = no
    per_source      = 25
    socket_type     = stream
    port            = 5666
    wait            = no
    user            = nagios
    group           = nagios
    server          = /usr/local/nagios/bin/nrpe
    server_args     = -c /usr/local/nagios/etc/nrpe.cfg --inetd
    only_from       = 127.0.0.1 xxx.xxx.xxx.xxx
    log_on_success  =
}
Restart xinetd

Code: Select all

service xinetd restart
Then to test it, run this from the nagios server. (Replace xxx.xxx.xxx.xxx with the IP address of the Remote Centos 7 server)

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H xxx.xxx.xxx.xxx
You should see the version of the NRPE agent.

Re: Configuring NRPE client CentOS7

Posted: Thu May 02, 2019 4:31 pm
by rferebee
Ok, I did all that.

I got the NRPE version (v3.2.1) returned from the CentOS 7 server on the Nagios XI box, but the check is still telling me "CHECK_NRPE: No output returned from daemon."