Skip to content

Instantly share code, notes, and snippets.

@iamabhishek-dubey
Created December 21, 2017 07:52
Show Gist options
  • Save iamabhishek-dubey/fe8bdedef22b9f48307119013a9736d8 to your computer and use it in GitHub Desktop.
Save iamabhishek-dubey/fe8bdedef22b9f48307119013a9736d8 to your computer and use it in GitHub Desktop.
Alertmanager ConfigMap with Slack Integrations
apiVersion: v1
data:
config.yml: |-
global:
# The directory from which notification templates are read.
templates:
- '/etc/alertmanager/template/*.tmpl'
# The root route on which each incoming alert enters.
route:
# The labels by which incoming alerts are grouped together. For example,
# multiple alerts coming in for cluster=A and alertname=LatencyHigh would
# be batched into a single group.
group_by: ['alertname', 'cluster', 'service']
# When a new group of alerts is created by an incoming alert, wait at
# least 'group_wait' to send the initial notification.
# This way ensures that you get multiple alerts for the same group that start
# firing shortly after another are batched together on the first
# notification.
group_wait: 3s
# When the first notification was sent, wait 'group_interval' to send a batch
# of new alerts that started firing for that group.
group_interval: 5s
# If an alert has successfully been sent, wait 'repeat_interval' to
# resend them.
repeat_interval: 1m
# A default receiver
receiver: mail-receiver
# All the above attributes are inherited by all child routes and can
# overwritten on each.
# The child route trees.
routes:
- match:
service: node
receiver: mail-receiver
routes:
- match:
severity: critical
receiver: critical-mail-receiver
# This route handles all alerts coming from a database service. If there's
# no team to handle it, it defaults to the DB team.
- match:
service: database
receiver: mail-receiver
routes:
- match:
severity: critical
receiver: critical-mail-receiver
# This route handles all alerts coming from a pod service. If there's
# no team to handle it, it defaults to the Pod team
receivers:
- name: 'mail-receiver'
slack_configs:
- api_url: 'https://hooks.slack.com/services/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'
channel: '#general'
- name: 'critical-mail-receiver'
slack_configs:
- api_url: 'https://hooks.slack.com/services/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'
channel: '#general'
kind: ConfigMap
metadata:
creationTimestamp: '2017-12-21T06:44:13Z'
name: alertmanager-config
namespace: prometheus
resourceVersion: '18047'
selfLink: /api/v1/namespaces/prometheus/configmaps/alertmanager-config
uid: 5b51cdbc-e61a-11e7-b6cb-3a1a0eaca67d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment