当前位置:网站首页>prometheus告警流程及相关时间参数说明
prometheus告警流程及相关时间参数说明
2022-06-27 09:06:00 【upupfeng】
说明
用prometheus做监控,从告警事件发生到我们收到告警信息中间经历了很多流程,了解其中的流程及相关的时间配置,就能更及时、高效的获取告警信息。
以下记录下prometheus告警生命周期/流程、相关配置参数和告警案例说明。
prometheus告警生命周期/流程
- prometheus定时采集指标数据
- prometheus定时计算是否指标触发规则
- 触发规则的指标告警状态转为pending,当持续时间超过for指定的时间后,转换为firing,并将告警发送到alertmanager
- alertmanager收到告警后,等待一段分组时间,到时间后发送告警;如果该分组又持续收到了告警,会等待一个分组告警间隔时间后,再次为该分组发送告警
- 如果该告警一直存在,alertmanager会按照重发间隔来重复发送告警
下面这张图是整个prometheus的流程全景图,能清晰的了解prometheus的告警运转流程。
时间相关参数
| 参数名称 | 说明 | 默认值 | 参数所属 |
|---|---|---|---|
| scrape_interval | 指标数据采集间隔 | 1分钟 | prometheus.yml |
| evaluation_interval | 规则的计算间隔 | 1分钟 | prometheus.yml |
| for: 时间 | 异常持续多长时间发送告警 | 0 | 规则配置 |
| group_wait | 分组等待时间。同一分组内收到第一个告警等待多久开始发送,目的是为了同组消息同时发送 | 30秒 | alertmanager.yml |
| group_interval | 上下两组发送告警的间隔时间。第一次告警发出后等待group_interval时间,开始为该组触发新告警 | 5分钟 | alertmanager.yml |
| repeat_interval | 重发间隔。告警已经发送,且无新增告警,再次发送告警需要的间隔时间 | 4小时 | alertmanager.yml |
案例
监控Kafka节点是否down掉。
配置
指标名:kakfa_up_status
1存活 0挂掉了
# prometheus.yml配置
global:
scrape_interval: 20s
evaluation_interval: 30s
# 规则配置
- alert: kakfa_down
expr: kakfa_up_status == 0
for: 1m
annotations:
summary: "Kafka挂掉了"
# alertmanager配置
route:
group_by: [alertname]
group_wait: 60s
group_interval: 5m
repeat_interval: 10m
事件流程
10:00:05 Kafka挂掉了
10:00:20 拉取指标kakfa_up_status=0
10:00:30 计算规则,发现Kafka挂掉了,将kakfa_down设置为pending
10:00:30~10:01:30 持续拉取指标、计算规则
10:01:30 kafka_down持续时间达到了1分钟,设置为firing,发送到alertmanager
10:01:30 alertmanager收到后,等待分组等待时间
10:02:30 分组等待时间完成,发出告警
10:12:30 告警还没有解决,重复发出告警
参考
prometheus 告警机制 -(为什么告警发的不及时) https://blog.csdn.net/luo4105/article/details/123700003
多久可以收到prometheus的告警? https://www.jianshu.com/p/b3b4e68409e0
prometheus告警group_wait&repeat_interval https://blog.csdn.net/tryyourbest0928/article/details/115337984
边栏推荐
- March into machine learning -- Preface
- Getting started with webrtc: 12 Rtendpoint and webrtcendpoint under kurento
- 多网络设备存在时,如何配置其上网优先级?
- Persistence mechanism of redis
- Design of multiple classes
- 有关二叉树的一些练习题
- [cloud native] 2.3 kubernetes core practice (Part 1)
- 三道基础面试题总结
- Fake constructor???
- Quelques exercices sur les arbres binaires
猜你喜欢

粗读DS-TransUNet: Dual Swin Transformer U-Net for Medical Image Segmentation

win10为任意文件添加右键菜单

我大抵是卷上瘾了,横竖睡不着!竟让一个Bug,搞我两次!

ucore lab5

【生动理解】深度学习中常用的各项评价指标含义TP、FP、TN、FN、IoU、Accuracy

VIM from dislike to dependence (20) -- global command

I'm almost addicted to it. I can't sleep! Let a bug fuck me twice!

Flow chart of Alipay wechat payment business

This, constructor, static, and inter call must be understood!

0号进程,1号进程,2号进程
随机推荐
The background prompt module for accessing fastadmin after installation does not exist
JVM common garbage collector
【云原生】2.3 Kubernetes 核心实战(上)
Parameters argc and argv of main()
Digital ic-1.9 understands the coding routine of state machine in communication protocol
数据类型占内存大小?LongVsObject
main()的参数argc与argv
Understand neural network structure and optimization methods
2022.06.26(LC_6100_统计放置房子的方式数)
并发编程JUC的AQS底层源码
Advanced mathematics Chapter 7 differential equations
2022.6.26-----leetcode. seven hundred and ten
Improving efficiency or increasing costs, how should developers understand pair programming?
Matlab tips (19) matrix analysis -- principal component analysis
One week's experience of using Obsidian (configuration, theme and plug-in)
Enumeration? Constructor? Interview demo
DataV轮播表组件dv-scroll-board宽度问题
JS EventListener
How much do you know about the cause of amplifier distortion?
This, constructor, static, and inter call must be understood!