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:
resolve_timeout: 5m
route:
group_by: ['alertname', 'region', 'service']
group_by: ['region', 'service']
group_wait: 60s
group_interval: 5m
repeat_interval: 3h
receiver: HTTP-notification
inhibit_rules:
- source_match:
receiver: default
inhibit_rule:
InhibitCriticalWhenDown:
enabled: true
source_match:
severity: 'down'
target_match:
severity: 'critical'
equal: ['region', 'service']
- source_match:
InhibitWarningWhenDown:
enabled: true
source_match:
severity: 'down'
target_match:
severity: 'warning'
equal: ['region', 'service']
- source_match:
InhibitWarningWhenCritical:
enabled: true
source_match:
severity: 'critical'
target_match:
severity: 'warning'
equal: ['alertname', 'region', 'service']
receivers:
- name: 'HTTP-notification'
equal: ['region', 'service']
receiver:
HTTP-notification:
webhook_configs:
- url: http://127.0.0.1
localhost:
url: http://127.0.0.1
send_resolved: true
- name: 'HTTP-slack'
HTTP-slack:
slack_configs:
- api_url: http://127.0.0.1/slack
slack:
api_url: http://127.0.0.1/slack
send_resolved: true
- name: 'smtp'
smtp:
email_configs:
- to: test@example.com
email:
to: test@example.com
from: test@example.com
smarthost: example.com
auth_username: username
auth_password: password
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
---------------------

View File

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

View File

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