Skip to content

Commit e5f8d11

Browse files
committed
add monitoring and telegram alerts
1 parent bb6c8fc commit e5f8d11

File tree

15 files changed

+1268
-4
lines changed

15 files changed

+1268
-4
lines changed
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
global:
2+
resolve_timeout: 5m
3+
4+
templates:
5+
- '/etc/alertmanager/*.tmpl'
6+
7+
route:
8+
receiver: 'default'
9+
group_by: ['alertname', 'component']
10+
group_wait: 10s
11+
group_interval: 10s
12+
repeat_interval: 12h
13+
routes:
14+
- match:
15+
severity: critical
16+
receiver: 'critical'
17+
continue: true
18+
19+
- match:
20+
severity: warning
21+
receiver: 'warning'
22+
continue: true
23+
24+
- match:
25+
severity: info
26+
receiver: 'info'
27+
28+
receivers:
29+
- name: 'default'
30+
webhook_configs:
31+
- url: 'http://localhost:5001/webhook'
32+
send_resolved: true
33+
34+
- name: 'critical'
35+
telegram_configs:
36+
- bot_token: 'BOT_TOKEN'
37+
chat_id: CHAT_ID
38+
parse_mode: 'HTML'
39+
message: |
40+
🚨 <b>CRITICAL ALERT</b>
41+
42+
<b>Alert:</b> {{ .GroupLabels.alertname }}
43+
<b>Severity:</b> {{ .CommonLabels.severity }}
44+
<b>Component:</b> {{ .CommonLabels.component }}
45+
46+
{{ range .Alerts }}
47+
<b>Description:</b> {{ .Annotations.description }}
48+
<b>Status:</b> {{ .Status }}
49+
{{ if .StartsAt }}<b>Started:</b> {{ .StartsAt.Format "2006-01-02 15:04:05" }}{{ end }}
50+
{{ end }}
51+
send_resolved: true
52+
53+
- name: 'warning'
54+
telegram_configs:
55+
- bot_token: 'BOT_TOKEN'
56+
chat_id: CHAT_ID
57+
parse_mode: 'HTML'
58+
message: |
59+
⚠️ <b>WARNING ALERT</b>
60+
61+
<b>Alert:</b> {{ .GroupLabels.alertname }}
62+
<b>Component:</b> {{ .CommonLabels.component }}
63+
64+
{{ range .Alerts }}
65+
<b>Description:</b> {{ .Annotations.description }}
66+
<b>Status:</b> {{ .Status }}
67+
{{ if .StartsAt }}<b>Started:</b> {{ .StartsAt.Format "2006-01-02 15:04:05" }}{{ end }}
68+
{{ end }}
69+
send_resolved: true
70+
71+
- name: 'info'
72+
telegram_configs:
73+
- bot_token: 'BOT_TOKEN'
74+
chat_id: CHAT_ID
75+
parse_mode: 'HTML'
76+
message: |
77+
ℹ️ <b>INFO ALERT</b>
78+
79+
<b>Alert:</b> {{ .GroupLabels.alertname }}
80+
<b>Component:</b> {{ .CommonLabels.component }}
81+
82+
{{ range .Alerts }}
83+
<b>Description:</b> {{ .Annotations.description }}
84+
{{ end }}
85+
send_resolved: true
86+
87+
inhibit_rules:
88+
- source_match:
89+
severity: 'critical'
90+
target_match:
91+
severity: 'warning'
92+
equal: ['alertname', 'component']
93+
94+
- source_match:
95+
severity: 'warning'
96+
target_match:
97+
severity: 'info'
98+
equal: ['alertname', 'component']

monitoring/docker-compose.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
version: '3.8'
2+
3+
services:
4+
prometheus:
5+
image: prom/prometheus:latest
6+
container_name: webrtc-prometheus
7+
volumes:
8+
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
9+
- ./prometheus/alerts.yml:/etc/prometheus/alerts.yml
10+
- prometheus-data:/prometheus
11+
command:
12+
- '--config.file=/etc/prometheus/prometheus.yml'
13+
- '--storage.tsdb.path=/prometheus'
14+
- '--web.console.libraries=/etc/prometheus/console_libraries'
15+
- '--web.console.templates=/etc/prometheus/consoles'
16+
- '--web.enable-lifecycle'
17+
ports:
18+
- "9090:9090"
19+
restart: unless-stopped
20+
networks:
21+
- monitoring
22+
23+
grafana:
24+
image: grafana/grafana:latest
25+
container_name: webrtc-grafana
26+
volumes:
27+
- grafana-data:/var/lib/grafana
28+
- ./grafana/provisioning:/etc/grafana/provisioning
29+
- ./grafana/dashboards:/var/lib/grafana/dashboards
30+
environment:
31+
- GF_SECURITY_ADMIN_USER=admin
32+
- GF_SECURITY_ADMIN_PASSWORD=admin
33+
- GF_USERS_ALLOW_SIGN_UP=false
34+
ports:
35+
- "3000:3000"
36+
restart: unless-stopped
37+
networks:
38+
- monitoring
39+
depends_on:
40+
- prometheus
41+
42+
alertmanager:
43+
image: prom/alertmanager:latest
44+
container_name: webrtc-alertmanager
45+
volumes:
46+
- ./alertmanager/alertmanager.yml:/etc/alertmanager/alertmanager.yml
47+
- alertmanager-data:/alertmanager
48+
command:
49+
- '--config.file=/etc/alertmanager/alertmanager.yml'
50+
- '--storage.path=/alertmanager'
51+
ports:
52+
- "9093:9093"
53+
restart: unless-stopped
54+
networks:
55+
- monitoring
56+
57+
networks:
58+
monitoring:
59+
driver: bridge
60+
61+
volumes:
62+
prometheus-data:
63+
grafana-data:
64+
alertmanager-data:

0 commit comments

Comments
 (0)