Skip to content

Instantly share code, notes, and snippets.

@dnsmichi
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dnsmichi/50c280f3b42a47f5bed4 to your computer and use it in GitHub Desktop.
Save dnsmichi/50c280f3b42a47f5bed4 to your computer and use it in GitHub Desktop.
Explain the following:
1) Which User is getting notified for which Host?
2) Which assign/ignore expressions match for the Hosts and Users?
/* generated by puppet */
object Host "puppet-generated-host1" {
import "puppet-host"
import "db-server"
check_Command = "generated-hostalive"
vars.notify_mgmt = true
vars.has_sla = "24x7"
}
object Host "puppet-generated-host2" {
import "puppet-host"
import "db-server"
check_Command = "generated-hostalive"
vars.has_sla = "24x7"
}
/* configuration in icinga2 for notifications */
apply Notification "notify-host-by-mail" to Host {
user_groups = [ "mgmt" ]
states = [ Down ]
types = [ Problem, Recovery ]
command = "notify-by-mail"
interval = 1h
period = "24x7"
assign where host.vars.has_sla == "24x7" && host.vars.notify_mgmt == true && "db-server" in host.templates
ignore where host.vars.no_notify == true
}
object UserGroup "mgmt" {
assign where user.vars.is_manager_of != ""
}
object User "manager" {
email = "mgmt@firma.com"
vars.is_manager_of = "abteilung1"
}
object User "admin" {
email = "admin@firma.com"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment