Local resource checks in Nagios Core need an agent when the status depends on data that only exists on the monitored Linux host. NRPE gives the monitoring server a small TCP listener that runs named Nagios plugins on that host and returns the plugin result.
The package path here uses current Debian and Ubuntu packages on the monitored host. The nagios-nrpe-server package installs the NRPE daemon, /etc/nagios/nrpe.cfg stores the main listener settings, /etc/nagios/nrpe.d can hold drop-in command files, and /usr/lib/nagios/plugins contains the plugins that NRPE runs.
The Nagios Core server reaches the agent with the check_nrpe plugin over TCP port 5666. Limit allowed_hosts to the monitoring server, keep dont_blame_nrpe disabled unless a specific command requires remote arguments, and verify one named command before adding NRPE service checks to Nagios object files.
$ sudo apt update
$ sudo apt install nagios-nrpe-server monitoring-plugins-basic monitoring-plugins-standard Reading package lists... The following NEW packages will be installed: monitoring-plugins-basic monitoring-plugins-standard nagios-nrpe-server ##### snipped ##### Setting up nagios-nrpe-server (4.1.3-1ubuntu2) ...
On RPM-based Linux hosts, install the supported nrpe package and matching monitoring plugins from the distribution, EPEL, or vendor repository used by that host.
$ sudoedit /etc/nagios/nrpe.cfg
allowed_hosts=127.0.0.1,::1,192.0.2.20 dont_blame_nrpe=0
Replace 192.0.2.20 with the real Nagios Core server address. Do not add broad networks unless the host is inside a trusted monitoring subnet.
$ sudo systemctl restart nagios-nrpe-server
Restarting applies the changed allowed_hosts setting to the listener.
Related: How to manage the Nagios Core system service
$ sudo systemctl enable nagios-nrpe-server
Package installs on some systems start the service immediately, but enabling it keeps the listener available after a reboot.
Related: How to manage the Nagios Core system service
$ systemctl is-active nagios-nrpe-server active
If the service is not active, inspect sudo journalctl -u nagios-nrpe-server before changing the Nagios server configuration.
$ /usr/lib/nagios/plugins/check_users -w 5 -c 10 USERS OK - 0 users currently logged in |users=0;5;10;0
The default NRPE configuration exposes named commands such as check_users and check_load. Local plugin success confirms the plugin path works before the monitoring server calls it.
$ sudo ufw allow from 192.0.2.20 to any port 5666 proto tcp Rule added
Use the equivalent rule in firewalld, nftables, iptables, a host firewall, or a cloud security group when UFW is not the active firewall.
$ sudo apt install nagios-nrpe-plugin
$ /usr/lib/nagios/plugins/check_nrpe -H web01.example.net NRPE v4.1.3
Replace web01.example.net with the monitored host name or address. A timeout points to routing, firewall, or allowed_hosts; a refused connection points to the NRPE service or listener address.
$ /usr/lib/nagios/plugins/check_nrpe -H web01.example.net -c check_users USERS OK - 0 users currently logged in |users=0;5;10;0
Add site-specific commands under /etc/nagios/nrpe.d after the agent is reachable.
Related: How to add an NRPE command for Nagios Core
Related: How to monitor a Linux host with NRPE in Nagios Core