Skip to content

Commit 9a67645

Browse files
committed
add config files
1 parent 740e12c commit 9a67645

File tree

81 files changed

+6440
-77
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+6440
-77
lines changed

.env.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
TZ=UTC
2+
3+
GF_SECURITY_ADMIN_USER=admin
4+
GF_SECURITY_ADMIN_PASSWORD=admin123
5+
GF_USERS_DEFAULT_LANGUAGE=zh-CN

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
.env
22
.data/
3+
alertmanager.yml
4+
grafana.ini
5+
prometheus.yml

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Jack Ling
3+
Copyright (c) 2023 lingcoder
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1-
# prometheus-alerts
1+
# prometheus-alerts
2+
3+
### Prometheus rules:
4+
5+
https://github.com/samber/awesome-prometheus-alerts.git
6+
7+
### Grafana dashboards
8+
9+
https://grafana.com/grafana/dashboards/

alertmanager/alertmanager.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

alertmanager/alertmanager.yml.example

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
global:
2+
smtp_smarthost: 'xxxx:25'
3+
smtp_from: 'xxxx'
4+
smtp_auth_username: 'xxx'
5+
smtp_auth_password: 'xxx'
6+
smtp_require_tls: false
7+
8+
route:
9+
group_by: [ ... ] # 分组, ... 表示不分组
10+
group_wait: 60s # 同一组 告警 需要等待多少s才能发出
11+
group_interval: 5m # 同一组的多批次告警间隔多少秒后,才能发出
12+
repeat_interval: 1h # 重复告警要等待多久后才能再次发出去,目的是为了避免重复的消息发送多次
13+
receiver: 'webhook' # receiver名称,对应 receivers.name
14+
15+
# 配置报警方式
16+
receivers:
17+
- name: 'webhook'
18+
webhook_configs:
19+
- url: 'https://open.feishu.cn/open-apis/bot/v2/hook/your-api-key'
20+
21+
- name: 'email'
22+
email_configs:
23+
- to: 'abc@example.com'
24+
25+
# - name: 'discord'
26+
# discord_config:
27+
# - webhook_url: 'xxxx'
28+
#
29+
# - name: "slack"
30+
# slack_configs:
31+
# - api_url: "https://hooks.slack.com/services/xxxx"
32+
# channel: "#prometheus"
33+
# send_resolved: true
34+
# title: "{{ .CommonAnnotations.summary }}"
35+
# text: "{{ .CommonAnnotations.description }}"
36+
#
37+
# - name: "telegram"
38+
# telegram_configs:
39+
# - api_url: "https://api.telegram.org/botxxxx/sendMessage"
40+
# chat_id: "xxxx"
41+
# title: "{{ .CommonAnnotations.summary }}"
42+
# text: "{{ .CommonAnnotations.description }}"
43+
#
44+
# - name: "wechat"
45+
# wechat_configs:
46+
# - api_url: "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxxx"
47+
# title: "{{ .CommonAnnotations.summary }}"
48+
# text: "{{ .CommonAnnotations.description }}"
49+
50+
51+
# 抑制规则,减少垃圾告警的产生,比如主机挂了,主机上的服务,数据库,中间件等一系列告警 相对来说没有意义,可以通过抑制项这个功能,让Prometheus只发出主机挂了的告警。
52+
# 暂时不用
53+
# inhibit_rules:
54+
# - source_match:
55+
# # 匹配的严重级别,向上兼容,warning,critical,emergency,严重等级依次递增。
56+
# severity: 'critical'
57+
# target_match:
58+
# severity: 'warning'
59+
# equal: ['alertname', 'dev', 'instance'] # 确保这个配置下的标签内容相同才会抑制,也就是说警报中必须有这三个标签值才会被抑制。
60+

docker-compose.yaml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ networks:
66
driver: bridge
77

88
volumes:
9-
prometheus:
10-
grafana:
9+
prometheus-data:
10+
name: "prometheus-data"
11+
grafana-data:
12+
name: "grafana-data"
13+
alertmanager-data:
14+
name: "alertmanager-data"
1115

1216

1317
services:
@@ -18,7 +22,7 @@ services:
1822
- "9090:9090"
1923
volumes:
2024
- "./prometheus:/etc/prometheus"
21-
- "prometheus:/prometheus"
25+
- "prometheus-data:/prometheus"
2226

2327

2428
alertmanager:
@@ -28,6 +32,8 @@ services:
2832
- "9093:9093"
2933
volumes:
3034
- "./alertmanager/alertmanager.yml:/etc/alertmanager/alertmanager.yml"
35+
- "./alertmanager/rules:/etc/prometheus/rules"
36+
- "alertmanager-data:/alertmanager"
3137
# deploy:
3238
# resources:
3339
# limits:
@@ -36,11 +42,16 @@ services:
3642
grafana:
3743
image: grafana/grafana:latest
3844
restart: "always"
45+
environment:
46+
- GF_SECURITY_ADMIN_PASSWORD
47+
- GF_SECURITY_ADMIN_USER
48+
- GF_USERS_DEFAULT_LANGUAGE
3949
ports:
4050
- "3000:3000"
4151
volumes:
42-
# - "./grafana:/etc/grafana"
43-
- "grafana:/var/lib/grafana"
52+
- "./grafana/grafana.ini:/etc/grafana/grafana.ini"
53+
- "./grafana/provisioning:/etc/grafana/provisioning"
54+
- "grafana-data:/var/lib/grafana"
4455

4556

4657
node-exporter:

0 commit comments

Comments
 (0)