Page 1 of 4

Installing NRPE

Posted: Tue Aug 19, 2014 9:01 pm
by toleolu
I installed CentOS 6.5 and the NRPE agent on an old laptop for testing. I ran the NRPE monitoring wizard, but except for ping, all the services error with connection refused.

I got the right IP entered during the agent install, however, when I looked in nrpe.cfg the only allowed host was 127.0.0.1. I added a second line allowed hosts=xxx.xxx.xxx.xxx, but I'm thinking I should have just added a space and the ip on the same line. I get a little nervous editing these config files so I thought I would stop and ask and the pros before I go any further.

Mahalo

Re: Installing NRPE

Posted: Tue Aug 19, 2014 10:42 pm
by Box293
When NRPE runs as the xinetd service, the allowed hosts is defined in the following file:

Code: Select all

/etc/xinetd.d/nrpe
It's the line "only_from".


As a test, execute the following command

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H <centos_laptop>
If NRPE is listening and your Nagios Host is allowed, then it should report something like:

Code: Select all

NRPE v2.14

Re: Installing NRPE

Posted: Wed Aug 20, 2014 5:31 pm
by toleolu
Yep, get the response back as you indicated. I went ahead and removed that entry from nrpe.cfg.

Still get "Connection refused or timed out".

Do I need to install anything else on the CentOS laptop other than just the agent?

Re: Installing NRPE

Posted: Wed Aug 20, 2014 5:55 pm
by toleolu
Interesting development.

Saw a post about the same issue, suggested turning the firewall off, so I did, now I get "Connection refused by host" whereas before, with the firewall on, I was getting "Connection refused or timed out".

Not sure if that means anything, but thought I would mention it.

Re: Installing NRPE

Posted: Wed Aug 20, 2014 6:15 pm
by toleolu
This is strange, I saw a post here that gives you the command to get the nrpe pid. netstat -at | grep nrpe

When I run that from the laptop, I don't get a pid, I get:

tcp 0 0 *:nrpe *:* LISTEN

Is anything in there the pid?

Re: Installing NRPE

Posted: Wed Aug 20, 2014 8:48 pm
by Box293
NRPE is clearly listening, we just need to work out why the checks aren't

Can you attach your nrpe.cfg file and also show your test command from the CLI.

Re: Installing NRPE

Posted: Thu Aug 21, 2014 12:40 pm
by toleolu
Thanks, here's the command:

[root@hhscnagios ~]# /usr/local/nagios/libexec/check_nrpe -H 10.5.190.51 -t 600 -p 15677 -c check_load
Connection refused by host

Just FYI, Ping does work.

I double checked with our network team and we don't block any ports on the internal network, but while troubleshooting, I turned the firewall off on both the Nagios XI server and the laptop, but that didn't fix the problem.

The config wizard prompts for SSL, says it's set by default, I tried it both ways but neither worked either. I suspect if that were the problem though I would get a different error message.

Nrpe.cfg is attached.

Mahalo

Re: Installing NRPE

Posted: Thu Aug 21, 2014 3:30 pm
by abrist
You are specifying port 15677 in your check_nrpe command, but the nrpe.cfg you sent uses port 5666.
1) Are you using xinetd?
1b) If so, did you configure it to use port 15677?
2) Lets run a port scan on the remote nrpe host from the XI server:

Code: Select all

nmap <remote host ip> -p 5666,15677 

Re: Installing NRPE

Posted: Thu Aug 21, 2014 4:11 pm
by toleolu
I didn't do anything with the ports, that port 15677 is in check_nrpe command. I ran nmap like you suggested and it shows port 5666 open and 15677 closed so I changed the port number in the command to 5666. Now it connects, but it looks like I have a plugin issue. I ran the standard nrpe monitoring wizard and just selected load, users, and processes, just the defaults that come up in the wizard and I get:

Load says: Status Unknown check_load: Could not parse arguments.
Usage:check_load [-r] -w WLOAD1,WLOAD5,WLOAD15 -c CLOAD1,CLOAD5,CLOAD15

Users says: Status Unknown (No output returned from plugin)

Processes says: Status Critical NRPE:Command 'check_total_procs' not defined.

To back up here, all I originally set out to do what test installing the client for your Linux servers. So with that in mind, is this best way to install a Linux client, or is there a better way to set up monitoring on a Linux server?

Mahalo;

Re: Installing NRPE

Posted: Thu Aug 21, 2014 4:56 pm
by abrist
The best method is to install our linux agent on the linux host (you can download the agent tarball/install from the second page of the linux wizard).
http://assets.nagios.com/downloads/nagi ... _Agent.pdf