当前位置:网站首页>alertmanager告警配置
alertmanager告警配置
2022-06-12 02:23:00 【oneslide】
本例使用node_exporter的指标项内存占有率为例子,记录alertmanager如何配置内存占用率> 10%报警到腾讯企业邮箱。
docker-compose
version: '3.2'
services:
prometheus:
image: prom/prometheus:latest
container_name: prometheus
ports:
- 9090:9090
command:
- --config.file=/etc/prometheus/prometheus.yml
volumes:
- ./prom/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- ./prom/rule.yml:/etc/prometheus/rule.yml
grafana:
image: grafana/grafana-enterprise
ports:
- 3000:3000
node_exporter:
image: prom/node-exporter:latest
container_name: node_exporter
command:
- '--path.rootfs=/host'
network_mode: host
pid: host
restart: unless-stopped
volumes:
- '/:/host:ro,rslave'
alertmanager:
image: prom/alertmanager
volumes:
- ./alertmanager/alertmanager.yml:/etc/alertmanager/alertmanager.yml
ports:
- 9093:9093
prometheus配置
- prom/prometheus.yaml
# 告警规则的配置文件
rule_files:
- /etc/prometheus/rule.yml
# altermanager的服务地址
alerting:
alertmanagers:
- static_configs:
- targets:
- alertmanager:9093
- prom/rule.yml
groups:
- name: example
rules:
- alert: high_memory
# 当内存占有率超过10%,持续1min,则触发告警
expr: 100 - ((node_memory_MemAvailable_bytes{
instance="192.168.10.64:9100",job="node_exporter"} * 100) / node_memory_MemTotal_bytes{
instance="192.168.10.64:9100",job="node_exporter"}) > 90
for: 1m
labels:
severity: page
annotations:
summary: spike memeory
alertmanager配置
- alertmanager/alertmanager.yml
如何配置腾讯企业邮箱的密码,我的这篇文章有记录- Jenkins发送email至腾讯企业邮箱 Pipeline方式
global:
# smtp服务器地址
smtp_smarthost: smtp.exmail.qq.com:465
# 发送者邮箱
smtp_from: <your_email>
# 发送者邮箱
smtp_auth_username: <your_email>
# 发送者密码
smtp_auth_password: <your_password>
smtp_require_tls: false
route:
group_by: ['alertname']
group_wait: 30s
group_interval: 5m
repeat_interval: 1h
receiver: 'mail'
receivers:
- name: 'mail'
email_configs:
# 接收者邮箱
- to: '<your_email>'
inhibit_rules:
- source_match:
severity: 'critical'
target_match:
severity: 'warning'
equal: ['alertname', 'dev', 'instance']
边栏推荐
- Summary of force deduction solution 944- deletion of sequence
- Force deduction solution summary 1022- sum of binary numbers from root to leaf
- Oracle 11g graphic download installation tutorial (step by step)
- No writing, please forgive me
- 力扣解法汇总497-非重叠矩形中的随机点
- 力扣解法汇总965-单值二叉树
- Xiaopi can't start the MySQL database. Please find out!
- 小红的删数字
- Force deduction solution summary 713- subarray with product less than k
- 2022最全面的Redis事务控制(带图讲解)
猜你喜欢

Master of a famous school has been working hard for 5 years. AI has no paper. How can the tutor free range?

Basedexclassloader

Implementation scheme of iteration and combination pattern for general tree structure

ACL 2022 - strong combination of pre training language model and graphic model

Graphic data analysis | data cleaning and pretreatment

Summary of concrete (ground + wall) + Mountain crack data set (classification and target detection)

(9) Serial port interrupt

2022最全面的Redis事务控制(带图讲解)

程序员应该如何解决买菜难问题?手把手带你利用无障碍辅助功能快速下单抢菜

maya前臺渲染插件mel脚本工具
随机推荐
Force deduction solution summary 953 verification of alien language dictionary
力扣解法汇总933-最近的请求次数
el-upload上传文件
Force deduction solution summary 1037- effective boomerang
Graphical data analysis | data analysis tool map
Graphic data analysis | data cleaning and pretreatment
Force deduction solution summary 1728- cat and mouse II
maya前台渲染插件mel脚本工具
Force deduction solution summary 450- delete nodes in the binary search tree
力扣解法汇总-04.06. 后继者
SwiftyJSON解析本地JSON文件
力扣解法汇总497-非重叠矩形中的随机点
Force deduction solution summary 433- minimum gene change
力扣解法汇总1728-猫和老鼠 II
Force deduction solution summary 462- minimum number of moves to make array elements equal II
Apply concentrated load to nodes in batch in ABAQUS
力扣解法汇总713- 乘积小于 K 的子数组
Swiftyjson parsing local JSON files
超图倾斜数据合并根节点后转3dtiles
Add sequence number column to MySQL query result set