Some Nagios Core checks need information that only exists on the monitored Linux host, such as local disk usage, process state, or a site-specific script result. NRPE handles that handoff by letting the monitoring server request a named command while the monitored host runs the actual plugin.
Place the new NRPE entry on the monitored host, not in the main Nagios Core object files. The NRPE daemon reads definitions from /etc/nagios/nrpe.cfg and included drop-in files, then maps a request such as check_disk_root to one fixed plugin command line.
Keep routine NRPE commands fixed and avoid client-supplied arguments unless a specific check needs them. A completed change should let the monitoring server run check_nrpe against the new command name, validate the Nagios Core service object, and record the returned plugin output as a normal active service check.
$ sudo cat /etc/nagios/nrpe.cfg ##### snipped ##### allowed_hosts=127.0.0.1,::1,monitor.example.net dont_blame_nrpe=0 include=/etc/nagios/nrpe_local.cfg include_dir=/etc/nagios/nrpe.d/ ##### snipped #####
Use the allowed_hosts value that matches the real Nagios Core server address. A fixed command does not require dont_blame_nrpe=1.
$ /usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p / DISK OK - free space: / 104957MiB (91.7% inode=98%);| /=9980346368B;101195133747;113844525465;0;126493917184
Use the plugin path from the monitored host. Debian and Ubuntu package installs place standard monitoring plugins under /usr/lib/nagios/plugins.
Related: How to run a Nagios plugin manually
$ sudoedit /etc/nagios/nrpe.d/check_disk_root.cfg
command[check_disk_root]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /
The name inside command[...] is the command name that check_nrpe requests from the monitoring server.
Do not expose unrestricted shell commands through NRPE. Fixed plugin arguments reduce the risk created by remote command argument processing.
$ sudo systemctl restart nagios-nrpe-server
Debian and Ubuntu package installs use the nagios-nrpe-server service name. Source installs or other distributions may use nrpe instead.
$ /usr/lib/nagios/plugins/check_nrpe -H web01.example.net -c check_disk_root DISK OK - free space: / 104957MiB (91.7% inode=98%);| /=9980346368B;101195133747;113844525465;0;126493917184
A successful response proves that the monitoring server can reach the NRPE daemon and that the command name maps to the intended plugin result.
$ sudoedit /etc/nagios4/conf.d/web01-nrpe-disk.cfg
The host object for web01.example.net must already exist. Add the host first when Nagios Core does not know that host yet.
Related: How to add a host in Nagios Core
define service { use generic-service host_name web01.example.net service_description Disk Usage check_command check_nrpe!check_disk_root }
Debian and Ubuntu packages provide the check_nrpe command object through /etc/nagios-plugins/config/check_nrpe.cfg. Source installs may need a matching command definition before this service parses.
Related: How to define a Nagios Core check command
Related: How to add a service check in Nagios Core
$ sudo nagios4 -v /etc/nagios4/nagios.cfg Nagios Core 4.4.6 ##### snipped ##### Reading configuration data... Read main config file okay... Read object config files okay... ##### snipped ##### Total Warnings: 0 Total Errors: 0 Things look okay - No serious problems were detected during the pre-flight check
Fix every reported object, command, template, or path error before reloading Nagios Core.
Related: How to validate the Nagios Core configuration
$ sudo systemctl reload nagios4
Ubuntu and Debian package installs use the nagios4 unit. Use the service name or source-install control method for the local installation.
Related: How to manage the Nagios Core system service
$ sudo cat /var/lib/nagios4/status.dat
##### snipped #####
servicestatus {
host_name=web01.example.net
service_description=Disk Usage
check_command=check_nrpe!check_disk_root
has_been_checked=1
current_state=0
plugin_output=DISK OK - free space: / 104957MiB (91.7% inode=98%):
##### snipped #####
Use the Services view or reschedule the active check if the service remains pending after the reload.
Related: How to reschedule an active check in Nagios Core