1 ## <a id="hosts-services"></a> Hosts and Services
3 Icinga 2 can be used to monitor the availability of hosts and services. Services
4 can be virtually anything which can be checked in some way:
6 * Network services (HTTP, SMTP, SNMP, SSH, etc.)
10 * Other local or network-accessible services
12 Host objects provide a mechanism to group services that are running
13 on the same physical device.
15 Here is an example of a host object which defines two child services:
17 object Host "my-server1" {
18 vars.address = "10.0.0.1"
19 check_command = "hostalive"
22 object Service "ping4" {
23 host_name = "localhost"
24 check_command = "ping4"
27 object Service "http" {
28 host_name = "localhost"
29 check_command = "http_ip"
32 The example creates two services `ping4` and `http` which belong to the
35 It also specifies that the host should perform its own check using the `hostalive`
38 The `address` custom attribute is used by check commands to determine which network
39 address is associated with the host object.
41 ### <a id="host-states"></a> Host States
43 Hosts inherit their state from the host check service that is specified using
44 the `check` attribute.
46 Hosts can be in any of the following states:
49 ------------|--------------
50 UP | The host is available.
51 DOWN | The host is unavailable.
52 UNREACHABLE | At least one of the host's dependencies (e.g. its upstream router) is unavailable causing the host to be unreachable.
54 ### <a id="service-states"></a> Service States
56 Services can be in any of the following states:
59 ------------|--------------
60 OK | The service is working properly.
61 WARNING | The service is experiencing some problems but is still considered to be in working condition.
62 CRITICAL | The service is in a critical state.
63 UNKNOWN | The check could not determine the service's state.
65 ### <a id="hard-soft-states"></a> Hard and Soft States
67 When detecting a problem with a service Icinga re-checks the service a number of
68 times (based on the `max_check_attempts` and `retry_interval` settings) before sending
69 notifications. This ensures that no unnecessary notifications are sent for
70 transient failures. During this time the service is in a `SOFT` state.
72 After all re-checks have been executed and the service is still in a non-OK
73 state the service switches to a `HARD` state and notifications are sent.
76 ------------|--------------
77 HARD | The host/service's state hasn't recently changed.
78 SOFT | The host/service has recently changed state and is being re-checked.