Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
testing
puppet-icinga2_testing
Commits
70a8a45c
Commit
70a8a45c
authored
Dec 08, 2016
by
Markus Frosch
Browse files
selftest: Add testing host and services
parent
7333d43a
Changes
6
Hide whitespace changes
Inline
Side-by-side
manifests/profiles/selftest.pp
View file @
70a8a45c
...
...
@@ -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"
),
...
...
templates/selftest/hostgroups.conf.erb
0 → 100644
View file @
70a8a45c
#######################################
# 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"
}
templates/selftest/notifications.conf.erb
View file @
70a8a45c
...
...
@@ -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"
}
templates/selftest/templates.conf.erb
View file @
70a8a45c
...
...
@@ -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,
...
...
templates/selftest/test_hosts.conf.erb
View file @
70a8a45c
...
...
@@ -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"
}
templates/selftest/test_services.conf.erb
View file @
70a8a45c
...
...
@@ -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"
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment