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 Type | Description |
---|---|
Host | Represents a network device, server, or any computing resource that needs monitoring. |
Service | Represents a monitoring task on a Host, such as checking CPU load, disk usage, etc. |
CheckCommand | Defines monitoring commands used to perform checks on Hosts and Services. |
Contact | Specifies individuals who should receive notifications about monitoring events. |
ContactGroup | Groups multiple contacts, simplifying notification management. |
TimePeriod | Defines specific times when notifications are sent or when checks are active. |
User | Represents a user of the Icinga Web 2 interface, distinct from a contact for notifications. |
UserGroup | Groups multiple users for managing permissions within Icinga Web 2. |
Notification | Specifies how and when notifications are sent for changes in service or host states. |
HostGroup | Groups multiple hosts, allowing easier management of common settings or checks. |
ServiceGroup | Similar to HostGroup but for services, grouping services for easier management. |
Dependency | Defines dependencies between hosts or services, influencing checks and notifications. |
Zone | Used in distributed monitoring to manage regions or areas with distinct configurations. |
Endpoint | Represents an instance of Icinga2 in a distributed setup, typically within a zone. |
ApiUser | Defines a user for API access, controlling permissions for interacting with the Icinga2 API. |
ScheduledDowntime | Manages planned outages by defining periods when alerts should not be triggered. |
Template | Allows 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.
Latest posts by Rajesh Kumar (see all)
- Best youtube channels for software developers - August 27, 2024
- DevOps Consulting Companies Improve IT Efficiency - August 23, 2024
- The Evolution and Growing Demand for DevOps Consulting Services - August 23, 2024