First objects

- add basic service and host templates
- add service groups
- define a few services
- add beholder host
This commit is contained in:
Jan Dittberner 2023-08-15 17:46:37 +02:00
parent 2231bc6b21
commit 022e34449a
5 changed files with 114 additions and 0 deletions

View file

@ -0,0 +1,30 @@
// vim: set ft=icinga2 et sw=2 ts=2 si ai:
/**
* Provides default settings for hosts. By convention
* all hosts should import this template.
*
* The CheckCommand object `hostalive` is provided by
* the plugin check command templates.
* Check the documentation for details.
*/
template Host "generic-host" {
max_check_attempts = 3
check_interval = 1m
retry_interval = 30s
check_command = "hostalive"
}
template Host "debian-host" {
import "generic-host"
vars.osfamily = "Debian"
vars.procs = {
"ssh" = {
procs_command = "sshd"
procs_critical = "1:50"
}
}
}

View file

@ -0,0 +1,11 @@
// vim: set ft=icinga2 et sw=2 ts=2 si ai:
/**
* Provides default settings for services. By convention
* all services should import this template.
*/
template Service "generic-service" {
max_check_attempts = 5
check_interval = 1m
retry_interval = 30s
}

View file

@ -0,0 +1,18 @@
// vim: set ft=icinga2 et sw=2 ts=2 si ai:
object ServiceGroup "disk" {
display_name = "Disk Checks"
assign where service.check_command == "disk"
}
object ServiceGroup "package-updates" {
display_name = "Package Update Status"
assign where service.check_command == "apt"
}
object ServiceGroup "procs" {
display_name = "Process Checks"
assign where service.check_command == "procs"
}

View file

@ -0,0 +1,41 @@
// vim: set ft=icinga2 et sw=2 ts=2 si ai:
apply Service "apt" {
import "generic-service"
check_command = "apt"
check_interval = 1h
retry_interval = 15m
vars.apt_list = true
assign where host.vars.osfamily == "Debian"
}
apply Service "icinga" {
import "generic-service"
check_command = "icinga"
}
apply Service "procs" {
import "generic-service"
check_command = "procs"
}
apply Service "proc-" for (proc => config in host.vars.procs) {
import "generic-service"
check_command = "procs"
vars += config
}
apply Service "disk-" for (disk => config in host.vars.disks) {
import "generic-service"
check_command = "disk"
vars += config
}

14
master/hosts.conf Normal file
View file

@ -0,0 +1,14 @@
// vim: set ft=icinga2 et sw=2 ts=2 si ai:
object Host "beholder" {
import "debian-host"
address = "127.0.0.1"
address6 = "::1"
vars.disks["/"] = {
disk_partitions = "/"
}
vars.disks["/boot/efi"] = {
disk_partitions = "/boot/efi"
}
}