Grafana报警--通知渠道配置
2024-08-22 10:09:34
最近研究了prometheus+grafana的系统监控,使用grafana的报警功能,grafana支持很多种通知渠道,下文记录使用到的几种notification channels,分别是email,kafka和webhook
官网文档 http://docs.grafana.org/alerting/notifications/
- 发送邮件
修改smtp,找到%GRAFANA_HOME%/conf/defaults.ini(注windows环境)
[smtp]
enabled = true #开户email发送配置
host = smtp.xxx.com:25 #此处需要加上端口号
user =username@xxx.com #邮箱账号
# If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;"""
password =1234567890 #邮箱密码
cert_file =
key_file =
skip_verify = true #跳过校验
from_address = admin@grafana.localhost
from_name = Grafana
ehlo_identity =
- kafka
向kafka发送消息,需要kafka REST proxy,我使用的中间件是confluent,安装过程没什么特别之外,配置(confluent_home/etc/kafka-rest/kafka-rest.properties)如下
#id=kafka-rest-test-server
#schema.registry.url=http://localhost:8081
#zookeeper.connect=localhost:2181
#bootstrap.servers=PLAINTEXT://localhost:9092
zookeeper.connect=xx.xx.xx.xx:2181
bootstrap.servers=PLAINTEXT://xx.xx.xx.xx:9092
启用kafka-rest服务
bin/kafka-rest-start ../etc/kafka-rest/kafka-rest.properties
添加notification channels
点击 “send test”按钮,浏览kafka-rest服务,alert-gateway-test-1已经在kafka topic里了,开发者可消费kafka的消息,进行后续(自定义)处理
- webhook(推荐)
回调参数
{
"title": "My alert",
"ruleId": 1,
"ruleName": "Load peaking!",
"ruleUrl": "http://url.to.grafana/db/dashboard/my_dashboard?panelId=2",
"state": "alerting",
"imageUrl": "http://s3.image.url",
"message": "Load is peaking. Make sure the traffic is real and spin up more webfronts",
"evalMatches": [
{
"metric": "requests",
"tags": {},
"value": 122
}
]
}
更详细说明,可以参考官网http://docs.grafana.org/alerting/notifications/
最新文章
- java中与数据库的连接
- 在Win2008上运行ASP.NET 1.1程序
- 部署应用程序QQ
- [Practical Git] Switching between current branch and last checkout branch
- IOS分类(Category)
- xss框架(二)基础框架实现
- Day4:T1小技巧(类似于指针操作)T2搜索+小细节
- 查看Tomcat版本
- Laravel 5 框架性能优化技巧
- c语言基础学习03
- thinphp验证码的简单实现
- Git常用简介
- 【BZOJ5499】[2019省队联测]春节十二响(贪心)
- webpack学习记录 - 学习webpack-dev-server(三)
- 【转】SpringBoot——web项目下读取classpath下的文件心得
- 1、Shiro 安全框架与Spring 整合详解
- 一个简单的通讯服务框架(大家发表意见一起研究)JAVA版本
- css初探
- IntellJ IDEA 对于 Spring Boot2.0.2 配置文件application.properties 配置
- 距离LCA离线算法Tarjan + dfs + 并查集
热门文章
- layer.open弹出窗口后在子页面修改弹窗的title
- 解决spyder、Jupyter Notebook 打不开
- 单例模式实例&;多线程应用
- Spring3基础原理解析
- listener.starting()源码探究
- python with as的用法
- LeetCode【101. 对称二叉树】
- linux centos 中访问linux 共享文件方法
- Linq to SQL -- Union All、Union、Intersect和Top、Bottom和Paging和SqlMethods
- Hexo NexT主题/cnblog等博客增加点击出现红心的特效