1 ## <a id="timeperiods"></a> Time Periods
3 Time Periods define time ranges in Icinga where event actions are
4 triggered, for example if a service check is executed or not within
5 the `check_period` attribute. Or a notification should be sent to
6 users or not, filtered by the `notification_period` configuration
7 attribute for `Notification` and `User` objects.
11 > If you are familar with Icinga 1.x - these time period definitions
12 > are called `legacy timeperiods` in Icinga 2.
14 > An Icinga 2 legacy timeperiod requires the `ITL` provided template
17 The `TimePeriod` attribute `ranges` may contain multiple directives,
18 including weekdays, days of the month, and calendar dates.
19 These types may overlap/override other types in your ranges dictionary.
21 The descending order of precedence is as follows:
23 * Calendar date (2008-01-01)
24 * Specific month date (January 1st)
25 * Generic month date (Day 15)
26 * Offset weekday of specific month (2nd Tuesday in December)
27 * Offset weekday (3rd Monday)
28 * Normal weekday (Tuesday)
30 If you don't set any `check_period` or `notification_period` attribute
31 on your configuration objects Icinga 2 assumes `24x7` as time period
34 object TimePeriod "24x7" {
35 import "legacy-timeperiod"
37 display_name = "Icinga 2 24x7 TimePeriod"
39 "monday" = "00:00-24:00"
40 "tuesday" = "00:00-24:00"
41 "wednesday" = "00:00-24:00"
42 "thursday" = "00:00-24:00"
43 "friday" = "00:00-24:00"
44 "saturday" = "00:00-24:00"
45 "sunday" = "00:00-24:00"
49 If your operation staff should only be notified during workhours
50 create a new timeperiod named `workhours` defining a work day with
53 object TimePeriod "workhours" {
54 import "legacy-timeperiod"
56 display_name = "Icinga 2 8x5 TimePeriod"
58 "monday" = "09:00-17:00"
59 "tuesday" = "09:00-17:00"
60 "wednesday" = "09:00-17:00"
61 "thursday" = "09:00-17:00"
62 "friday" = "09:00-17:00"
66 Use the `notification_period` attribute to assign time periods to
67 `Notification` objects:
69 object Notification "mail" {
70 import "generic-notification"
72 host_name = "localhost"
74 notification_command = "mail-notification"
75 users = [ "icingaadmin" ]
76 notification_period = "workhours"