add general custom receivers and template
This commit is contained in:
parent
4e43dd54e2
commit
7a6687469d
|
@ -29,8 +29,11 @@ alertmanager_probe_interval: '5s'
|
|||
#alertmanager_smtp_from: ~
|
||||
#alertmanager_smtp_user: ~
|
||||
#alertmanager_smtp_pass: ~
|
||||
alertmanager_smtp_receivers_extra: []
|
||||
alertmanager_receivers_extra: []
|
||||
# - name: 'devops'
|
||||
# routes:
|
||||
# continue: true
|
||||
# receivers:
|
||||
# email_configs:
|
||||
# - to: 'devops@example.org'
|
||||
# send_resolved: true
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
{{ define "discord.custom.title" }}[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] {{ .GroupLabels.SortedPairs.Values | join " " }}{{ end }}
|
||||
|
||||
{{ define "__text_alert_description_list" }}{{ range . }}- [{{ .Annotations.description }}]({{ .GeneratorURL }})
|
||||
{{ end }}{{ end }}
|
||||
|
||||
{{ define "discord.custom.message" }}
|
||||
{{ if gt (len .Alerts.Firing) 0 }}
|
||||
Alerts Firing:
|
||||
{{ template "__text_alert_description_list" .Alerts.Firing }}
|
||||
{{ end }}
|
||||
{{ if gt (len .Alerts.Resolved) 0 }}
|
||||
Alerts Resolved:
|
||||
{{ template "__text_alert_description_list" .Alerts.Resolved }}
|
||||
{{ end }}
|
||||
{{ end }}
|
|
@ -9,7 +9,7 @@
|
|||
mode: 0750
|
||||
with_items:
|
||||
- 'data'
|
||||
- 'conf'
|
||||
- 'conf/templates'
|
||||
|
||||
- name: Create config files
|
||||
template:
|
||||
|
@ -22,3 +22,11 @@
|
|||
with_items:
|
||||
- 'alertmanager.yml'
|
||||
- 'amtool.yml'
|
||||
|
||||
- name: Create template file
|
||||
copy:
|
||||
src: 'custom.tmpl'
|
||||
dest: '{{ alertmanager_service_path }}/conf/templates/custom.tmpl'
|
||||
owner: 'dockremap'
|
||||
group: 'docker'
|
||||
mode: 0640
|
||||
|
|
|
@ -23,14 +23,15 @@ route:
|
|||
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 %}
|
||||
{% for extra_receiver in alertmanager_smtp_receivers_extra %}
|
||||
- receiver: '{{ extra_receiver.name }}'
|
||||
continue: true
|
||||
{% endfor %}
|
||||
|
||||
receivers:
|
||||
- name: 'admin-email'
|
||||
|
@ -47,9 +48,12 @@ receivers:
|
|||
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 }}
|
||||
{% 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 %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
templates:
|
||||
- '/etc/alertmanager/templates/custom.tmpl'
|
||||
|
|
|
@ -13,6 +13,7 @@ services:
|
|||
volumes:
|
||||
- '{{ alertmanager_service_path }}/conf/alertmanager.yml:/etc/alertmanager.yml:ro'
|
||||
- '{{ alertmanager_service_path }}/conf/amtool.yml:/etc/amtool/config.yml:ro'
|
||||
- '{{ alertmanager_service_path }}/conf/templates:/etc/alertmanager/templates:ro'
|
||||
- '{{ alertmanager_service_path }}/data:/data'
|
||||
- '/certs:/certs'
|
||||
command:
|
||||
|
|
Loading…
Reference in New Issue