Commit 70a8a45c authored by Markus Frosch's avatar Markus Frosch 📣

selftest: Add testing host and services

parent 7333d43a
......@@ -29,7 +29,14 @@ class icinga2_testing::profiles::selftest (
recurse => true,
}
['hosts', 'services'].each |$name| {
[
'hosts',
'services',
'hostgroups',
'test_hosts',
'test_services',
'notifications'
].each |$name| {
file { "${config_base}/${name}.conf":
ensure => file,
content => template("icinga2_testing/selftest/${name}.conf.erb"),
......
#######################################
# Icinga 2 selftest configuration
# Managed by Puppet
#######################################
object HostGroup "icinga" {
display_name = "Icinga Cluster"
assign where host.vars.role == "icinga"
}
object HostGroup "test" {
display_name = "Test Hosts"
assign where host.vars.role == "test"
}
......@@ -4,17 +4,21 @@
#######################################
apply Notification "log" to Host {
import "log-notification"
import "log-host-notification"
user_groups = ["test"]
interval = 10m
assign where host.vars.notification == "test"
}
apply Notification "log" to Service {
import "log-notification"
import "log-service-notification"
user_groups = ["test"]
interval = 10m
assign where service.vars.notification == "test"
}
......@@ -27,8 +27,8 @@ template User "generic-user" {
}
template Notification "mail-host-notification" {
command = "log-notification"
template Notification "log-host-notification" {
command = "log-host-notification"
states = [ Up, Down ]
types = [ Problem, Acknowledgement, Recovery, Custom,
......@@ -38,8 +38,8 @@ template Notification "mail-host-notification" {
period = "24x7"
}
template Notification "mail-service-notification" {
command = "log-notification"
template Notification "log-service-notification" {
command = "log-service-notification"
states = [ OK, Warning, Critical, Unknown ]
types = [ Problem, Acknowledgement, Recovery, Custom,
......
......@@ -3,3 +3,19 @@
# Managed by Puppet
#######################################
template Host "test-host" {
import "generic-host"
check_command = "dummy"
vars.dummy_text = "Just a test host"
}
object Host "test-simple" {
import "test-host"
vars.notification = "test"
vars.role = "test"
vars.test_type = "simple"
}
......@@ -3,3 +3,75 @@
# Managed by Puppet
#######################################
apply Service "test-ok" {
import "generic-service"
check_command = "dummy"
vars.dummy_text = "This check is always OK."
vars.dummy_state = 0
vars.notification = "test"
assign where host.vars.test_type == "simple"
}
apply Service "test-warning" {
import "generic-service"
check_command = "dummy"
vars.dummy_text = "This check is always WARNING."
vars.dummy_state = 1
vars.notification = "test"
assign where host.vars.test_type == "simple"
}
apply Service "test-critical" {
import "generic-service"
check_command = "dummy"
vars.dummy_text = "This check is always CRITICAL."
vars.dummy_state = 2
vars.notification = "test"
assign where host.vars.test_type == "simple"
}
apply Service "test-unknown" {
import "generic-service"
check_command = "dummy"
vars.dummy_text = "This check is always UNKNOWN."
vars.dummy_state = 3
vars.notification = "test"
assign where host.vars.test_type == "simple"
}
apply Service "test-random" {
import "generic-service"
check_command = "random"
vars.notification = "test"
assign where host.vars.test_type == "simple"
}
apply Service "test-random-hard" {
import "generic-service"
check_command = "random"
max_check_attempts = 1
vars.notification = "test"
assign where host.vars.test_type == "simple"
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment