카테고리 없음
프로메테우스 모니터링 알림 라우트 설정
Firewall
2024. 7. 18. 10:46
일단 계속 업데이트 할 예정입니다. 완료해서 포스팅 하려니까 자꾸 안하게 되어서요.
alert.rule 업데이트 하고 amtool 로 문법체크 하여 줍니다.
더 해야될 것은 채널에 이름나올떄 alertmanager 가 아니라 각 채널의 이름이 나오는 것과, Annotations.description 을 못가지고 오는 것 같은데, 왜 그런지 확인 하는 부분이 남아있습니다. ( {{ $labels.name }} 으로 가져오면 됩니다.)
global:
resolve_timeout: 5m
slack_api_url: "https://hooks.slack.com/services/ap1" # global Slack API URL
route:
group_by: ['alertname']
group_wait: 30s
group_interval: 5m
repeat_interval: 24h
receiver: 'default-receiver'
routes:
- matchers:
- job_name =~ "ap1"
receiver: 'ap1'
- matchers:
- job_name =~ "ap2"
receiver: 'ap2'
- matchers:
- job_name =~ "ap3"
receiver: 'ap3'
receivers:
- name: 'default-receiver'
slack_configs:
- api_url: "https://hooks.slack.com/services/ap1"
username: 'ap1'
send_resolved: true
channel: '#ap1'
title: "{{ range .Alerts }}{{ .Annotations.summary }}\n{{ end }}"
text: "{{ range .Alerts }}{{ .Annotations.description }}\n{{ end }}"
icon_emoji: ':bell:'
- name: 'ap2'
slack_configs:
- api_url: "https://hooks.slack.com/services/ap2"
username: 'ap2'
send_resolved: true
channel: '#ap2'
title: "{{ range .Alerts }}{{ .Annotations.summary }}\n{{ end }}"
text: "{{ range .Alerts }}{{ .Annotations.description }}\n{{ end }}"
icon_emoji: ':dart:'
- name: 'ap3'
slack_configs:
- api_url: "https://hooks.slack.com/services/ap3"
username: 'ap3'
send_resolved: true
channel: '#ap3'
title: "{{ range .Alerts }}{{ .Annotations.summary }}\n{{ end }}"
text: "{{ range .Alerts }}{{ .Annotations.description }}\n{{ end }}"
icon_emoji: ':dart:'
- name: 'ap4'
slack_configs:
- api_url: "https://hooks.slack.com/services/ap4"
channel: '#ap4'
title: "{{ range .Alerts }}{{ .Annotations.summary }}\n{{ end }}"
text: "{{ range .Alerts }}{{ .Annotations.description }}\n{{ end }}"
icon_emoji: ':bell:'
templates:
- /opt/prometheus/alertmanager/notifications.tmpl