Skip to content
Tutorials Center
My learning

Topics

Lesson 29 of 37 ยท Scaling and Proxies

Nagios Distributed Monitoring: NRPE, NSCA and Satellites

Scale Nagios Core with NRPE, NCPA, passive checks via NSCA or NRDP, and satellite servers, and compare these approaches with Zabbix agents and proxies.

Nagios Core executes a plugin on the monitoring server for every check. That works for network checks (ping, HTTP, SSH), but not for what is inside a host: disk space, load, running processes. Also, a single server running thousands of checks every minute reaches its limit. Nagios scaling therefore relies on two ideas: running checks remotely, and sending results in from elsewhere. This lesson covers NRPE, NCPA, passive checks and satellite designs, and compares them with Zabbix. Nagios cannot run on this site, so commands and config are read-only and the stand-ins are simulations.

Remote execution with NRPE

NRPE (Nagios Remote Plugin Executor) has two parts: a daemon nrpe on the monitored host, and the plugin check_nrpe on the Nagios server. The server runs check_nrpe, which asks the daemon to run a named command, and returns the output and exit code.

On the monitored host (nrpe.cfg):

INI
server_port=5666
allowed_hosts=127.0.0.1,10.0.0.5
dont_blame_nrpe=0
command[check_disk_root]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /
command[check_load]=/usr/lib/nagios/plugins/check_load -w 4,3,2 -c 8,6,4

On the Nagios server:

TEXT
define command {
    command_name    check_nrpe
    command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
define service {
    use                     generic-service
    hostgroup_name          linux-servers
    service_description     Disk /
    check_command           check_nrpe!check_disk_root
}

Security notes: only named commands in the config can run; leave dont_blame_nrpe=0 so arguments cannot be passed freely from the server (passing arguments makes injection possible); restrict allowed_hosts; use TLS (the modern NRPE uses TLS by default, older v2 used anonymous SSL).

Like Zabbix passive checks, NRPE is server-initiated: the server connects to port 5666 on every host, so scale and firewalls are the same concerns.

NCPA and other agents

NCPA (Nagios Cross-Platform Agent) replaces NRPE on Windows, Linux and macOS with a single agent that exposes an HTTPS API and also supports passive reporting. NSClient++ is the common Windows agent, speaking NRPE and its own protocol. SNMP checks with check_snmp need no agent at all.

Passive checks: NSCA and NRDP

In a passive check, the monitored host (or a collector) sends results to Nagios, which only processes them:

  • NSCA (Nagios Service Check Acceptor): a daemon on the Nagios server that accepts results from send_nsca clients and writes them to the external command file.
  • NRDP: the same idea over HTTP(S) with a token, easier through proxies and firewalls.

A service becomes passive with active_checks_enabled 0 and passive_checks_enabled 1, plus check_freshness 1 and freshness_threshold 600 so that Nagios raises an alert if the result stops arriving. Without freshness checking, a dead sender looks like a healthy service.

TEXT
# a result line sent over NSCA (tab separated):
web01<TAB>Backup job<TAB>0<TAB>OK - last run 02:15, 14 GB

The status codes: 0 OK, 1 WARNING, 2 CRITICAL, 3 UNKNOWN.

Satellites and distributed designs

When one server cannot cope or when sites are far apart, you add satellite (also called poller or collector) Nagios instances:

  1. Each satellite runs its own Nagios Core with checks for its location.
  2. Results travel to the central Nagios through NSCA or NRDP as passive results.
  3. The central server holds only passive services and shows the global view, runs notifications and escalations.
  4. Configuration is generated and pushed to satellites from one source of truth (Ansible, Git).

Another approach is Mod-Gearman: a broker queue (Gearman) distributes check jobs from the central server to worker nodes, which return results. The central core keeps the configuration and notifications; workers are interchangeable. Many large Nagios shops used it before moving to other designs. Naemon and Icinga 2 have built-in clustering (Icinga's endpoints, zones) as their answer.

graph TD
  C["Central Nagios<br/>passive services, notifications"]
  S1["Satellite Berlin"] -- "NSCA / NRDP" --> C
  S2["Satellite Tokyo"] -- "NSCA / NRDP" --> C
  H1["Hosts"] --> S1
  H2["Hosts"] --> S2

Satellites run the checks; the central server gathers results and sends alerts.

Comparison with Zabbix

Need Nagios Zabbix
Check inside a host NRPE / NCPA / NSClient++ Zabbix agent
Hosts push results NSCA / NRDP Active agent, zabbix_sender
Regional collector Satellite instance, Mod-Gearman Proxy
Central configuration Generated files, Git Server pushes config to proxies
Buffering during outage Not built in Proxy and agent buffers

Zabbix proxies receive their configuration automatically and buffer values; Nagios satellites need a configuration process you build yourself.

Stand-in: NRPE round trip

This simulation mirrors what check_nrpe does: a named command executes on the host and returns a status with perfdata. It is not the real protocol.

Python Named-command execution model (Python stand-in)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Unknown commands never run: this is why a fixed command list is the safer way.

Stand-in: freshness check

Python Freshness threshold for passive results (Python stand-in)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does check_nrpe do?

    check_nrpe asks the remote daemon to run a configured command.
  2. 2. Why enable check_freshness for passive services?

    Without freshness checking, a silent sender looks healthy.
  3. 3. What do satellite Nagios servers send to the central server?

    Satellites run checks locally and forward results as passive checks.
  4. 4. Which Zabbix component corresponds to a Nagios satellite?

    A proxy collects at a site and forwards values to the server.

Summary

  • NRPE, NCPA and NSClient++ run checks inside hosts; NRPE is server-initiated and should use fixed commands.
  • Passive checks (NSCA, NRDP) push results to Nagios; use freshness checks to detect silent senders.
  • Satellites and Mod-Gearman distribute work; configuration management is your responsibility.
  • Zabbix proxies give the same scaling with automatic configuration and buffering.

Next: The Zabbix API and Automation