NRPE / Linux connection refused

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
Sbergonzi
Posts: 127
Joined: Wed Feb 19, 2014 4:21 pm

NRPE / Linux connection refused

Post by Sbergonzi »

I've gone through the install on Redhat (http://assets.nagios.com/downloads/nagi ... _Agent.pdf) and then used the Linux wizard in XI to configure the host.

All services are noting: "OUTPUT: Connection refused by host"
Command "COMMAND: /usr/local/nagios/libexec/check_nrpe -H <host IP> -t 30 -c check_cpu_stats -a '-w 85 -c 95'"

I set the "allow connections from" at the last step of the install, entering the NagiosXI server.

Is there anything more to do? Where is that configuration stored (the Nagios server IP)?

thank you!!

Edit:

I added the Nagios server to the hosts.allow file as well. "nrpe: <host IP> <host DNS>"
Last edited by slansing on Tue May 13, 2014 12:04 pm, edited 2 times in total.
Reason: Please do not double post, edit your previous post to add more information, double posting will only bump you lower on our reply list.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: NRPE / Linux connection refused

Post by Box293 »

The first basic test is to see if an NRPE connection can be established from your Nagios host.

Logon to the CLI of your Nagios host and type the following command:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H <host IP>
If it is working then it should respond with something like:

Code: Select all

I (0.3.7.494 2009-10-12) seem to be doing fine...
If that doesn't work, lets see if the Nagios host can talk to your Redhat server
Can you ping the Redhat server?

NRPE should be listening on port 5666 so lets test if the Nagios XI server can talk to the Redhat server on this port.
Logon to the CLI of your Nagios host and type the following command:

Code: Select all

nmap -p 5666 <host IP>
If it is working it should respond with something like:

Code: Select all

Starting Nmap 5.51 ( http://nmap.org ) at 2014-05-13 11:36 EST
Nmap scan report for <host IP>
Host is up (0.035s latency).
PORT     STATE SERVICE
5666/tcp open  nrpe
MAC Address: xxxxxxxxxxx

Nmap done: 1 IP address (1 host up) scanned in 0.25 seconds
Let us know if this has identified the area of the problem.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Sbergonzi
Posts: 127
Joined: Wed Feb 19, 2014 4:21 pm

Re: NRPE / Linux connection refused

Post by Sbergonzi »

That seems to be the problem, NRPE is not running on that port. Do I have to do something to start it? I checked the config and it is listed.

Code: Select all

Starting Nmap 5.51 ( http://nmap.org ) at 2014-05-13 09:23 ED
Nmap scan report for <host IP>
Host is up (0.072s latency).
PORT     STATE  SERVICE
5666/tcp closed nrpe

Nmap done: 1 IP address (1 host up) scanned in 0.35 seconds
Edit:

i tried to start the service and it's getting an error, is this correct?

Code: Select all

$ ./service /usr/local/nagios/bin/nrpe start
/usr/local/nagios/bin/nrpe: unrecognized service
Deleted your second post and merged it here, please do not double post as it adds clutter and bumps you lower on our to-be-replied-to list.
Last edited by slansing on Tue May 13, 2014 9:17 am, edited 1 time in total.
Reason: Deleted your second post and merged it here, please do not double post as it adds clutter and bumps you lower on our to-be-replied-to list.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: NRPE / Linux connection refused

Post by slansing »

Not sure where you got this command:

Code: Select all

./service /usr/local/nagios/bin/nrpe start
Are you running under xinetd or are you running the standalone nrpe agent...?

If you are running the standalone agent, then you can issue the following:

Code: Select all

/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
Change the directories above if they differ on your end...If using xinetd, run:

Code: Select all

service xinetd restart
That NMAP is showing you that the port is closed, that has nothing to do with NRPE specifically, you need to open 5666 TCP.

All of this is covered in numerous guides, such as but not limited to:

https://linuxmanage.com/nagios-check-ho ... lenny.html
http://nagios.sourceforge.net/docs/nrpe/NRPE.pdf
Sbergonzi
Posts: 127
Joined: Wed Feb 19, 2014 4:21 pm

Re: NRPE / Linux connection refused

Post by Sbergonzi »

i assumed, perhaps incorrectly, that the NRPE install would make it part of xinetd. it doesn't appear that was the case. i tried then to start it standalone (thank you!) and it did start. i went into Nagios and tested the services, all worked ok.

how might i make it part of xinetd so it starts automatically?

Code: Select all

$ /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
$ netstat -at | grep nrpe
tcp        0      0 *:nrpe                      *:*                         LISTEN
$ netstat -nlp | grep 5666
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:5666                0.0.0.0:*                   LISTEN      21654/nrpe
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: NRPE / Linux connection refused

Post by slansing »

Well, do you have xinetd available? You will need to add it as a "attached service" to xinetd, that is done if you use the XI Linux Agent installer to install NRPE. If you compile from source it will not add it to xinetd.

This is more of a linux admin thing than a nagios thing but there is some information about this here:

http://www.comptechdoc.org/os/linux/use ... inetd.html

You could also look at the install script for the "XI Linux Agent".
Sbergonzi
Posts: 127
Joined: Wed Feb 19, 2014 4:21 pm

Re: NRPE / Linux connection refused

Post by Sbergonzi »

ok thanks! good to close out -
Locked