Configure prometheus alert manager with Slack notifications

This commit is contained in:
Prathamesh Musale 2024-05-31 18:09:08 +05:30
parent ed8914b8d3
commit b036e26087
4 changed files with 36 additions and 2 deletions

View File

@ -18,6 +18,14 @@ services:
extra_hosts:
- "host.docker.internal:host-gateway"
alert-manager:
image: prom/alertmanager
volumes:
- ../config/monitoring/alertmanager/alertmanager.yml:/etc/alertmanager/alertmanager.yml
- alertmanager_data:/data
ports:
- "9093"
blackbox:
image: prom/blackbox-exporter:latest
restart: always
@ -55,3 +63,4 @@ services:
volumes:
prometheus_data:
alertmanager_data:

View File

@ -0,0 +1,10 @@
route:
receiver: 'slack'
# group_by: [ alertname ]
receivers:
- name: 'slack'
slack_configs:
- send_resolved: true
api_url: <YOUR_SLACK_WEBHOOK_URL>
channel: <YOUR_SLACK_CHANNEL>

View File

@ -3,8 +3,13 @@ global:
evaluation_interval: 15s
rule_files:
# - "first.rules"
# - "second.rules"
- rules.yml
alerting:
alertmanagers:
- static_configs:
- targets:
- alert-manager:9093
scrape_configs:
- job_name: prometheus

View File

@ -0,0 +1,10 @@
groups:
- name: WatcherAlerts
rules:
- alert: SushiswapWatcherHeadTracking
expr: latest_block_number - on(chain) group_right sync_status_block_number{job="sushi", instance="sushiswap", kind="latest_indexed"} > 16
for: 5m
labels:
severity: 'critical'
annotations:
summary: 'Watcher {{ $labels.instance }} of job {{ $labels.job }} is falling behind external head'