Nagios Core performance data is the metric portion of a host or service check result. Enabling performance data processing lets the monitoring server hand round-trip time, packet loss, disk usage, load, and similar plugin values to graphing or capacity tools instead of keeping only the visible status text.

Nagios Core uses two controls for this handoff. The global process_performance_data option turns processing on, while file or command directives decide where host and service metrics go after each check.

Debian and Ubuntu packages store the main config under /etc/nagios4/nagios.cfg and expose the nagios4 service. Source installs commonly use /usr/local/nagios/etc/nagios.cfg, and their perfdata files are often placed under /usr/local/nagios/var instead.

Steps to enable Nagios Core performance data:

  1. Check the current global performance data setting.
    $ sudo grep -E '^(process_performance_data|host_perfdata_file|service_perfdata_file)' /etc/nagios4/nagios.cfg
    process_performance_data=0

    A package install may not define perfdata files until they are added. A source install may already have sample file or command directives in the main config.

  2. Open the active Nagios Core main configuration file.
    $ sudoedit /etc/nagios4/nagios.cfg

    Use /usr/local/nagios/etc/nagios.cfg on source installs that follow the upstream default layout.

  3. Enable global performance data processing.
    process_performance_data=1

    Nagios Core writes perfdata files or runs perfdata command handlers only when this option is enabled.

  4. Configure host and service performance data files.
    host_perfdata_file=/var/lib/nagios4/host-perfdata
    service_perfdata_file=/var/lib/nagios4/service-perfdata
    host_perfdata_file_template=[HOSTPERFDATA]\t$TIMET$\t$HOSTNAME$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$
    service_perfdata_file_template=[SERVICEPERFDATA]\t$TIMET$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$
    host_perfdata_file_mode=a
    service_perfdata_file_mode=a

    File output keeps the runtime cost lower than running a command after every check. Use host_perfdata_command and service_perfdata_command only when an addon requires command processing instead of file input.

  5. Confirm the target object or inherited template allows performance data.
    define service {
        use                    generic-service
        host_name              localhost
        service_description    PING
        check_command          check_ping!100.0,20%!500.0,60%
        process_perf_data      1
    }

    Packaged templates commonly set process_perf_data 1. Add an object-level override only when a host, service, or template disables perfdata for a check that should be exported.

  6. Validate the Nagios Core configuration.
    $ 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

    Do not reload Nagios Core while Total Errors is greater than 0. Fix the first reported object, template, or main-config error first.
    Related: How to validate the Nagios Core configuration

  7. Reload Nagios Core to apply the accepted performance data settings.
    $ sudo systemctl reload nagios4

    Ubuntu and Debian package installs use the nagios4 service name. Source installs may use nagios, an init script, or a direct SIGHUP signal instead.
    Related: How to manage the Nagios Core system service

  8. Run a plugin manually when the target check has not returned perfdata before.
    $ sudo -u nagios /usr/lib/nagios/plugins/check_ping -H 127.0.0.1 -w 100.0,20% -c 500.0,60%
    PING OK - Packet loss = 0%, RTA = 0.09 ms|rta=0.088000ms;100.000000;500.000000;0.000000 pl=0%;20;60;0;

    The text after | is plugin performance data. Checks with no text after the pipe cannot populate $SERVICEPERFDATA$ or $HOSTPERFDATA$.
    Related: How to run a Nagios plugin manually

  9. Wait for Nagios Core to run the host or service check.

    Use the web UI Re-schedule the next check command when the next scheduled active check is too far away.
    Related: How to reschedule an active check in Nagios Core

  10. Verify that Nagios Core appended service performance data.
    $ sudo cat /var/lib/nagios4/service-perfdata
    [SERVICEPERFDATA]	1782347914	localhost	PING	4.127	0.000	PING OK - Packet loss = 0%, RTA = 0.04 ms	rta=0.044000ms;100.000000;500.000000;0.000000 pl=0%;20;60;0;

    A non-empty service perfdata file confirms that Nagios Core accepted plugin output after the reload and applied the service file template. Host performance data appears in /var/lib/nagios4/host-perfdata after host checks run.

  11. Open the service detail page when the web UI should show the same metric string.
    http://monitor.example.net/nagios4/cgi-bin/extinfo.cgi?type=2&host=localhost&service=PING

    The Performance Data row should match the metric text written after the final tab in the service perfdata file.