NRPE refused connection

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.
Locked
as300182
Posts: 36
Joined: Tue May 17, 2016 8:09 am

NRPE refused connection

Post by as300182 »

I've exhausted all the avenues I know so I'm turning to the forum for help.

I have a server (dev-int) running NRPE.
I have 2 Nagios servers that can connect without any problem.
I have added a third Nagios server and I get this in the syslog of dev-int running NRPE.

Code: Select all

Jan 19 11:41:50 dev-int nrpe[18468]: CONN_CHECK_PEER: checking if host is allowed: 10.58.2.44 port 8360
Jan 19 11:41:50 dev-int nrpe[18468]: is_an_allowed_host (AF_INET): is host >10.58.2.44< an allowed host >10.58.2.44<
Jan 19 11:41:50 dev-int nrpe[18468]: refused connect from 10.58.2.44 (10.58.2.44)
I have added 10.58.2.44 to both the nrpe.cfg file, and the /etc/xinetd.d/nrpe file and restarted both services, but without success. I still get connection refused. I can obviously get to the server or I wouldn't have an entry in the syslog. There's no local firewall that I can detect. Running 'service iptables status' comes back with an unrecognised service.

So something on dev-int is refusing the connection but I haven't a clue what it could be.

Can anyone put me out of my misery please?
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: NRPE refused connection

Post by npolovenko »

Hello, @as300182. How did you install the NRPE? Do you have a link to the tutorial you've used? When you add the IP address in /etc/xinetd.d/nrpe, you need to separate them with spaces, and when you add IP's to nagios.cfg you need to separate them with commas.
What version of check_nrpe plugin does the new Nagios server have? And what version do the old servers use? You can test that by running ./check_nrpe with no arguments:

Code: Select all

/usr/local/nagios/libexec/check_nrpe
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
as300182
Posts: 36
Joined: Tue May 17, 2016 8:09 am

Re: NRPE refused connection

Post by as300182 »

I'm running the latest version of NRPE. I think the issue was with the nrpe.cfg file. I still can't see what's wrong with the original config file, but I replaced it with the base config file that is installed when you build NRPE, and then updated it with my changes. After a restart of the service it's working a treat. I'm guessing there's a non unix character in there somewhere, but as I say, I can't see it.

I followed the old 'start from scratch with the minimum of settings' approach and it paid off. Wish I'd tried that to start with now. I wonder. Is there a Linux tool that can scan text files for dodgy characters?
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: NRPE refused connection

Post by lmiltchev »

You can open the file in "vi", type the following text, and hit "Enter":

Code: Select all

:set ff?
You should see:

Code: Select all

fileformat=unix
If you see anything else, for example "dos" instead of "unix", you could type:

Code: Select all

:set ff=unix
and hit "Enter". This will fix the format.

You could also use "dos2unix" program to convert the file. If you don't have it installed, run (on RHEL/CentOS):

Code: Select all

yum install dos2unix -y
or run (on Ubuntu/Debian):

Code: Select all

sudo apt-get install dos2unix
You can view the usage (help menu) by running:

Code: Select all

dos2unix --help
Hope this helps.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked