PrometheusAlert icon indicating copy to clipboard operation
PrometheusAlert copied to clipboard

能不能在发送alert的时候记录到mysql里

Open linux-xiayun opened this issue 6 years ago • 12 comments

hello,由于对golang不是很熟悉,现在有个想法是把报警记录更新到数据库中,便于调用查询,能提供下prometheus对应的数据库操作么

linux-xiayun avatar Jan 22 '20 05:01 linux-xiayun

其实你完全可以直接查询Prometheus的数据就行了,Prometheus本身也是时序型的数据库,如果需要展示的话,结合grafana效果更好

---原始邮件--- 发件人: "xiayun"<[email protected]> 发送时间: 2020年1月22日(周三) 中午1:38 收件人: "feiyu563/PrometheusAlert"<[email protected]>; 抄送: "Subscribed"<[email protected]>; 主题: [feiyu563/PrometheusAlert] 能不能在发送alert的时候记录到mysql里 (#8)

hello,由于对golang不是很熟悉,现在有个想法是把报警记录更新到数据库中,便于调用查询,能提供下prometheus对应的数据库操作么

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

feiyu563 avatar Jan 22 '20 06:01 feiyu563

感谢回复,本来想记录报警历史,现在业务场景根据您提供的方式直接查询当前alert数据,谢谢------------------ 原始邮件 ------------------ 发件人: "feiyu563"[email protected] 发送时间: 2020年1月22日(星期三) 下午2:11 收件人: "feiyu563/PrometheusAlert"[email protected]; 抄送: "xiayun"[email protected];"Author"[email protected]; 主题: Re: [feiyu563/PrometheusAlert] 能不能在发送alert的时候记录到mysql里 (#8)

其实你完全可以直接查询Prometheus的数据就行了,Prometheus本身也是时序型的数据库,如果需要展示的话,结合grafana效果更好

---原始邮件--- 发件人: "xiayun"<[email protected]> 发送时间: 2020年1月22日(周三) 中午1:38 收件人: "feiyu563/PrometheusAlert"<[email protected]>; 抄送: "Subscribed"<[email protected]>; 主题: [feiyu563/PrometheusAlert] 能不能在发送alert的时候记录到mysql里 (#8)

hello,由于对golang不是很熟悉,现在有个想法是把报警记录更新到数据库中,便于调用查询,能提供下prometheus对应的数据库操作么

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

linux-xiayun avatar Jan 22 '20 06:01 linux-xiayun

Hi , 您这个项目作用是连接多监控系统,比如zabbix/grafana/prometheus,如果有把告警信息做持久化,感觉会更好。因为做了持久化后,可以做后续的分析以及优化甚至可以根据告警内容作出系统自我修复的功能。 如果像您之前回复的去prometheus内部查询,这样就等于绑定了监控工具,这跟你初衷应该相悖吧。

期待您的回复。

JayWu890225 avatar Feb 10 '20 11:02 JayWu890225

我先备注下,确实是个比较好的建议,原本我是打算做个无状态的应用,因为大部分告警系统本身已经有告警统计的功能

---原始邮件--- 发件人: "JayWu890225"<[email protected]> 发送时间: 2020年2月10日(周一) 晚上7:05 收件人: "feiyu563/PrometheusAlert"<[email protected]>; 抄送: "Comment"<[email protected]>;"feiyu563"<[email protected]>; 主题: Re: [feiyu563/PrometheusAlert] 能不能在发送alert的时候记录到mysql里 (#8)

Hi , 您这个项目作用是连接多监控系统,比如zabbix/grafana/prometheus,如果有把告警信息做持久化,感觉会更好。因为做了持久化后,可以做后续的分析以及优化甚至可以根据告警内容作出系统自我修复的功能。 如果像您之前回复的去prometheus内部查询,这样就等于绑定了监控工具,这跟你初衷应该相悖吧。

期待您的回复。

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

feiyu563 avatar Feb 10 '20 15:02 feiyu563

不知道大佬能不能支持下发送飞书的接口。 @feiyu563

bogeit avatar Mar 10 '20 05:03 bogeit

可以,我抽空调研下,先加入到下一版本开发计划

---原始邮件--- 发件人: "bogeit"<[email protected]> 发送时间: 2020年3月10日(周二) 中午1:34 收件人: "feiyu563/PrometheusAlert"<[email protected]>; 抄送: "Mention"<[email protected]>;"feiyu563"<[email protected]>; 主题: Re: [feiyu563/PrometheusAlert] 能不能在发送alert的时候记录到mysql里 (#8)

不知道大佬能不能支持下发送飞书的接口。 @feiyu563

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

feiyu563 avatar Mar 10 '20 05:03 feiyu563

谢谢大佬。 @feiyu563

bogeit avatar Mar 18 '20 03:03 bogeit

Hi , 您这个项目作用是连接多监控系统,比如zabbix/grafana/prometheus,如果有把告警信息做持久化,感觉会更好。因为做了持久化后,可以做后续的分析以及优化甚至可以根据告警内容作出系统自我修复的功能。 如果像您之前回复的去prometheus内部查询,这样就等于绑定了监控工具,这跟你初衷应该相悖吧。

期待您的回复。

@JayWu890225 @linux-xiayun @feiyu563

我个人认为不应该加到mysql中做持久化,因为这个工具本身作为webhook调用的方式,理应做的轻量,减少耦合。

个人认为最好的一种方式是把他按照业界规,设计成类似exporter的采集源,供prometheus或者其他监控采集,最后存储在时序数据库里,不知道是不是合理。

如果不合理也不是很建议增加Mysql,会增加部署成本; 如果一定要增加需要做成可配置的,可以选择是否要落库。

minibear2333 avatar Apr 03 '20 07:04 minibear2333

@pzqu 目前的计划也是在下一版本中集成metrics,尽可能的做到无状态化

feiyu563 avatar Apr 03 '20 10:04 feiyu563

@bogeit 飞书现已经支持

feiyu563 avatar Apr 26 '20 03:04 feiyu563

收到,我会尽快完成测试,到时来反馈结果,谢谢大佬的更新。 @feiyu563

bogeit avatar Apr 26 '20 14:04 bogeit

目前已经初步集成了Prometheus的metrics来导出一些指标,目前还在测试阶段,部分信息可能还不是特别全面,欢迎使用最新的版本测试。

feiyu563 avatar Apr 30 '20 01:04 feiyu563