Skip to content

Nagios NRPE Connection Error — Quick Fix

DodaTech Updated 2026-06-24 2 min read

In this tutorial, you'll learn about Nagios NRPE Connection Error. We cover key concepts, practical examples, and best practices.

The Problem

Nagios cannot execute checks via NRPE on a remote host. The Nagios server shows "NRPE: Unable to read output" or "Connection refused by host." Remote checks return "CHECK_NRPE: Socket timeout after 10 seconds."

Error example:

CHECK_NRPE: Error - Could not connect to 192.168.1.100:5666
NRPE: Unable to read output
Connection refused by host

The Fix

Step 1: Check the NRPE daemon on the remote host

WRONG — modifying the Nagios server config without checking the remote host:

# The problem is almost always on the remote host

RIGHT — check NRPE status on the remote host:

systemctl status nagios-nrpe-server

Output:

nagios-nrpe-server.service - Nagios Remote Plugin Executor
   Loaded: loaded
   Active: inactive (dead)

Start and enable it:

systemctl enable --now nagios-nrpe-server

Step 2: Verify allowed_hosts and firewall

WRONG — allowing all hosts in nrpe.cfg:

# allowed_hosts=0.0.0.0/0 is a security risk

RIGHT — add the Nagios server's IP to allowed_hosts:

grep allowed_hosts /etc/nagios/nrpe.cfg

Output:

allowed_hosts=127.0.0.1,192.168.1.50

Ensure the firewall allows port 5666:

firewall-cmd --add-port=5666/tcp --permanent
firewall-cmd --reload

Use DodaTech's NRPE Connection Tester to validate NRPE configurations, test command execution, and diagnose timeout issues from a single interface.

Prevention Tips

  • Use the same NRPE version on all monitored hosts
  • Restrict allowed_hosts to your Nagios server's IP only
  • Configure firewall rules for port 5666, not SELinux-only exceptions
  • Test NRPE commands locally on the remote host before deploying
  • Use DodaTech's Nagios Fleet Manager for centralized NRPE configuration

Common Mistakes with nrpe connect

  1. Non-exhaustive pattern matches that compile with warnings then crash at runtime
  2. Misunderstanding that String is [Char] with poor performance for large text operations
  3. Using foldl instead of foldl' causing stack overflow on large lists

These mistakes appear frequently in real-world NAGIOS code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### What is the default NRPE port?

NRPE uses TCP port 5666. The check_nrpe plugin connects to this port on the remote host. Make sure this port is open in the firewall on the remote host and that the Nagios server can reach it.

How do I test NRPE from the command line?

Use check_nrpe -H 192.168.1.100 -c check_load to run a specific NRPE command. Use check_nrpe -H 192.168.1.100 without the -c flag to verify the NRPE daemon is responding at all. This returns the NRPE version number.

Why does NRPE return "NRPE: Unable to read output"?

This error means NRPE connected successfully but the command produced no output or timed out. Check that the command specified in nrpe.cfg exists, is executable, and returns output to stdout. Run the command locally on the remote host to verify.

Related: DodaTech's Nagios Migration Toolkit provides automated NRPE configuration, testing, and deployment for large-scale monitoring rollouts.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro