iadded posibility to define two endpoint in one receiver + test pillars + update Readme

This option is usefull when all alarms should be send to two or more receivers simultaneously - without need to use continue parameter

Change-Id: I6b8d833776549614d0381378a2e92cb5bc05af77
This commit is contained in:
Ondrej Smola 2017-11-20 20:13:20 +01:00 committed by Bartosz Kupidura
parent 2f5ed47dc9
commit 94baab3660
3 changed files with 67 additions and 28 deletions

View file

@ -95,44 +95,63 @@ Configure alertmanager
global: global:
resolve_timeout: 5m resolve_timeout: 5m
route: route:
group_by: ['alertname', 'region', 'service'] group_by: ['region', 'service']
group_wait: 60s group_wait: 60s
group_interval: 5m group_interval: 5m
repeat_interval: 3h repeat_interval: 3h
receiver: HTTP-notification receiver: default
inhibit_rules: inhibit_rule:
- source_match: InhibitCriticalWhenDown:
enabled: true
source_match:
severity: 'down' severity: 'down'
target_match: target_match:
severity: 'critical' severity: 'critical'
equal: ['region', 'service'] equal: ['region', 'service']
- source_match: InhibitWarningWhenDown:
enabled: true
source_match:
severity: 'down' severity: 'down'
target_match: target_match:
severity: 'warning' severity: 'warning'
equal: ['region', 'service'] equal: ['region', 'service']
- source_match: InhibitWarningWhenCritical:
enabled: true
source_match:
severity: 'critical' severity: 'critical'
target_match: target_match:
severity: 'warning' severity: 'warning'
equal: ['alertname', 'region', 'service'] equal: ['region', 'service']
receivers: receiver:
- name: 'HTTP-notification' HTTP-notification:
webhook_configs: webhook_configs:
- url: http://127.0.0.1 localhost:
url: http://127.0.0.1
send_resolved: true send_resolved: true
- name: 'HTTP-slack' HTTP-slack:
slack_configs: slack_configs:
- api_url: http://127.0.0.1/slack slack:
api_url: http://127.0.0.1/slack
send_resolved: true send_resolved: true
- name: 'smtp' smtp:
email_configs: email_configs:
- to: test@example.com email:
to: test@example.com
from: test@example.com from: test@example.com
smarthost: example.com smarthost: example.com
auth_username: username auth_username: username
auth_password: password auth_password: password
send_resolved: true send_resolved: true
#Two endpoints in one receiver
Multi-receiver:
slack_configs:
slack:
api_url: http://127.0.0.1/slack
send_resolved: true
webhook_configs:
webhook:
url: http://127.0.0.1
send_resolved: true
Configure pushgateway Configure pushgateway
--------------------- ---------------------

View file

@ -76,7 +76,8 @@ receivers:
send_resolved: {{ webhook.send_resolved | lower }} send_resolved: {{ webhook.send_resolved | lower }}
{%- endif %} {%- endif %}
{%- endfor %} {%- endfor %}
{%- elif config.slack_configs is defined %} {%- endif %}
{%- if config.slack_configs is defined %}
slack_configs: slack_configs:
{%- for name, slack in config.slack_configs.iteritems() %} {%- for name, slack in config.slack_configs.iteritems() %}
# {{ name }} # {{ name }}
@ -88,7 +89,8 @@ receivers:
channel: {{ slack.channel }} channel: {{ slack.channel }}
{%- endif %} {%- endif %}
{%- endfor %} {%- endfor %}
{%- elif config.email_configs is defined %} {%- endif %}
{%- if config.email_configs is defined %}
email_configs: email_configs:
{%- for name, email in config.email_configs.iteritems() %} {%- for name, email in config.email_configs.iteritems() %}
# {{ name }} # {{ name }}

View file

@ -17,39 +17,57 @@ prometheus:
group_interval: 5m group_interval: 5m
repeat_interval: 3h repeat_interval: 3h
receiver: HTTP-notification receiver: HTTP-notification
inhibit_rules: inhibit_rule:
- source_match: InhibitCriticalWhenDown:
enabled: true
source_match:
severity: 'down' severity: 'down'
target_match: target_match:
severity: 'critical' severity: 'critical'
equal: ['region', 'service'] equal: ['region', 'service']
- source_match: InhibitWarningWhenDown:
enabled: true
source_match:
severity: 'down' severity: 'down'
target_match: target_match:
severity: 'warning' severity: 'warning'
equal: ['region', 'service'] equal: ['region', 'service']
- source_match: InhibitWarningWhenCritical:
enabled: true
source_match:
severity: 'critical' severity: 'critical'
target_match: target_match:
severity: 'warning' severity: 'warning'
equal: ['alertname', 'region', 'service'] equal: ['region', 'service']
receivers: receiver:
- name: 'HTTP-notification' HTTP-notification:
webhook_configs: webhook_configs:
- url: http://127.0.0.1 webhook_example:
url: http://127.0.0.1
send_resolved: true send_resolved: true
- name: 'HTTP-slack' HTTP-slack:
slack_configs: slack_configs:
- api_url: http://127.0.0.1/slack slack_example:
api_url: http://127.0.0.1/slack
send_resolved: true send_resolved: true
- name: 'smtp' smtp:
email_configs: email_configs:
- to: test@example.com email_example:
to: test@example.com
from: test@example.com from: test@example.com
smarthost: example.com smarthost: example.com
auth_username: username auth_username: username
auth_password: password auth_password: password
send_resolved: true send_resolved: true
Multi-receiver:
webhook_configs:
webhook:
url: http://127.0.0.1
send_resolved: true
slack_configs:
slack:
api_url: http://127.0.0.1/slack
send_resolved: true
docker: docker:
host: host:
enabled: true enabled: true