Skip to content

Commit

Permalink
enhancement: Add time_intervals to AlertManager
Browse files Browse the repository at this point in the history
  • Loading branch information
rezizter committed Nov 29, 2023
1 parent f3a6806 commit fa82fc0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
9 changes: 8 additions & 1 deletion roles/alertmanager/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,14 @@ alertmanager_receivers: []
# slack_configs:
# - send_resolved: true
# channel: '#alerts'

alertmanager_time_intervals:: []
# alertmanager_time_intervals:
# - name: offhours
# time_intervals:
# - times:
# - end_time: "21:00"
# start_time: "24:00"
# location: "Africa/Johannesburg"
alertmanager_inhibit_rules: []
# alertmanager_inhibit_rules:
# - target_match:
Expand Down
3 changes: 3 additions & 0 deletions roles/alertmanager/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ argument_specs:
alertmanager_receivers:
description: "A list of notification receivers. Configuration same as in L(official docs,https://prometheus.io/docs/alerting/configuration/#receiver)"
type: "list"
alertmanager_time_intervals:
description: "A list of time intervals. Configuration same as in L(official docs,https://prometheus.io/docs/alerting/latest/configuration/#time_interval)"
type: "list"
alertmanager_inhibit_rules:
description: "List of inhibition rules. Same as in L(official docs,https://prometheus.io/docs/alerting/configuration/#inhibit_rule)"
type: "list"
Expand Down
4 changes: 4 additions & 0 deletions roles/alertmanager/templates/alertmanager.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,9 @@ receivers:
inhibit_rules:
{{ alertmanager_inhibit_rules | to_nice_yaml(indent=2) }}
{% endif %}
{% if alertmanager_time_intervals | length %}
time_intervals:
{{ alertmanager_time_intervals | to_nice_yaml(indent=2) }}
{% endif %}
route:
{{ alertmanager_route | to_nice_yaml(indent=2) | indent(2, False) }}

0 comments on commit fa82fc0

Please sign in to comment.