Nagios Core needs a host object before it can track a server, router, appliance, or endpoint in status views. A host object gives the monitored target an object name, address, template, and optional group membership so later service checks can attach to the same inventory entry.

Host objects live in the object configuration files loaded by cfg_file and cfg_dir entries from the main nagios.cfg file. On Ubuntu and Debian package installs, site-specific objects commonly belong under /etc/nagios4/conf.d, while source installs often use paths below /usr/local/nagios/etc.

Use the packaged linux-server template when the target should inherit the default ping-style host check, retry intervals, and administrator notifications. Replace the placeholder host name and documentation address with the real IP address or DNS name that Nagios Core should check; an unreachable address can appear in the web UI as DOWN even when the object was added correctly.

Steps to add a Nagios Core host object:

  1. List the object directories loaded by the main configuration.
    $ grep '^cfg_dir=' /etc/nagios4/nagios.cfg
    cfg_dir=/etc/nagios-plugins/config
    cfg_dir=/etc/nagios4/conf.d

    Current Ubuntu and Debian packages include /etc/nagios4/conf.d by default. Add a cfg_dir entry first when your installation stores custom objects somewhere else.
    Related: How to add a Nagios Core object configuration directory

  2. Open a host object file for the new target.
    $ sudoedit /etc/nagios4/conf.d/web01.cfg
  3. Add the host definition.
    /etc/nagios4/conf.d/web01.cfg
    define host {
        use                     linux-server
        host_name               web01.example.net
        alias                   Web 01
        address                 192.0.2.10
        hostgroups              linux-servers
    }

    The linux-server template supplies the packaged host check command, retry settings, notification period, and contact group. Replace or remove hostgroups when the target belongs to a different existing host group, and use a reachable address instead of the documentation range.

  4. Validate the full Nagios Core configuration before applying the object.
    $ 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.
    ##### 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 file and line, then run the verifier again.

  5. Reload Nagios Core to rebuild the runtime object cache.
    $ sudo systemctl reload nagios4

    The Ubuntu and Debian package unit supports reload. Use the local service name or source-install control script when Nagios Core was installed outside the package layout.
    Related: How to manage the Nagios Core system service

  6. Confirm that the host reached the object cache used by the web interface.
    $ grep web01.example.net /var/lib/nagios4/objects.cache
            members localhost,web01.example.net
            host_name       web01.example.net

    Source installs commonly keep the cache under /usr/local/nagios/var/objects.cache instead.

  7. Open the Nagios Core host status view and confirm that web01.example.net appears.
    http://monitor.example.net/nagios4/cgi-bin/status.cgi?hostgroup=all&style=hostdetail

    The example row shows DOWN because the documentation address is not reachable. A real host should move to UP after a successful host check, or to a meaningful non-OK state when reachability is intentionally blocked.