Nagios - Hosts and Services

Nagios is the most popular tool which is used to monitor hosts and services running in your IT infrastructure. Hosts and service configurations are the building blocks of Nagios Core.

  • Host is just like a computer; it can be a physical device or virtual.

  • Services are those which are used by Nagios to check something about a host.

You can create a host file inside the server directory of Nagios and mention the host and service definitions. For example −

sudo gedit /usr/local/nagios/etc/servers/ubuntu_host.cfg

# Ubuntu Host configuration file

define host {
   use linux-server
   host_name ubuntu_host
   alias Ubuntu Host
   register 1
define service {
   host_name ubuntu_host
   service_description PING
   check_command check_ping!100.0,20%!500.0,60%
   max_check_attempts 2
   check_interval 2
   retry_interval 2
   check_period 24x7
   check_freshness 1
   contact_groups admins
   notification_interval 2
   notification_period 24x7
   notifications_enabled 1
   register 1

The above definitions add a host called ubuntu_host and defines the services which will run on this host. When you restart the Nagios, this host will start getting monitored by Nagios and the specified services will run.

There are many more services in Nagios which can be used to monitor pretty much anything on the running host.