need sample config for alertmanager

59 views
Skip to first unread message

Ishvar B

unread,
Jun 10, 2020, 10:40:55 AM6/10/20
to Prometheus Users
Hi,

I have got prometheus and alert manager set up and running. I am using pagerduty as receiver from alertmanager. Now, i want to create separate services in pagerduty for separate applications. How do i configure alertmanager to send these alerts to the service based on the application name?

How does default-receiver work here? Also, application is a label in my prometheus.yml config. Am i correct in saying that the application comes from prometheus.yml config? 
global:
  resolve_timeout: 1m
route:
  receiver: default-receiver
  routes:
  - receiver: teamA
    match:
      application: appA
  - receiver: teamB
    match:
      application: appB
receivers:
- name: default-receiver 
- name: teamA
  pagerduty_configs:
  - send_resolved: true
    routing_key: ${PAGERDUTY_KEY_APPA}
    description: '{{ template "pagerduty.default.description" .}}'
    severity: '{{ .CommonLabels.severity }}'
    details:
      summary: |-
        {{ range .Alerts }}{{ .Annotations.summary }}
        {{ end }}
      severity: '{{ .CommonLabels.severity }}'
      status: '{{ .Status }}'
- name: teamB 
  - send_resolved: true
    routing_key: ${PAGERDUTY_KEY_APPB}
    description: '{{ template "pagerduty.default.description" .}}'
    severity: '{{ .CommonLabels.severity }}'
    details:
      summary: |-
        {{ range .Alerts }}{{ .Annotations.summary }}
        {{ end }}
      severity: '{{ .CommonLabels.severity }}'
      status: '{{ .Status }}'

Tigran

unread,
Feb 5, 2021, 3:55:25 AM2/5/21
to Prometheus Users
hello,

You must create a rule in pager duty that will match the name of the application and route it to the corresponding service.

This means that the alert my carry the application name incide it's labels or summary.
Reply all
Reply to author
Forward
0 new messages