{"id":46338,"date":"2024-05-27T03:48:05","date_gmt":"2024-05-27T03:48:05","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=46338"},"modified":"2024-05-29T03:05:07","modified_gmt":"2024-05-29T03:05:07","slug":"icinga-icinga-object-types","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/icinga-icinga-object-types\/","title":{"rendered":"icinga: icinga object types"},"content":{"rendered":"\n<p>In Icinga2, &#8220;objects&#8221; are fundamental components that represent various elements and configurations within the monitoring environment. They form the core building blocks of the Icinga2 configuration system.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">List of Icinga2 objects types<\/h2>\n\n\n\n<p>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:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Object Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><strong>Host<\/strong><\/td><td>Represents a network device, server, or any computing resource that needs monitoring.<\/td><\/tr><tr><td><strong>Service<\/strong><\/td><td>Represents a monitoring task on a Host, such as checking CPU load, disk usage, etc.<\/td><\/tr><tr><td><strong>CheckCommand<\/strong><\/td><td>Defines monitoring commands used to perform checks on Hosts and Services.<\/td><\/tr><tr><td><strong>Contact<\/strong><\/td><td>Specifies individuals who should receive notifications about monitoring events.<\/td><\/tr><tr><td><strong>ContactGroup<\/strong><\/td><td>Groups multiple contacts, simplifying notification management.<\/td><\/tr><tr><td><strong>TimePeriod<\/strong><\/td><td>Defines specific times when notifications are sent or when checks are active.<\/td><\/tr><tr><td><strong>User<\/strong><\/td><td>Represents a user of the Icinga Web 2 interface, distinct from a contact for notifications.<\/td><\/tr><tr><td><strong>UserGroup<\/strong><\/td><td>Groups multiple users for managing permissions within Icinga Web 2.<\/td><\/tr><tr><td><strong>Notification<\/strong><\/td><td>Specifies how and when notifications are sent for changes in service or host states.<\/td><\/tr><tr><td><strong>HostGroup<\/strong><\/td><td>Groups multiple hosts, allowing easier management of common settings or checks.<\/td><\/tr><tr><td><strong>ServiceGroup<\/strong><\/td><td>Similar to HostGroup but for services, grouping services for easier management.<\/td><\/tr><tr><td><strong>Dependency<\/strong><\/td><td>Defines dependencies between hosts or services, influencing checks and notifications.<\/td><\/tr><tr><td><strong>Zone<\/strong><\/td><td>Used in distributed monitoring to manage regions or areas with distinct configurations.<\/td><\/tr><tr><td><strong>Endpoint<\/strong><\/td><td>Represents an instance of Icinga2 in a distributed setup, typically within a zone.<\/td><\/tr><tr><td><strong>ApiUser<\/strong><\/td><td>Defines a user for API access, controlling permissions for interacting with the Icinga2 API.<\/td><\/tr><tr><td><strong>ScheduledDowntime<\/strong><\/td><td>Manages planned outages by defining periods when alerts should not be triggered.<\/td><\/tr><tr><td><strong>Template<\/strong><\/td><td>Allows configuration details to be reused across multiple object definitions.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">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.\n\n1. Host\n\nobject Host \"example-host\" {\n  import \"generic-host\"\n  address = \"192.168.1.1\"\n  check_command = \"hostalive\"\n}\n\n2. Service\n\napply Service \"ping\" {\n  import \"generic-service\"\n  check_command = \"ping4\"\n  assign where host.address\n}\n\n3. CheckCommand\n\nobject CheckCommand \"check-disk\" {\n  command = &#91; PluginDir + \"\/check_disk\" ]\n  arguments = {\n    \"-w\" = \"$disk_warn$\"\n    \"-c\" = \"$disk_crit$\"\n    \"-p\" = \"$disk_partitions$\"\n  }\n}\n\n4. Contact\n\nobject User \"admin\" {\n  import \"generic-user\"\n  display_name = \"Admin User\"\n  email = \"admin@example.com\"\n}\n\n5. ContactGroup\n\nobject UserGroup \"admin-group\" {\n  display_name = \"Admin Group\"\n  members = &#91; \"admin\" ]\n}\n\n6. TimePeriod\n\nobject TimePeriod \"work-hours\" {\n  display_name = \"Work Hours\"\n  ranges = {\n    \"monday\"    = \"09:00-17:00\"\n    \"tuesday\"   = \"09:00-17:00\"\n    \"wednesday\" = \"09:00-17:00\"\n    \"thursday\"  = \"09:00-17:00\"\n    \"friday\"    = \"09:00-17:00\"\n  }\n}\n\n\n7. User\n\nobject User \"web-admin\" {\n  import \"generic-user\"\n  email = \"webadmin@example.com\"\n}\n\n8. UserGroup\n\nobject UserGroup \"web-admins\" {\n  display_name = \"Web Admins\"\n  members = &#91; \"web-admin\" ]\n}\n\n9. Notification\n\napply Notification \"mail-service\" to Service {\n  import \"mail-service-notification\"\n  user_groups = &#91; \"admin-group\" ]\n  assign where host.vars.notification.mail\n}\n\n10. HostGroup\n\nobject HostGroup \"linux-servers\" {\n  display_name = \"Linux Servers\"\n  assign where match(\"linux*\", host.vars.os)\n}\n\n11. ServiceGroup\n\nobject ServiceGroup \"web-services\" {\n  display_name = \"Web Services\"\n  assign where service.name in &#91; \"http\", \"https\" ]\n}\n\n12. Dependency\n\nobject Dependency \"web-db-dependency\" {\n  parent_host_name = \"db-server\"\n  child_host_name = \"web-server\"\n  disable_checks = true\n}\n\n13. Zone\n\nobject Zone \"master-zone\" {\n  endpoints = &#91; \"master1\", \"master2\" ]\n}\n\n14. Endpoint\n\nobject Endpoint \"master1\" {\n  host = \"master1.example.com\"\n}\n\n15. ApiUser\n\nobject ApiUser \"api-client\" {\n  password = \"secret\"\n  permissions = &#91; \"status\/query\", \"objects\/modify\/*\" ]\n}\n\n16. ScheduledDowntime\n\nobject ScheduledDowntime \"downtime-for-maintenance\" {\n  author = \"admin\"\n  comment = \"Scheduled maintenance\"\n  ranges = {\n    \"monday\" = \"00:00-02:00\"\n  }\n  assign where host.name == \"example-host\"\n}\n\n17. Template\n\ntemplate Host \"generic-host\" {\n  max_check_attempts = 5\n  check_interval = 5m\n  retry_interval = 1m\n}\nEach example provided is formatted for direct use in your Icinga2 configuration files, allowing you to adapt them to your specific monitoring needs and scenarios.<\/code><\/span><\/pre>","protected":false},"excerpt":{"rendered":"<p>In Icinga2, &#8220;objects&#8221; 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&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[8217],"tags":[],"class_list":["post-46338","post","type-post","status-publish","format-standard","hentry","category-icinga"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/46338","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=46338"}],"version-history":[{"count":3,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/46338\/revisions"}],"predecessor-version":[{"id":46341,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/46338\/revisions\/46341"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=46338"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=46338"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=46338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}