Port 5666 : connection refused

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.
smeyichou
Posts: 9
Joined: Wed May 20, 2020 3:03 am

Port 5666 : connection refused

Post by smeyichou »

Hi,

Since a few months, Nagios Core, on its interface, can't connect to one of my servers, saying : (No output on stdout) stderr: connection to adress xx.xxx.xxx.209 port 5666 : Connection refused

The host is on a CentOs server, as well as the client.

When i type, from the host server

Code: Select all

nmap xx.xxx.xxx.209
, it tells me : Port 5666/tcp closed nrpe

I read several other topics on it, but nothing works.

Also, when i type service xinetd status, it tells me xitnetd is running, on both servers (the host and the client).

Do you have any ideas what i can do? What should i check or type?

Thanks ! :)
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Port 5666 : connection refused

Post by gormank »

I'd see if the local firewall (firewalld on later Centor/RH) on the server is blocking the port or, if nrpe (or ncpa?) is actually not running.

ps -ef | egrep -i -e 'nrpe|ncpa'

This just tells if the port is open locally...
netstat -an | grep 5666
smeyichou
Posts: 9
Joined: Wed May 20, 2020 3:03 am

Re: Port 5666 : connection refused

Post by smeyichou »

Ok, for the first command (ps -ef | egrep -i -e 'nrpe|ncpa') on the main server :

Code: Select all

root     36412 36196  0 09:54 pts/0    00:00:00 egrep -i -e nrcpe|ncpa
For the second command (netstat - an | grep 5666), it gives me nothing

On the remote server (the one i can't connect to) it tells me :

Code: Select all

root     17044 17012  0 09:56 pts/0    00:00:00 egrep -i -e nrcpe|ncpa
Same for the second command, no info.
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Port 5666 : connection refused

Post by gormank »

Sorry, I meant the client/remote side, and I seem to be mistaken about nrpe/ncps showing in the process list. Here's another ps with xinetd.

# ps -ef | egrep -i -e 'nrpe|ncpa|xinetd' | egrep -v 'grep|check_nrpe'
root 1097 1 0 May19 ? 00:00:00 /usr/sbin/xinetd -stayalive -pidfile /var/run/xinetd.pid

# netstat -an | grep 5666
tcp 0 0 172.30.130.22:57454 172.30.135.64:5666 ESTABLISHED
tcp 0 0 172.30.130.22:35496 172.30.130.75:5666 ESTABLISHED
tcp 0 0 172.30.130.22:54782 172.30.130.90:5666 ESTABLISHED
tcp 0 0 172.30.130.22:47868 172.29.130.75:5666 ESTABLISHED

I'd check /etc/xinetd.d/n??? files to see what agent is used, and if its set up.

There are TS guides on the KB pages once you decide what agent is used. https://support.nagios.com/kb/
smeyichou
Posts: 9
Joined: Wed May 20, 2020 3:03 am

Re: Port 5666 : connection refused

Post by smeyichou »

Ok, here what it gives me on the remote side (the server that can't be accessed) :

# ps -ef | egrep -i -e 'nrpe|ncpa|xinetd' | egrep -v 'grep|check_nrpe'

Code: Select all

root      4054     1  0 May20 ?        00:00:00 xinetd -stayalive -pidfile /var/run/xinetd.pid
# netstat -an | grep 5666

Code: Select all

[root@serverremote ~]#
I then went to /etc/xinetd.d/ on the remote server, and here are the files in this directory :

apgd chargen-dgram chargen-stream daytime-dgram daytime-stream discard-dgram discard-stream echo-dgram echo-stream rsync tcpmux-server time-dgram time-stream

I'm a bit confused since i'm a beginner concerning Nagios, sorry. There is definitely no nrpe file in this directory.
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Port 5666 : connection refused

Post by gormank »

Could you have a look at a similar server /etc/xinetd.d/nrpe file, create it on the problem host and restart xinetd?
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Port 5666 : connection refused

Post by ssax »

Did you install NRPE on the system?

What does this output?

find / -name nrpe.cfg
service nrpe status
smeyichou
Posts: 9
Joined: Wed May 20, 2020 3:03 am

Re: Port 5666 : connection refused

Post by smeyichou »

gormank wrote:Could you have a look at a similar server /etc/xinetd.d/nrpe file, create it on the problem host and restart xinetd?
I don't have this file on any server, not the main one, and not the remote one.
ssax wrote:Did you install NRPE on the system?

What does this output?

find / -name nrpe.cfg
service nrpe status
On the main server, it tells me it is located in /usr/local/nagios/etc/nrpe.cfg
On the remote server, it doesn't find me anything

For service nrpe status, on BOTH servers, it tells me :

Code: Select all

nrpe: unrecognized service
Thanks for your help guys by the way, it's for my job so i'll tale a look at your future answers on Monday :)
smeyichou
Posts: 9
Joined: Wed May 20, 2020 3:03 am

Re: Port 5666 : connection refused

Post by smeyichou »

Do you guys need more info :?:
smeyichou
Posts: 9
Joined: Wed May 20, 2020 3:03 am

Re: Port 5666 : connection refused

Post by smeyichou »

Please save me :D
Locked