Need help?

Our experts have had an average response time of 11.43 minutes in March 2024 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

NRPE port 5666 Connection refused – A Quick solution

by | Feb 13, 2020

Is your monitoring server showing the NRPE port 5666 connection refused error?

Nagios monitoring system shows Connection refused error when the server does not listen to 5666 port or if there is any firewall block.

At Bobcares, we regularly fix NRPE errors for our customers as part of our Server Management Services.

Today, let’s get into the details on how our Support Engineers fix this NRPE port 5666 Connection refused error.

 

Why do we see ‘NRPE port 5666 Connection refused’ error?

By default, Nagios Remote Plugin Executor aka NRPE uses port 5666 for its checks.

Therefore, the connection refused error displays if the NRPE traffic is not traversing a firewall, or if port 5666 of the server is not open.

Nagios works on a server-client relationship. Again, both the Nagios server and Nagios client have to be on the same network and should be able to listen to port 5666.

For instance, when there are problems with port 5666 connection, it appears as,

NRPE error 5666

 

How we fix NRPE port 5666 connection

At Bobcares, where we have more than a decade of expertise in managing servers, we see many customers face problems with ‘NRPE error 5666’.

Now, let’s see how our Support Engineers fix this error either by opening port 5666 in firewall or editing NRPE config.

 

1. Opening port 5666

Frequently, in the Nagios server panel, we could trace that the ‘NRPE error 5666’ as a critical error while monitoring different servers. The error is one of the common problems faced while we monitor the server.

Here, we assist the customer and fix the error by opening port 5666 in the firewall.

The modification of the firewall depends on the type of server and the firewall in use. Let’s now explore the major ones.

 

a) Allow port 5666 in IPTables

A major share of servers uses IPTables as their firewall. Initially, we check whether the port 5666 is listening or not by the following command.

netstat -l | grep 5666

If the port is found open, the prompt result with listening and it appears as following in the prompt.

NRPE error 5666

We then assist the customer to open the port 5666 and resolves the problem.

Hence, to open the port, we add an IPTables rule for the port. For this, we edit the IPTables file as shown below:

vi /etc/sysconfig/iptables

In the configuration file, we add the following line to open the port 5666.

-A INPUT -m state --state NEW -m tcp -p tcp --dport 5666 -j ACCEPT

Thereafter we restart the IPTables service using the following command:

service iptables restart

Finally, we save the file and restart the NRPE service.

service nrpe restart

 

b) Whitelisting port in FirewallD

In addition, for CentOS servers, we whitelist the port 5666 in FirewallD. We use the following command to whitelist the 5666 port.

firewall-cmd --zone=public --add-port=5666/tcp
firewall-cmd --zone=public --add-port=5666/tcp --permanent

That resolves the NRPE error.

 

c) Open port in Ubuntu with UFW

On servers with Ubuntu’s Uncomplicated Firewall, we open the connections on port 5666 on the monitored servers.

Here, we make sure to allows the connections only from the Nagios IP address.

ufw allow proto tcp from  to any port 5666

Finally, we restart the NRPE module:

/etc/init.d/nagios-nrpe-server start

That fixes the NRPE port 5666 Connection refused error.

 

2. Modifying NRPE configuration

Similarly, Nagios port 5666 errors can creep in due to incorrect NRPE configuration too.

In servers that report the 5666 connection refused error, we check the value of server_address in the /etc/nagios/nrpe.cfg file. We correctly add the address that nrpe should bind to.

A common mistake in the NRPE config file relates to the improperly configured “allowed_hosts” directives. This has an effect only when NRPE runs as a standalone daemon. Therefore, we correct it by adding the server IP address.

allowed_hosts=127.0.0.1,x.x.x.x

Here, x.x.x.x is the server’s IP address.

That fixes the problem and makes NRPE working again.

 

[Need any further assistance with ‘NRPE port 5666 Connection refused’ error? – We can help you with it]

 

Conclusion

In short, the NRPE error 5666 connection refused error mostly occurs due to the NRPE port 5666 restrictions in firewall or an incorrect NRPE config. Today, we saw how our Support Engineers help our customers to fix this error.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Categories

Tags

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF