实现skywalking 实现钉钉告警
告警指标
官网告警规则示例
https://github.com/apache/skywalking/blob/master/docs/en/setup/backend/backend-alarm.md
告警指标示例
service_resp_time #服务的响应时间
service_sla #服务的http请求成功率SLA,比如99%等。
service_cpm #表示每分钟的吞吐量.
service_apdex : #应用性能指数是0.8是0.x
service_percentile: #指定最近多少数据范围内的响应时间百分比,即p99, p95, p90, p75, p50在内的数据统计结果
endpoint_relation_cpm #端点的每分钟的吞吐量
endpoint_relation_resp_time #端点的响应时间
endpoint_relation_sla #端点的http请求成功率SLA,比如99%等。
endpoint_relation_percentile #端点的最近多少数据范围内的响应时间百分比,即p99、p95、p90、p75、p50在内的数据统计结果
更多指标与规则:
skywalking本地查询语句配置文件路径
root@skywalking:/usr/local/apache-skywalking-apm-bin-es7# ll config/oal/core.oal
告警规则文件
root@skywalking:/usr/local/apache-skywalking-apm-bin-es7# ll config/alarm-settings.yml -rw-rw-r-- 1 1001 1002 3298 Jun 7 2021 config/alarm-settings.yml
规则示例
告警规则文件
root@skywalking:/usr/local/apache-skywalking-apm-bin-es7/config# cat alarm-settings.yml # Sample alarm rules. rules: # Rule unique name, must be ended with `_rule`. service_resp_time_rule: #规则名称,名称的结尾必须是_rule metrics-name: service_resp_time #指标名称,与config/oal/core.oal下的指标语句名称相匹配 op: ">" #操作符,>, >=, <, <=, == threshold: 1000 #指标阈值 period: 10 #评估指标的间隔周期,单位分钟。 count: 3 #匹配成功多少次就会触发告警 silence-period: 5 #触发告警后的静默(延迟)时间,建议时间不要设置太长,单位分钟。 message: Response time of service {name} is more than 1000ms in 3 minutes of last 10 minutes. #告警内容信息
配置告警
配置skywalking告警模版,设置为钉钉告警
定义每分钟的吞吐量大于1的话就会触发告警。
root@skywalking:/usr/local/apache-skywalking-apm-bin-es7/config# vim alarm-settings.yml rules: # Rule unique name, must be ended with `_rule`. service_resp_time_rule: metrics-name: service_cpm op: ">" threshold: 5 period: 1 count: 1 silence-period: 1 message: Response time of service {name} is more than 5ms in 1 minutes. dingtalkHooks: textTemplate: |- { "msgtype": "text", "text": { "content": "Apache skywalking Alarm \n %s." } } webhooks: - url: https://oapi.dingtalk.com/robot/send?access_token=6755dc6d17a9a5b5597f60628d65e2c4d454be1325ea3bb68673ec50816 1a373
重启skywalking
配置钉钉机器人
验证:
验证skywalking server端触发告警
本文来自博客园,作者:PunchLinux,转载请注明原文链接:https://www.cnblogs.com/punchlinux/p/17198976.html
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 记一次.NET内存居高不下排查解决与启示