Merge "Trigger the target down alert after 2 minutes"
diff --git a/README.rst b/README.rst
index 4c126b5..c1f4498 100644
--- a/README.rst
+++ b/README.rst
@@ -121,6 +121,18 @@
webhook_configs:
- url: http://127.0.0.1
send_resolved: true
+ - name: 'HTTP-slack'
+ slack_configs:
+ - api_url: http://127.0.0.1/slack
+ send_resolved: true
+ - name: 'smtp'
+ email_configs:
+ - to: test@example.com
+ from: test@example.com
+ smarthost: example.com
+ auth_username: username
+ auth_password: password
+ send_resolved: true
Configure pushgateway
---------------------
diff --git a/prometheus/files/alertmanager.yml b/prometheus/files/alertmanager.yml
index 7139d48..86761de 100644
--- a/prometheus/files/alertmanager.yml
+++ b/prometheus/files/alertmanager.yml
@@ -76,6 +76,44 @@
send_resolved: {{ webhook.send_resolved | lower }}
{%- endif %}
{%- endfor %}
+ {%- elif config.slack_configs is defined %}
+ slack_configs:
+ {%- for name, slack in config.slack_configs.iteritems() %}
+ # {{ name }}
+ - api_url: {{ slack.api_url }}
+ {%- if slack.send_resolved is defined %}
+ send_resolved: {{ slack.send_resolved | lower }}
+ {%- endif %}
+ {%- if slack.channel is defined %}
+ channel: {{ slack.channel }}
+ {%- endif %}
+ {%- endfor %}
+ {%- elif config.email_configs is defined %}
+ email_configs:
+ {%- for name, email in config.email_configs.iteritems() %}
+ # {{ name }}
+ - to: {{ email.to }}
+ from: {{ email.from }}
+ smarthost: {{ email.smarthost }}
+ {%- if email.auth_username is defined %}
+ auth_username: '{{ email.auth_username }}'
+ {%- endif %}
+ {%- if email.auth_password is defined %}
+ auth_password: '{{ email.auth_password }}'
+ {%- endif %}
+ {%- if email.auth_secret is defined %}
+ auth_secret: '{{ email.auth_secret }}'
+ {%- endif %}
+ {%- if email.auth_identity is defined %}
+ auth_identity: '{{ email.auth_identity}}'
+ {%- endif %}
+ {%- if email.require_tls is defined %}
+ require_tls: {{ email.require_tls | lower }}
+ {%- endif %}
+ {%- if email.send_resolved is defined %}
+ send_resolved: {{ email.send_resolved | lower }}
+ {%- endif %}
+ {%- endfor %}
{%- endif %}
{%- endif %}
{%- endfor %}
diff --git a/tests/pillar/alertmanager.sls b/tests/pillar/alertmanager.sls
index d22c28f..f15cd2c 100644
--- a/tests/pillar/alertmanager.sls
+++ b/tests/pillar/alertmanager.sls
@@ -38,6 +38,18 @@
webhook_configs:
- url: http://127.0.0.1
send_resolved: true
+ - name: 'HTTP-slack'
+ slack_configs:
+ - api_url: http://127.0.0.1/slack
+ send_resolved: true
+ - name: 'smtp'
+ email_configs:
+ - to: test@example.com
+ from: test@example.com
+ smarthost: example.com
+ auth_username: username
+ auth_password: password
+ send_resolved: true
docker:
host:
enabled: true