Closed cruelsmith closed 2 months ago
Hi @Al2Klimov, i saw that you already worked deep in the code of the timeperiod feature of the linked issues and wanted to ask if maybe can have a look at this. At least in my case the root problem is probably somewhere where the date part is parsed or the date part is translated to a segment.
Feal free to ping me when i can help or something is unclear with my provided tests.
Cheers
That issue will also be logged in debug mode:
[2023-06-01 17:26:45 +0200] debug/LegacyTimePeriod: ParseTimeRange: 'day 1' => 1685570400 -> 1685656800, stride: 1 [2023-06-01 17:26:45 +0200] debug/LegacyTimePeriod: ParseTimeRange: 'day 1' => 1685570400 -> 1685656800, stride: 1 [2023-06-01 17:26:45 +0200] debug/LegacyTimePeriod: Legacy timeperiod update returned 2 segments. [2023-06-01 17:26:45 +0200] debug/TimePeriod: Removing segment 'Thu Jun 1 17:26:45 2023' <-> 'Fri Jun 2 17:26:45 2023' from TimePeriod 'broken_generic_month_date' [2023-06-01 17:26:45 +0200] debug/TimePeriod: Adding segment 'Thu Jun 1 00:00:00 2023' <-> 'Fri Jun 2 00:00:00 2023' to TimePeriod 'broken_generic_month_date' [2023-06-01 17:26:45 +0200] debug/TimePeriod: Adding segment 'Fri Jun 2 00:00:00 2023' <-> 'Sat Jun 3 00:00:00 2023' to TimePeriod 'broken_generic_month_date'
So why should ranges = { "day 1" = "00:00-24:00" }
ever result in two segments ?
The ParseTimeRange:
message come from: https://github.com/Icinga/icinga2/blob/master/lib/icinga/legacytimeperiod.cpp#L397-L399
The Legacy timeperiod update returned
message come from:
https://github.com/Icinga/icinga2/blob/master/lib/icinga/legacytimeperiod.cpp#L640-L641
The Adding segment
message come from: https://github.com/Icinga/icinga2/blob/master/lib/icinga/timeperiod.cpp#L45-L47
The Removing segment
message come from: https://github.com/Icinga/icinga2/blob/master/lib/icinga/timeperiod.cpp#L106-L108
For my understanding it all points to an issue with that function: https://github.com/Icinga/icinga2/blob/master/lib/icinga/legacytimeperiod.cpp#L582
This issue relates to the following issues that describes the same issue or a followup issue that root cause is the broken date to segment mapping.
In short, you think that the segments are mis-generated even before any merge across time periods (#7855) happens?
In short, you think that the segments are mis-generated even before any merge across time periods (https://github.com/Icinga/icinga2/pull/7855) happens?
Yes, that is what my To Reproduce
tests showed. While TimePeriod is generated from the config the resulting segments from the TimePeriod already have a unwanted segment for the next day included.
That is easy be viewable when you dump a simple TimePeriod without any cross merges via the API.
Duplicate of #8741
I have this problem too. I can also verify the cases to reproduce from @cruelsmith . Are there any plans to fix this soon?
Describe the bug
All date timeperiod formats except the (only) weekday lead to a not allowed segment for the following day. That also apply for Across midnight and Across several days, weeks or months while the time calculation is always working as expected.
That is a major issue for the timeperiod feature and makes it completely useless in most cases. :warning: Depending of the use case of the timeperiod icinga2 instances will suffer with not executed checks and/or missing notifications when used in these object definitions.
Since the inital segmets translation is broken also the include / exclude of other timeperiods lead to unwanted results. But this just followup issue since the include / exclude timeperiod has segments in it which it should not have.
To Reproduce
:boom: Calendar date range (2023-05-30 - 2023-05-31)
### Config ```conf object TimePeriod "broken_calendar_date_range" { ranges = { "2023-05-30 - 2023-05-31" = "00:00-24:00" } } object TimePeriod "broken_calendar_date_range_16" { ranges = { "2023-05-30 - 2023-05-31" = "16:00-16:50" } } object TimePeriod "broken_calendar_date_range_23_1" { ranges = { "2023-05-30 - 2023-05-31" = "23:00-01:00" } } ``` ### API Object /v1/objects/timeperiod ```json { "results": [ { "attrs": { "__name": "broken_calendar_date_range", "active": true, "display_name": "broken_calendar_date_range", "excludes": [], "ha_mode": 0, "includes": [], "is_inside": true, "name": "broken_calendar_date_range", "original_attributes": null, "package": "_etc", "paused": false, "prefer_includes": true, "ranges": { "2023-05-30 - 2023-05-31": "00:00-24:00" }, "segments": [ { "begin": 1685570400, "end": 1685656800 } ], "source_location": { "first_column": 1, "first_line": 55, "last_column": 46, "last_line": 55, "path": "/etc/icinga2/zones.d/global_zone/timeperiods.conf" }, "templates": [ "broken_calendar_date_range", "legacy-timeperiod" ], "type": "TimePeriod", "update": { "arguments": [ "tp", "begin", "end" ], "deprecated": false, "name": "Internal#LegacyTimePeriod", "side_effect_free": false, "type": "Function" }, "valid_begin": 1685602797.682166, "valid_end": 1685692797.682166, "vars": null, "version": 0, "zone": "global_zone" }, "joins": {}, "meta": {}, "name": "broken_calendar_date_range", "type": "TimePeriod" } ] } { "results": [ { "attrs": { "__name": "broken_calendar_date_range_16", "active": true, "display_name": "broken_calendar_date_range_16", "excludes": [], "ha_mode": 0, "includes": [], "is_inside": false, "name": "broken_calendar_date_range_16", "original_attributes": null, "package": "_etc", "paused": false, "prefer_includes": true, "ranges": { "2023-05-30 - 2023-05-31": "16:00-16:50" }, "segments": [ { "begin": 1685628000, "end": 1685631000 } ], "source_location": { "first_column": 1, "first_line": 63, "last_column": 49, "last_line": 63, "path": "/etc/icinga2/zones.d/global_zone/timeperiods.conf" }, "templates": [ "broken_calendar_date_range_16", "legacy-timeperiod" ], "type": "TimePeriod", "update": { "arguments": [ "tp", "begin", "end" ], "deprecated": false, "name": "Internal#LegacyTimePeriod", "side_effect_free": false, "type": "Function" }, "valid_begin": 1685602797.682166, "valid_end": 1685692797.682166, "vars": null, "version": 0, "zone": "global_zone" }, "joins": {}, "meta": {}, "name": "broken_calendar_date_range_16", "type": "TimePeriod" } ] } { "results": [ { "attrs": { "__name": "broken_calendar_date_range_23_1", "active": true, "display_name": "broken_calendar_date_range_23_1", "excludes": [], "ha_mode": 0, "includes": [], "is_inside": false, "name": "broken_calendar_date_range_23_1", "original_attributes": null, "package": "_etc", "paused": false, "prefer_includes": true, "ranges": { "2023-05-30 - 2023-05-31": "23:00-01:00" }, "segments": [ { "begin": 1685653200, "end": 1685660400 } ], "source_location": { "first_column": 1, "first_line": 71, "last_column": 51, "last_line": 71, "path": "/etc/icinga2/zones.d/global_zone/timeperiods.conf" }, "templates": [ "broken_calendar_date_range_23_1", "legacy-timeperiod" ], "type": "TimePeriod", "update": { "arguments": [ "tp", "begin", "end" ], "deprecated": false, "name": "Internal#LegacyTimePeriod", "side_effect_free": false, "type": "Function" }, "valid_begin": 1685602797.682166, "valid_end": 1685692797.682166, "vars": null, "version": 0, "zone": "global_zone" }, "joins": {}, "meta": {}, "name": "broken_calendar_date_range_23_1", "type": "TimePeriod" } ] } ```:boom: Calendar date (2023-05-31)
### Config ```conf object TimePeriod "broken_calendar_date" { ranges = { "2023-05-31" = "00:00-24:00" } } object TimePeriod "broken_calendar_date_16" { ranges = { "2023-05-31" = "16:00-16:50" } } object TimePeriod "broken_calendar_date_23_1" { ranges = { "2023-05-31" = "23:00-01:00" } } ``` ### API Object /v1/objects/timeperiod ```json { "results": [ { "attrs": { "__name": "broken_calendar_date", "active": true, "display_name": "broken_calendar_date", "excludes": [], "ha_mode": 0, "includes": [], "is_inside": true, "name": "broken_calendar_date", "original_attributes": null, "package": "_etc", "paused": false, "prefer_includes": true, "ranges": { "2023-05-31": "00:00-24:00" }, "segments": [ { "begin": 1685570400, "end": 1685656800 } ], "source_location": { "first_column": 1, "first_line": 33, "last_column": 40, "last_line": 33, "path": "/etc/icinga2/zones.d/global_zone/timeperiods.conf" }, "templates": [ "broken_calendar_date", "legacy-timeperiod" ], "type": "TimePeriod", "update": { "arguments": [ "tp", "begin", "end" ], "deprecated": false, "name": "Internal#LegacyTimePeriod", "side_effect_free": false, "type": "Function" }, "valid_begin": 1685577724.058467, "valid_end": 1685667724.058467, "vars": null, "version": 0, "zone": "global_zone" }, "joins": {}, "meta": {}, "name": "broken_calendar_date", "type": "TimePeriod" } ] } { "results": [ { "attrs": { "__name": "broken_calendar_date_16", "active": true, "display_name": "broken_calendar_date_16", "excludes": [], "ha_mode": 0, "includes": [], "is_inside": false, "name": "broken_calendar_date_16", "original_attributes": null, "package": "_etc", "paused": false, "prefer_includes": true, "ranges": { "2023-05-31": "16:00-16:50" }, "segments": [ { "begin": 1685628000, "end": 1685631000 } ], "source_location": { "first_column": 1, "first_line": 41, "last_column": 43, "last_line": 41, "path": "/etc/icinga2/zones.d/global_zone/timeperiods.conf" }, "templates": [ "broken_calendar_date_16", "legacy-timeperiod" ], "type": "TimePeriod", "update": { "arguments": [ "tp", "begin", "end" ], "deprecated": false, "name": "Internal#LegacyTimePeriod", "side_effect_free": false, "type": "Function" }, "valid_begin": 1685577724.058467, "valid_end": 1685667724.058467, "vars": null, "version": 0, "zone": "global_zone" }, "joins": {}, "meta": {}, "name": "broken_calendar_date_16", "type": "TimePeriod" } ] } { "results": [ { "attrs": { "__name": "broken_calendar_date_23_1", "active": true, "display_name": "broken_calendar_date_23_1", "excludes": [], "ha_mode": 0, "includes": [], "is_inside": false, "name": "broken_calendar_date_23_1", "original_attributes": null, "package": "_etc", "paused": false, "prefer_includes": true, "ranges": { "2023-05-31": "23:00-01:00" }, "segments": [ { "begin": 1685653200, "end": 1685660400 } ], "source_location": { "first_column": 1, "first_line": 49, "last_column": 45, "last_line": 49, "path": "/etc/icinga2/zones.d/global_zone/timeperiods.conf" }, "templates": [ "broken_calendar_date_23_1", "legacy-timeperiod" ], "type": "TimePeriod", "update": { "arguments": [ "tp", "begin", "end" ], "deprecated": false, "name": "Internal#LegacyTimePeriod", "side_effect_free": false, "type": "Function" }, "valid_begin": 1685577776.347714, "valid_end": 1685667724.058467, "vars": null, "version": 0, "zone": "global_zone" }, "joins": {}, "meta": {}, "name": "broken_calendar_date_23_1", "type": "TimePeriod" } ] } ```:boom: Specific month date (May 31th)
### Config ```conf object TimePeriod "broken_specific_month_date" { ranges = { "may 31" = "00:00-24:00" } } object TimePeriod "broken_specific_month_date_16" { ranges = { "may 31" = "16:00-16:50" } } object TimePeriod "broken_specific_month_date_23_1" { ranges = { "may 31" = "23:00-01:00" } } ``` ### API Object /v1/objects/timeperiod ```json { "results": [ { "attrs": { "__name": "broken_specific_month_date", "active": true, "display_name": "broken_specific_month_date", "excludes": [], "ha_mode": 0, "includes": [], "is_inside": true, "name": "broken_specific_month_date", "original_attributes": null, "package": "_etc", "paused": false, "prefer_includes": true, "ranges": { "may 31": "00:00-24:00" }, "segments": [ { "begin": 1685570400, "end": 1685656800 } ], "source_location": { "first_column": 1, "first_line": 151, "last_column": 46, "last_line": 151, "path": "/etc/icinga2/zones.d/global_zone/timeperiods.conf" }, "templates": [ "broken_specific_month_date", "legacy-timeperiod" ], "type": "TimePeriod", "update": { "arguments": [ "tp", "begin", "end" ], "deprecated": false, "name": "Internal#LegacyTimePeriod", "side_effect_free": false, "type": "Function" }, "valid_begin": 1685578924.059701, "valid_end": 1685668924.059701, "vars": null, "version": 0, "zone": "global_zone" }, "joins": {}, "meta": {}, "name": "broken_specific_month_date", "type": "TimePeriod" } ] } { "results": [ { "attrs": { "__name": "broken_specific_month_date_16", "active": true, "display_name": "broken_specific_month_date_16", "excludes": [], "ha_mode": 0, "includes": [], "is_inside": false, "name": "broken_specific_month_date_16", "original_attributes": null, "package": "_etc", "paused": false, "prefer_includes": true, "ranges": { "may 31": "16:00-16:50" }, "segments": [ { "begin": 1685628000, "end": 1685631000 } ], "source_location": { "first_column": 1, "first_line": 159, "last_column": 49, "last_line": 159, "path": "/etc/icinga2/zones.d/global_zone/timeperiods.conf" }, "templates": [ "broken_specific_month_date_16", "legacy-timeperiod" ], "type": "TimePeriod", "update": { "arguments": [ "tp", "begin", "end" ], "deprecated": false, "name": "Internal#LegacyTimePeriod", "side_effect_free": false, "type": "Function" }, "valid_begin": 1685578924.059701, "valid_end": 1685668924.059701, "vars": null, "version": 0, "zone": "global_zone" }, "joins": {}, "meta": {}, "name": "broken_specific_month_date_16", "type": "TimePeriod" } ] } { "results": [ { "attrs": { "__name": "broken_specific_month_date_23_1", "active": true, "display_name": "broken_specific_month_date_23_1", "excludes": [], "ha_mode": 0, "includes": [], "is_inside": false, "name": "broken_specific_month_date_23_1", "original_attributes": null, "package": "_etc", "paused": false, "prefer_includes": true, "ranges": { "may 31": "23:00-01:00" }, "segments": [ { "begin": 1685653200, "end": 1685660400 } ], "source_location": { "first_column": 1, "first_line": 167, "last_column": 51, "last_line": 167, "path": "/etc/icinga2/zones.d/global_zone/timeperiods.conf" }, "templates": [ "broken_specific_month_date_23_1", "legacy-timeperiod" ], "type": "TimePeriod", "update": { "arguments": [ "tp", "begin", "end" ], "deprecated": false, "name": "Internal#LegacyTimePeriod", "side_effect_free": false, "type": "Function" }, "valid_begin": 1685578924.059701, "valid_end": 1685668924.059701, "vars": null, "version": 0, "zone": "global_zone" }, "joins": {}, "meta": {}, "name": "broken_specific_month_date_23_1", "type": "TimePeriod" } ] } ```:boom: Generic month date (Day 1)
### Config ```conf object TimePeriod "broken_generic_month_date" { ranges = { "day 1" = "00:00-24:00" } } object TimePeriod "broken_generic_month_date_16" { ranges = { "day 1" = "16:00-16:50" } } object TimePeriod "broken_generic_month_date_23_1" { ranges = { "day 1" = "23:00-01:00" } } ``` ### API Object /v1/objects/timeperiod ```json { "results": [ { "attrs": { "__name": "broken_generic_month_date", "active": true, "display_name": "broken_generic_month_date", "excludes": [], "ha_mode": 0, "includes": [], "is_inside": true, "name": "broken_generic_month_date", "original_attributes": null, "package": "_etc", "paused": false, "prefer_includes": true, "ranges": { "day 1": "00:00-24:00" }, "segments": [ { "begin": 1685570400, "end": 1685743200 } ], "source_location": { "first_column": 1, "first_line": 79, "last_column": 45, "last_line": 79, "path": "/etc/icinga2/zones.d/global_zone/timeperiods.conf" }, "templates": [ "broken_generic_month_date", "legacy-timeperiod" ], "type": "TimePeriod", "update": { "arguments": [ "tp", "begin", "end" ], "deprecated": false, "name": "Internal#LegacyTimePeriod", "side_effect_free": false, "type": "Function" }, "valid_begin": 1685578024.058635, "valid_end": 1685743200, "vars": null, "version": 0, "zone": "global_zone" }, "joins": {}, "meta": {}, "name": "broken_generic_month_date", "type": "TimePeriod" } ] } { "results": [ { "attrs": { "__name": "broken_generic_month_date_16", "active": true, "display_name": "broken_generic_month_date_16", "excludes": [], "ha_mode": 0, "includes": [], "is_inside": false, "name": "broken_generic_month_date_16", "original_attributes": null, "package": "_etc", "paused": false, "prefer_includes": true, "ranges": { "day 1": "16:00-16:50" }, "segments": [ { "begin": 1685628000, "end": 1685631000 }, { "begin": 1685714400, "end": 1685717400 } ], "source_location": { "first_column": 1, "first_line": 87, "last_column": 48, "last_line": 87, "path": "/etc/icinga2/zones.d/global_zone/timeperiods.conf" }, "templates": [ "broken_generic_month_date_16", "legacy-timeperiod" ], "type": "TimePeriod", "update": { "arguments": [ "tp", "begin", "end" ], "deprecated": false, "name": "Internal#LegacyTimePeriod", "side_effect_free": false, "type": "Function" }, "valid_begin": 1685578024.058635, "valid_end": 1685717400, "vars": null, "version": 0, "zone": "global_zone" }, "joins": {}, "meta": {}, "name": "broken_generic_month_date_16", "type": "TimePeriod" } ] } { "results": [ { "attrs": { "__name": "broken_generic_month_date_23_1", "active": true, "display_name": "broken_generic_month_date_23_1", "excludes": [], "ha_mode": 0, "includes": [], "is_inside": false, "name": "broken_generic_month_date_23_1", "original_attributes": null, "package": "_etc", "paused": false, "prefer_includes": true, "ranges": { "day 1": "23:00-01:00" }, "segments": [ { "begin": 1685653200, "end": 1685660400 }, { "begin": 1685739600, "end": 1685746800 } ], "source_location": { "first_column": 1, "first_line": 95, "last_column": 50, "last_line": 95, "path": "/etc/icinga2/zones.d/global_zone/timeperiods.conf" }, "templates": [ "broken_generic_month_date_23_1", "legacy-timeperiod" ], "type": "TimePeriod", "update": { "arguments": [ "tp", "begin", "end" ], "deprecated": false, "name": "Internal#LegacyTimePeriod", "side_effect_free": false, "type": "Function" }, "valid_begin": 1685578024.058635, "valid_end": 1685746800, "vars": null, "version": 0, "zone": "global_zone" }, "joins": {}, "meta": {}, "name": "broken_generic_month_date_23_1", "type": "TimePeriod" } ] } ```:boom: Offset weekday of specific month (last Wednesday in May)
### Config ```conf object TimePeriod "broken_offset_weekday_of_specific_month" { ranges = { "wednesday -1 may" = "00:00-24:00" } } object TimePeriod "broken_offset_weekday_of_specific_month_16" { ranges = { "wednesday -1 may" = "16:00-16:50" } } object TimePeriod "broken_offset_weekday_of_specific_month_23_1" { ranges = { "wednesday -1 may" = "23:00-01:00" } } ``` ### API Object /v1/objects/timeperiod ```json { "results": [ { "attrs": { "__name": "broken_offset_weekday_of_specific_month", "active": true, "display_name": "broken_offset_weekday_of_specific_month", "excludes": [], "ha_mode": 0, "includes": [], "is_inside": true, "name": "broken_offset_weekday_of_specific_month", "original_attributes": null, "package": "_etc", "paused": false, "prefer_includes": true, "ranges": { "wednesday -1 may": "00:00-24:00" }, "segments": [ { "begin": 1685570400, "end": 1685656800 } ], "source_location": { "first_column": 1, "first_line": 127, "last_column": 59, "last_line": 127, "path": "/etc/icinga2/zones.d/global_zone/timeperiods.conf" }, "templates": [ "broken_offset_weekday_of_specific_month", "legacy-timeperiod" ], "type": "TimePeriod", "update": { "arguments": [ "tp", "begin", "end" ], "deprecated": false, "name": "Internal#LegacyTimePeriod", "side_effect_free": false, "type": "Function" }, "valid_begin": 1685578624.05949, "valid_end": 1685668624.05949, "vars": null, "version": 0, "zone": "global_zone" }, "joins": {}, "meta": {}, "name": "broken_offset_weekday_of_specific_month", "type": "TimePeriod" } ] } { "results": [ { "attrs": { "__name": "broken_offset_weekday_of_specific_month_16", "active": true, "display_name": "broken_offset_weekday_of_specific_month_16", "excludes": [], "ha_mode": 0, "includes": [], "is_inside": false, "name": "broken_offset_weekday_of_specific_month_16", "original_attributes": null, "package": "_etc", "paused": false, "prefer_includes": true, "ranges": { "wednesday -1 may": "16:00-16:50" }, "segments": [ { "begin": 1685628000, "end": 1685631000 } ], "source_location": { "first_column": 1, "first_line": 135, "last_column": 62, "last_line": 135, "path": "/etc/icinga2/zones.d/global_zone/timeperiods.conf" }, "templates": [ "broken_offset_weekday_of_specific_month_16", "legacy-timeperiod" ], "type": "TimePeriod", "update": { "arguments": [ "tp", "begin", "end" ], "deprecated": false, "name": "Internal#LegacyTimePeriod", "side_effect_free": false, "type": "Function" }, "valid_begin": 1685578624.05949, "valid_end": 1685668624.05949, "vars": null, "version": 0, "zone": "global_zone" }, "joins": {}, "meta": {}, "name": "broken_offset_weekday_of_specific_month_16", "type": "TimePeriod" } ] } { "results": [ { "attrs": { "__name": "broken_offset_weekday_of_specific_month_23_1", "active": true, "display_name": "broken_offset_weekday_of_specific_month_23_1", "excludes": [], "ha_mode": 0, "includes": [], "is_inside": false, "name": "broken_offset_weekday_of_specific_month_23_1", "original_attributes": null, "package": "_etc", "paused": false, "prefer_includes": true, "ranges": { "wednesday -1 may": "23:00-01:00" }, "segments": [ { "begin": 1685653200, "end": 1685660400 } ], "source_location": { "first_column": 1, "first_line": 143, "last_column": 64, "last_line": 143, "path": "/etc/icinga2/zones.d/global_zone/timeperiods.conf" }, "templates": [ "broken_offset_weekday_of_specific_month_23_1", "legacy-timeperiod" ], "type": "TimePeriod", "update": { "arguments": [ "tp", "begin", "end" ], "deprecated": false, "name": "Internal#LegacyTimePeriod", "side_effect_free": false, "type": "Function" }, "valid_begin": 1685578624.05949, "valid_end": 1685668624.05949, "vars": null, "version": 0, "zone": "global_zone" }, "joins": {}, "meta": {}, "name": "broken_offset_weekday_of_specific_month_23_1", "type": "TimePeriod" } ] } ```:boom: Offset weekday (1th Thursday)
### Config ```conf object TimePeriod "broken_offset_weekday" { ranges = { "thursday 1" = "00:00-24:00" } } object TimePeriod "broken_offset_weekday_16" { ranges = { "thursday 1" = "16:00-16:50" } } object TimePeriod "broken_offset_weekday_23_1" { ranges = { "thursday 1" = "23:00-01:00" } } ``` ### API Object /v1/objects/timeperiod ```json { "results": [ { "attrs": { "__name": "broken_offset_weekday", "active": true, "display_name": "broken_offset_weekday", "excludes": [], "ha_mode": 0, "includes": [], "is_inside": true, "name": "broken_offset_weekday", "original_attributes": null, "package": "_etc", "paused": false, "prefer_includes": true, "ranges": { "thursday 1": "00:00-24:00" }, "segments": [ { "begin": 1685570400, "end": 1685743200 } ], "source_location": { "first_column": 1, "first_line": 103, "last_column": 41, "last_line": 103, "path": "/etc/icinga2/zones.d/global_zone/timeperiods.conf" }, "templates": [ "broken_offset_weekday", "legacy-timeperiod" ], "type": "TimePeriod", "update": { "arguments": [ "tp", "begin", "end" ], "deprecated": false, "name": "Internal#LegacyTimePeriod", "side_effect_free": false, "type": "Function" }, "valid_begin": 1685578324.059023, "valid_end": 1685743200, "vars": null, "version": 0, "zone": "global_zone" }, "joins": {}, "meta": {}, "name": "broken_offset_weekday", "type": "TimePeriod" } ] } { "results": [ { "attrs": { "__name": "broken_offset_weekday_16", "active": true, "display_name": "broken_offset_weekday_16", "excludes": [], "ha_mode": 0, "includes": [], "is_inside": false, "name": "broken_offset_weekday_16", "original_attributes": null, "package": "_etc", "paused": false, "prefer_includes": true, "ranges": { "thursday 1": "16:00-16:50" }, "segments": [ { "begin": 1685628000, "end": 1685631000 }, { "begin": 1685714400, "end": 1685717400 } ], "source_location": { "first_column": 1, "first_line": 111, "last_column": 44, "last_line": 111, "path": "/etc/icinga2/zones.d/global_zone/timeperiods.conf" }, "templates": [ "broken_offset_weekday_16", "legacy-timeperiod" ], "type": "TimePeriod", "update": { "arguments": [ "tp", "begin", "end" ], "deprecated": false, "name": "Internal#LegacyTimePeriod", "side_effect_free": false, "type": "Function" }, "valid_begin": 1685578324.059023, "valid_end": 1685717400, "vars": null, "version": 0, "zone": "global_zone" }, "joins": {}, "meta": {}, "name": "broken_offset_weekday_16", "type": "TimePeriod" } ] } { "results": [ { "attrs": { "__name": "broken_offset_weekday_23_1", "active": true, "display_name": "broken_offset_weekday_23_1", "excludes": [], "ha_mode": 0, "includes": [], "is_inside": false, "name": "broken_offset_weekday_23_1", "original_attributes": null, "package": "_etc", "paused": false, "prefer_includes": true, "ranges": { "thursday 1": "23:00-01:00" }, "segments": [ { "begin": 1685653200, "end": 1685660400 }, { "begin": 1685739600, "end": 1685746800 } ], "source_location": { "first_column": 1, "first_line": 119, "last_column": 46, "last_line": 119, "path": "/etc/icinga2/zones.d/global_zone/timeperiods.conf" }, "templates": [ "broken_offset_weekday_23_1", "legacy-timeperiod" ], "type": "TimePeriod", "update": { "arguments": [ "tp", "begin", "end" ], "deprecated": false, "name": "Internal#LegacyTimePeriod", "side_effect_free": false, "type": "Function" }, "valid_begin": 1685578324.059023, "valid_end": 1685746800, "vars": null, "version": 0, "zone": "global_zone" }, "joins": {}, "meta": {}, "name": "broken_offset_weekday_23_1", "type": "TimePeriod" } ] } ```:heavy_check_mark: Normal weekday (Tuesday)
### Config ```conf object TimePeriod "working_weekday" { ranges = { wednesday = "00:00-24:00" } } object TimePeriod "working_weekday_16" { ranges = { wednesday = "16:00-16:50" } } object TimePeriod "working_weekday_23_1" { ranges = { wednesday = "23:00-01:00" } } ``` ### API Object /v1/objects/timeperiod ```json { "results": [ { "attrs": { "__name": "working_weekday", "active": true, "display_name": "working_weekday", "excludes": [], "ha_mode": 0, "includes": [], "is_inside": false, "name": "working_weekday", "original_attributes": null, "package": "_etc", "paused": false, "prefer_includes": true, "ranges": { "wednesday": "00:00-24:00" }, "segments": [], "source_location": { "first_column": 1, "first_line": 202, "last_column": 35, "last_line": 202, "path": "/etc/icinga2/zones.d/global_zone/timeperiods.conf" }, "templates": [ "working_weekday", "legacy-timeperiod" ], "type": "TimePeriod", "update": { "arguments": [ "tp", "begin", "end" ], "deprecated": false, "name": "Internal#LegacyTimePeriod", "side_effect_free": false, "type": "Function" }, "valid_begin": 1685600397.683432, "valid_end": 1685690397.683432, "vars": null, "version": 0, "zone": "global_zone" }, "joins": {}, "meta": {}, "name": "working_weekday", "type": "TimePeriod" } ] } { "results": [ { "attrs": { "__name": "working_weekday_16", "active": true, "display_name": "working_weekday_16", "excludes": [], "ha_mode": 0, "includes": [], "is_inside": false, "name": "working_weekday_16", "original_attributes": null, "package": "_etc", "paused": false, "prefer_includes": true, "ranges": { "wednesday": "16:00-16:50" }, "segments": [], "source_location": { "first_column": 1, "first_line": 210, "last_column": 38, "last_line": 210, "path": "/etc/icinga2/zones.d/global_zone/timeperiods.conf" }, "templates": [ "working_weekday_16", "legacy-timeperiod" ], "type": "TimePeriod", "update": { "arguments": [ "tp", "begin", "end" ], "deprecated": false, "name": "Internal#LegacyTimePeriod", "side_effect_free": false, "type": "Function" }, "valid_begin": 1685600397.683432, "valid_end": 1685690397.683432, "vars": null, "version": 0, "zone": "global_zone" }, "joins": {}, "meta": {}, "name": "working_weekday_16", "type": "TimePeriod" } ] } { "results": [ { "attrs": { "__name": "working_weekday_23_1", "active": true, "display_name": "working_weekday_23_1", "excludes": [], "ha_mode": 0, "includes": [], "is_inside": false, "name": "working_weekday_23_1", "original_attributes": null, "package": "_etc", "paused": false, "prefer_includes": true, "ranges": { "wednesday": "23:00-01:00" }, "segments": [], "source_location": { "first_column": 1, "first_line": 218, "last_column": 40, "last_line": 218, "path": "/etc/icinga2/zones.d/global_zone/timeperiods.conf" }, "templates": [ "working_weekday_23_1", "legacy-timeperiod" ], "type": "TimePeriod", "update": { "arguments": [ "tp", "begin", "end" ], "deprecated": false, "name": "Internal#LegacyTimePeriod", "side_effect_free": false, "type": "Function" }, "valid_begin": 1685600697.683747, "valid_end": 1685690697.683747, "vars": null, "version": 0, "zone": "global_zone" }, "joins": {}, "meta": {}, "name": "working_weekday_23_1", "type": "TimePeriod" } ] } ```:boom: Issue also stacks per date definition
### Config ```conf object TimePeriod "broken_multiple" { ranges = { "2023-05-31" = "08:00-09:00" "2023-06-01" = "10:00-11:00" } } object TimePeriod "broken_multiple_overlap" { ranges = { "2023-05-31" = "08:00-09:30" "2023-06-01" = "09:00-11:00" } } ``` ### API Object /v1/objects/timeperiod ```json { "results": [ { "attrs": { "__name": "broken_multiple", "active": true, "display_name": "broken_multiple", "excludes": [], "ha_mode": 0, "includes": [], "is_inside": true, "name": "broken_multiple", "original_attributes": null, "package": "_etc", "paused": false, "prefer_includes": true, "ranges": { "2023-05-31": "08:00-09:00", "2023-06-01": "10:00-11:00" }, "segments": [ { "begin": 1685599200, "end": 1685602800 }, { "begin": 1685606400, "end": 1685610000 }, { "begin": 1685692800, "end": 1685696400 } ], "source_location": { "first_column": 1, "first_line": 125, "last_column": 35, "last_line": 125, "path": "/etc/icinga2/zones.d/global_zone/timeperiods.conf" }, "templates": [ "broken_multiple", "legacy-timeperiod" ], "type": "TimePeriod", "update": { "arguments": [ "tp", "begin", "end" ], "deprecated": false, "name": "Internal#LegacyTimePeriod", "side_effect_free": false, "type": "Function" }, "valid_begin": 1685599200, "valid_end": 1685696400, "vars": null, "version": 0, "zone": "global_zone" }, "joins": {}, "meta": {}, "name": "broken_multiple", "type": "TimePeriod" } ] } { "results": [ { "attrs": { "__name": "broken_multiple_overlap", "active": true, "display_name": "broken_multiple_overlap", "excludes": [], "ha_mode": 0, "includes": [], "is_inside": false, "name": "broken_multiple_overlap", "original_attributes": null, "package": "_etc", "paused": false, "prefer_includes": true, "ranges": { "2023-05-31": "08:00-09:30", "2023-06-01": "09:00-11:00" }, "segments": [ { "begin": 1685599200, "end": 1685610000 }, { "begin": 1685689200, "end": 1685696400 } ], "source_location": { "first_column": 1, "first_line": 134, "last_column": 43, "last_line": 134, "path": "/etc/icinga2/zones.d/global_zone/timeperiods.conf" }, "templates": [ "broken_multiple_overlap", "legacy-timeperiod" ], "type": "TimePeriod", "update": { "arguments": [ "tp", "begin", "end" ], "deprecated": false, "name": "Internal#LegacyTimePeriod", "side_effect_free": false, "type": "Function" }, "valid_begin": 1685599200, "valid_end": 1685696400, "vars": null, "version": 0, "zone": "global_zone" }, "joins": {}, "meta": {}, "name": "broken_multiple_overlap", "type": "TimePeriod" } ] } ```All tests has been done on the 2023-06-01 with CEST as timezone on OS layer.
The segments are using floats based unixtime stamps in the api representation. Use
date -d @1685660400
to convert it in something more understandable.Expected behavior
Only the defined time frame should be rendert as segment.
Your Environment
Include as many relevant details about the environment you experienced the problem in
Version used (
icinga2 --version
):Oracle Linux Server 7.9
icinga2 feature list
):Additional context
This issue relates to the following issues that describes the same issue or a followup issue that root cause is the broken date to segment mapping.
followup #8741 duplicates #9388 relates to #7398