Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

icinga: icinga object types

In Icinga2, “objects” are fundamental components that represent various elements and configurations within the monitoring environment. They form the core building blocks of the Icinga2 configuration system.

List of Icinga2 objects types

Below is a table summarizing the types of objects in Icinga2, along with a brief description of each to help you understand their roles and functionalities within the Icinga2 monitoring framework:

Object TypeDescription
HostRepresents a network device, server, or any computing resource that needs monitoring.
ServiceRepresents a monitoring task on a Host, such as checking CPU load, disk usage, etc.
CheckCommandDefines monitoring commands used to perform checks on Hosts and Services.
ContactSpecifies individuals who should receive notifications about monitoring events.
ContactGroupGroups multiple contacts, simplifying notification management.
TimePeriodDefines specific times when notifications are sent or when checks are active.
UserRepresents a user of the Icinga Web 2 interface, distinct from a contact for notifications.
UserGroupGroups multiple users for managing permissions within Icinga Web 2.
NotificationSpecifies how and when notifications are sent for changes in service or host states.
HostGroupGroups multiple hosts, allowing easier management of common settings or checks.
ServiceGroupSimilar to HostGroup but for services, grouping services for easier management.
DependencyDefines dependencies between hosts or services, influencing checks and notifications.
ZoneUsed in distributed monitoring to manage regions or areas with distinct configurations.
EndpointRepresents an instance of Icinga2 in a distributed setup, typically within a zone.
ApiUserDefines a user for API access, controlling permissions for interacting with the Icinga2 API.
ScheduledDowntimeManages planned outages by defining periods when alerts should not be triggered.
TemplateAllows configuration details to be reused across multiple object definitions.
Below, I'll provide an example for each object type in Icinga2 configuration format. These examples can serve as templates or guidelines for setting up various aspects of the Icinga2 monitoring system.

1. Host

object Host "example-host" {
  import "generic-host"
  address = "192.168.1.1"
  check_command = "hostalive"
}

2. Service

apply Service "ping" {
  import "generic-service"
  check_command = "ping4"
  assign where host.address
}

3. CheckCommand

object CheckCommand "check-disk" {
  command = [ PluginDir + "/check_disk" ]
  arguments = {
    "-w" = "$disk_warn$"
    "-c" = "$disk_crit$"
    "-p" = "$disk_partitions$"
  }
}

4. Contact

object User "admin" {
  import "generic-user"
  display_name = "Admin User"
  email = "admin@example.com"
}

5. ContactGroup

object UserGroup "admin-group" {
  display_name = "Admin Group"
  members = [ "admin" ]
}

6. TimePeriod

object TimePeriod "work-hours" {
  display_name = "Work Hours"
  ranges = {
    "monday"    = "09:00-17:00"
    "tuesday"   = "09:00-17:00"
    "wednesday" = "09:00-17:00"
    "thursday"  = "09:00-17:00"
    "friday"    = "09:00-17:00"
  }
}


7. User

object User "web-admin" {
  import "generic-user"
  email = "webadmin@example.com"
}

8. UserGroup

object UserGroup "web-admins" {
  display_name = "Web Admins"
  members = [ "web-admin" ]
}

9. Notification

apply Notification "mail-service" to Service {
  import "mail-service-notification"
  user_groups = [ "admin-group" ]
  assign where host.vars.notification.mail
}

10. HostGroup

object HostGroup "linux-servers" {
  display_name = "Linux Servers"
  assign where match("linux*", host.vars.os)
}

11. ServiceGroup

object ServiceGroup "web-services" {
  display_name = "Web Services"
  assign where service.name in [ "http", "https" ]
}

12. Dependency

object Dependency "web-db-dependency" {
  parent_host_name = "db-server"
  child_host_name = "web-server"
  disable_checks = true
}

13. Zone

object Zone "master-zone" {
  endpoints = [ "master1", "master2" ]
}

14. Endpoint

object Endpoint "master1" {
  host = "master1.example.com"
}

15. ApiUser

object ApiUser "api-client" {
  password = "secret"
  permissions = [ "status/query", "objects/modify/*" ]
}

16. ScheduledDowntime

object ScheduledDowntime "downtime-for-maintenance" {
  author = "admin"
  comment = "Scheduled maintenance"
  ranges = {
    "monday" = "00:00-02:00"
  }
  assign where host.name == "example-host"
}

17. Template

template Host "generic-host" {
  max_check_attempts = 5
  check_interval = 5m
  retry_interval = 1m
}
Each example provided is formatted for direct use in your Icinga2 configuration files, allowing you to adapt them to your specific monitoring needs and scenarios.
Rajesh Kumar
Follow me
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x