Host availability in Nagios Core is the host-level UP or DOWN signal that tells operators whether a monitored device can be reached before service alerts are interpreted. A ping-backed host check is the usual first monitor for servers, routers, and endpoints that should answer ICMP from the monitoring server.

The packaged linux-server host template uses check-host-alive by default on Ubuntu and Debian systems. Nagios Core loads that definition from /etc/nagios-plugins/config/ping.cfg, where it runs check_ping against the host object's address value, so an explicit check_command keeps the reachability test visible in the host object.

Custom host objects can be placed under /etc/nagios4/conf.d and validated with nagios4 -v before the nagios4 service is reloaded. Use an address that the monitoring server can ping; if the target blocks ICMP by policy, choose a different host check command instead of treating a permanent DOWN state as a Nagios failure.

Steps to monitor host availability with Nagios Core:

  1. Run the packaged ping check from the monitoring server.
    $ sudo -u nagios /usr/lib/nagios/plugins/check_ping -H 10.0.20.15 -w 5000,100% -c 5000,100% -p 1
    PING OK - Packet loss = 0%, RTA = 0.04 ms|rta=0.037000ms;5000.000000;5000.000000;0.000000 pl=0%;100;100;0;

    The default check-host-alive command in the Ubuntu and Debian plugin package uses these thresholds with the host object's address value.
    Related: How to run a Nagios plugin manually
    Related: How to install Nagios plugins

  2. Create an object file for the host.
    $ sudo vi /etc/nagios4/conf.d/host-availability-monitor.cfg

    Use an existing host object instead when web01.example.net is already defined. Nagios Core rejects duplicate host_name values.
    Related: How to add a host in Nagios Core

  3. Add the host object with the standard host availability check.
    define host{
        use                     linux-server
        host_name               web01.example.net
        alias                   Web 01
        address                 10.0.20.15
        check_command           check-host-alive
        max_check_attempts      3
        check_interval          5
        retry_interval          1
    }

    The linux-server template supplies notification and time-period defaults. The explicit check_command line documents that this host is checked with the standard ping-based host command.

  4. 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 #####
    Checking objects...
            Checked 8 services.
            Checked 2 hosts.
            Checked 1 host groups.
            Checked 0 service groups.
            Checked 1 contacts.
            Checked 1 contact groups.
            Checked 180 commands.
            Checked 5 time periods.
    ##### 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 the verifier reports errors. Fix object syntax, duplicate names, missing templates, or missing command definitions first.
    Related: How to validate the Nagios Core configuration

  5. Reload the nagios4 service.
    $ sudo systemctl reload nagios4

    The packaged systemd unit reloads Nagios Core with SIGHUP. Use the local service name and reload method when Nagios Core was installed from source.
    Related: How to manage the Nagios Core system service

  6. Check the host in the Nagios Core web UI after the next host check runs.
    http://monitor.example.net/nagios4/

    Open Hosts, select web01.example.net, and confirm Current Status is UP with PING OK in Status Information. Use Schedule a check of this host if the host remains Pending.
    Related: How to troubleshoot a Nagios Core host down alert