infra-role-alertmanager/templates/alertmanager.yml.j2

60 lines
2.3 KiB
Django/Jinja

---
global:
# SMTP authentication information.
smtp_from: '{{ alertmanager_smtp_from | mandatory }}'
smtp_smarthost: '{{ alertmanager_smtp_host | mandatory }}:{{ alertmanager_smtp_port | mandatory }}'
smtp_auth_username: '{{ alertmanager_smtp_user | mandatory }}'
smtp_auth_password: '{{ alertmanager_smtp_pass | mandatory }}'
smtp_require_tls: true
# VictorOps configuration
victorops_api_key: '{{ alertmanager_victorops_api_key | mandatory }}'
victorops_api_url: '{{ alertmanager_victorops_service_url | mandatory }}'
route:
# Default destination fo all alerts not matching any routes.
receiver: 'admin-email'
# How to group together alerts.
group_by: {{ alertmanager_group_by | to_yaml }}
# Wait this much before initial notification to group them.
group_wait: '{{ alertmanager_group_wait | mandatory }}'
# Wait before sending another batch for a group.
group_interval: '{{ alertmanager_group_interval | mandatory }}'
# Wait this much to resend notifications.
repeat_interval: '{{ alertmanager_repeat_interval | mandatory }}'
routes:
{% for extra_receiver in alertmanager_receivers_extra %}
{% filter indent(width=6) %}
- {{ {'receiver': extra_receiver.name} | combine(extra_receiver.routes) | to_nice_yaml(sort_keys=false) }}
{% endfilter %}
{% endfor %}
{% if alertmanager_victorops_enabled %}
- receiver: 'victorops-alerts'
continue: true
{% endif %}
receivers:
- name: 'admin-email'
email_configs:
- 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 }}'
{% endif %}
{% for extra_receiver in alertmanager_receivers_extra %}
{% filter indent(width=4) %}
- {{ {'name': extra_receiver.name} | combine(extra_receiver.receivers) | to_nice_yaml(sort_keys=false, indent=1) }}
{% endfilter %}
{% endfor %}
templates:
- '/etc/alertmanager/templates/custom.tmpl'