support providing extra alert receivers

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2023-05-12 15:11:48 +02:00
parent 4978f97eb5
commit e9de18e424
No known key found for this signature in database
GPG Key ID: FE65CD384D5BF7B4
2 changed files with 36 additions and 16 deletions

View File

@ -24,11 +24,16 @@ alertmanager_probe_timeout: '1000ms'
alertmanager_probe_interval: '5s'
# SMTP
alertmanager_smtp_host: ~
alertmanager_smtp_port: ~
alertmanager_smtp_from: ~
alertmanager_smtp_user: ~
alertmanager_smtp_pass: ~
#alertmanager_smtp_host: ~
#alertmanager_smtp_port: ~
#alertmanager_smtp_from: ~
#alertmanager_smtp_user: ~
#alertmanager_smtp_pass: ~
alertmanager_smtp_receivers_extra: []
# - name: 'devops'
# email_configs:
# - to: 'devops@example.org'
# send_resolved: true
# OAuth
alertmanager_oauth_id: ~
@ -47,9 +52,10 @@ alertmanager_group_interval: '3m'
alertmanager_repeat_interval: '1h'
# VictorOps paging service
alertmanager_victorops_api_key: ~
alertmanager_victorops_service_url: ~
alertmanager_victorops_routing_key: ~
alertmanager_victorops_enabled: false
#alertmanager_victorops_api_key: ~
#alertmanager_victorops_service_url: ~
#alertmanager_victorops_routing_key: ~
alertmanager_victorops_message_type: 'CRITICAL' # CRITICAL, WARNING, INFO
alertmanager_victorops_monitoring_tool: 'metrics'
alertmanager_victorops_state_message: |

View File

@ -23,19 +23,33 @@ route:
repeat_interval: '{{ alertmanager_repeat_interval | mandatory }}'
routes:
# send all notifications to VictorOps.
{% if alertmanager_victorops_enabled %}
- receiver: 'victorops-alerts'
continue: true
{% endif %}
{% for extra_receiver in alertmanager_smtp_receivers_extra %}
- receiver: '{{ extra_receiver.name }}'
continue: true
{% endfor %}
receivers:
- name: 'admin-email'
email_configs:
- to: '{{ alertmanager_admin_email | mandatory }}'
send_resolved: true
- to: '{{ alertmanager_admin_email | mandatory }}'
send_resolved: true
{% if alertmanager_victorops_enabled %}
- name: 'victorops-alerts'
victorops_configs:
- routing_key: '{{ alertmanager_victorops_routing_key | mandatory }}'
message_type: '{{ alertmanager_victorops_message_type | mandatory }}'
monitoring_tool: '{{ alertmanager_victorops_monitoring_tool | mandatory }}'
entity_display_name: '{{ alertmanager_victorops_display_name | mandatory | trim }}'
state_message: '{{ alertmanager_victorops_state_message | mandatory | trim }}'
- routing_key: '{{ alertmanager_victorops_routing_key | mandatory }}'
message_type: '{{ alertmanager_victorops_message_type | mandatory }}'
monitoring_tool: '{{ alertmanager_victorops_monitoring_tool | mandatory }}'
entity_display_name: '{{ alertmanager_victorops_display_name | mandatory | trim }}'
state_message: '{{ alertmanager_victorops_state_message | mandatory | trim }}'
{% endif %}
{% if alertmanager_smtp_receivers_extra|length > 0 %}
{% filter indent(width=2) %}
{{ alertmanager_smtp_receivers_extra | to_nice_yaml(indent=2) | trim }}
{% endfilter %}
{% endif %}