/* ---------------------------------------------------------------------- Example Host ---------------------------------------------------------------------- */ object Host "example_host" { display_name = "example_host" //address = "8.8.8.8" address = "1.2.3.4" groups = [ "domain" ] check_command = "hostalive" check_interval = 10s max_check_attempts = 1 retry_interval = 10s check_period = "24x7" enable_passive_checks = false vars.notification.mail = "mail_24x7" vars.notification.sms = "sms_24x5" vars.notification.ticket = "ticket_24x5" vars.notify.mail.begin = 1m vars.notify.mail.end = 2m vars.notify.sms.begin = 2m vars.notify.sms.end = 3m vars.notify.ticket.begin = 3m vars.notify.ticket.end = 4m } object HostGroup "domain"{ display_name = "example_host_group" } /* ---------------------------------------------------------------------- Notifications ---------------------------------------------------------------------- */ apply Notification "mail_24x7" to Host { import "mail-host-notification" user_groups = ["example_user_group"] assign where match("mail_24x7",host.vars.notification.mail) //interval = 3d interval = 0 times.begin = host.vars.notify.mail.begin times.end = host.vars.notify.mail.end period = "24x7" } apply Notification "sms_24x5" to Host { import "sms-host-notification" user_groups = ["example_user_group"] assign where match("sms_24x5",host.vars.notification.sms) //interval = 3d interval = 0 times.begin = host.vars.notify.sms.begin times.end = host.vars.notify.sms.end period = "24x7" } apply Notification "mail-ticket_24x5" to Host { import "mail-host-notification-ticket" user_groups = ["example_user_group"] assign where match("ticket_24x5",host.vars.notification.ticket) //interval = 3d interval = 0 times.begin = host.vars.notify.ticket.begin times.end = host.vars.notify.ticket.end period = "24x7" } /* ---------------------------------------------------------------------- Notification Templates ---------------------------------------------------------------------- */ template Notification "mail-host-notification" { command = "mail-host-notification" states = [ Up, Down ] types = [ Problem, Acknowledgement, Recovery, Custom,FlappingStart, FlappingEnd,DowntimeStart, DowntimeEnd, DowntimeRemoved ] } template Notification "sms-host-notification" { command = "sms-host-notification" states = [ Down, Up ] types = [ Problem, Recovery ] } template Notification "mail-host-notification-ticket" { command = "mail-host-notification" states = [ Down ] types = [ Problem ] } /* ---------------------------------------------------------------------- Notification Commands ---------------------------------------------------------------------- */ object NotificationCommand "mail-host-notification" { import "plugin-notification-command" command = [ SysconfDir + "/icinga2/scripts/mail-host-notification.sh" ] env = { NOTIFICATIONTYPE = "$notification.type$" HOSTALIAS = "$host.display_name$" HOSTADDRESS = "$address$" HOSTSTATE = "$host.state$" LONGDATETIME = "$icinga.long_date_time$" HOSTOUTPUT = "$host.output$" NOTIFICATIONAUTHORNAME = "$notification.author$" NOTIFICATIONCOMMENT = "$notification.comment$" HOSTDISPLAYNAME = "$host.display_name$" USEREMAIL = "$user.email$" HOSTDEBNR = "$debnr$" HOSTDESC = "$host.notes$" APNAME = "$apname$" APTEL = "$aptel$" APMAIL = "$apmail$" APLOCAL = "$aplocal$" HOSTCAT = "$cat$" } vars.debnr = "" vars.apname = "" vars.aptel = "" vars.apmail = "" vars.aplocal = "" vars.cat = "" } object NotificationCommand "sms-host-notification" { import "plugin-notification-command" command = [ SysconfDir + "/icinga2/scripts/sms-host-notification.sh" ] env = { NOTIFICATIONTYPE = "$notification.type$" HOSTALIAS = "$host.display_name$" HOSTADDRESS = "$address$" HOSTSTATE = "$host.state$" LONGDATETIME = "$icinga.long_date_time$" HOSTOUTPUT = "$host.output$" NOTIFICATIONAUTHORNAME = "$notification.author$" NOTIFICATIONCOMMENT = "$notification.comment$" HOSTDISPLAYNAME = "$host.display_name$" USERMOBILE = "$user.pager$" APNAME = "$apname$" APTEL = "$aptel$" APMAIL = "$apmail$" APLOCAL = "$aplocal$" HOSTCAT = "$cat$" } vars.debnr = "" vars.apname = "" vars.aptel = "" vars.apmail = "" vars.aplocal = "" vars.cat = "" } /* ---------------------------------------------------------------------- Timeperiods ---------------------------------------------------------------------- */ object TimePeriod "24x7" { import "legacy-timeperiod" display_name = "Icinga 2 24x7 TimePeriod" ranges = { "monday" = "00:00-24:00" "tuesday" = "00:00-24:00" "wednesday" = "00:00-24:00" "thursday" = "00:00-24:00" "friday" = "00:00-24:00" "saturday" = "00:00-24:00" "sunday" = "00:00-24:00" } } object TimePeriod "9to5" { import "legacy-timeperiod" display_name = "Icinga 2 9to5 TimePeriod" 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" } } object TimePeriod "never" { import "legacy-timeperiod" display_name = "Icinga 2 never TimePeriod" ranges = { } } object TimePeriod "8x5"{ import "legacy-timeperiod" ranges = { "monday" = "08:00-17:00" "tuesday" = "08:00-17:00" "wednesday" = "08:00-17:00" "thursday" = "08:00-17:00" "friday" = "08:00-17:00" } } /* ---------------------------------------------------------------------- Contacts configuration ---------------------------------------------------------------------- */ object User "example_user1"{ email = "example_user@localhost.tld" pager = "0123456789" groups = ["example_user_group"] } object User "example_user2"{ email = "example_user@localhost.tld" pager = "0123456789" groups = ["example_user_group"] } object User "example_user3"{ email = "example_user@localhost.tld" pager = "0123456789" groups = ["example_user_group"] } object UserGroup "example_user_group"{ }