SkyWalking触发告警发送邮箱
以下是默认的告警规则配置,位于skywalking安装目录下的config文件夹下 alarm-settings.yml文件 中:
rules:# Rule unique name, must be ended with `_rule`.service_resp_time_rule:metrics-name: service_resp_timeop: ">"threshold: 1000period: 10count: 3silence-period: 5message: Response time of service {name} is more than 1000ms in 3 minutes of last 10 minutes.service_sla_rule:# Metrics value need to be long, double or intmetrics-name: service_slaop: "<"threshold: 8000# The length of time to evaluate the metricsperiod: 10# How many times after the metrics match the condition, will trigger alarmcount: 2# How many times of checks, the alarm keeps silence after alarm triggered, default as same as period.silence-period: 3message: Successful rate of service {name} is lower than 80% in 2 minutes of last 10 minutesservice_p90_sla_rule:# Metrics value need to be long, double or intmetrics-name: service_p90op: ">"threshold: 1000period: 10count: 3silence-period: 5message: 90% response time of service {name} is more than 1000ms in 3 minutes of last 10 minutesservice_instance_resp_time_rule:metrics-name: service_instance_resp_timeop: ">"threshold: 1000period: 10count: 2silence-period: 5message: Response time of service instance {name} is more than 1000ms in 2 minutes of last 10 minutes
# Active endpoint related metrics alarm will cost more memory than service and service instance metrics alarm.
# Because the number of endpoint is much more than service and instance.
#
# endpoint_avg_rule:
# metrics-name: endpoint_avg
# op: ">"
# threshold: 1000
# period: 10
# count: 2
# silence-period: 5
# message: Response time of endpoint {name} is more than 1000ms in 2 minutes of last 10 minuteswebhooks:
# - http://127.0.0.1/notify/
# - http://127.0.0.1/go-wechat/
编写一个自己的程序接收SkyWalking中的告警信息,SkyWalking触发告警后立马会通过web钩子发送到自己的程序中。
第一步:创建SpringBoot工程
此步骤就忽略了,不详细讲解
第二步:导入SpringBoot-邮箱的jar包
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-mail</artifactId>
</dependency>
第三步:配置yml(application.yml)
host: 为邮箱的地址,我当前使用的是网易邮箱 ,username是邮箱账号 password是邮箱的授权码,而不是邮箱的登录密码,我当前是网易邮箱,需要用此账号登录网易邮箱进行申请。
第四步:创建接受告警信息的实体类
@Data
public class AlarmMessage {private int scopeId; //告警标识private String scope; //类型private String name; //告警的触发详情private String id0; //告警服务与告警消息的加密文private String id1; //请求的告警消息的加密文private String ruleName;private String alarmMessage; //告警信息private long startTime; //告警的生产时间
}
第五步:创建controller控制台接受告警
@RestController
@RequestMapping("/webhook")
@Slf4j
public class WebHooks {@Autowiredprivate WebHooksService webHooksService;@PostMapping("/email")public void email(@RequestBody List<AlarmMessage> alarmMessageList){try {if (SystemUtils.isNotEmpty(alarmMessageList)){webHooksService.sendEmail(alarmMessageList);}}catch (Exception e){e.printStackTrace();log.error("邮箱发送失败~~~~");}}}
当Skywalking触发告警,就会将告警往这个(/webhook/email)中的进行发送,采用List集合是因为在同一个时间段内会有多个告警同时到来,告警的消息全部在List中怎么做处理根据你们的需求进行编写,我这边是接收到告警后进行发送邮箱。。。
第六步:配置SkyWalking网络钩子
打开skywalking安装目录下的config文件夹下 alarm-settings.yml文件,找到webhooks这个配置项,进行修改
webhooks:- http://xxx.x.x.x/webhook/email
配置刚刚创建的项目路径以及接收告警的控制层,启动skyWalking,当skyWalking触发告警就会立马接收到。。。。。
SkyWalking触发告警发送邮箱相关推荐
- skywalking 之 告警篇
SkyWalking链路追踪系统-告警篇 原创 仙人技术2021-05-20 23:43:36�0�8著作权 http://cache.baiducontent.com/c?m=5kO2w0jwn2x ...
- 【云原生 | Kubernetes 系列】---AlertManager安装及告警发送
AlertManager安装及告警发送 Prometheus触发一条告警的过程 prometheus-> 触发阈值->超出持续时间->AlertManager->分组|抑制|静 ...
- 带你了解zabbix整合ELK收集系统异常日志触发告警~
今天来了解一下关于ELK的"L"-Logstash,没错,就是这个神奇小组件,我们都知道,它是ELK不可缺少的组件,完成了输入(input),过滤(fileter),output( ...
- JAVA定时任务-发送邮箱提醒-王大师王文峰开发(已上线完成)】
本人详解 作者:王文峰,参加过 CSDN 2020年度博客之星,<Java王大师王天师>作者 公众号:山峯草堂,非技术多篇文章,专注于天道酬勤的 Java 开发问题.中国国学.传统文化和代 ...
- c#web窗体登录界面登录注册以及密码找回发送邮箱功能
c#web窗体登录界面登录注册以及密码找回发送邮箱功能 效果图如下: 1.登录界面aspx代码 <%@ Page Language="C#" AutoEventWireup= ...
- django项目部署服务器后无法发送邮箱 错误信息:Connection unexpectedly closed
使用配置: python 3.7 + django 2.2.1 发送邮件模块 : from django.core.mail import send_mail 服务器:Centos7 阿里云轻 ...
- spring boot 实现发送邮箱验证码
首先设置一下发件人邮箱,以QQ邮箱为例: 找到帐户,开启POP3/SMTP服务 然后会提醒你怎么去实现,验证完后,会给你一个授权码,记住这个授权码,后端spring boot 会用到 下面回到IDEA ...
- Java发送邮箱验证码、session校验功能
本篇主要描述"发送邮箱验证码.session校验"相关前(htmljs)后(java)台代码,业务逻辑示例,闲话少诉,直接上代码. 1.引入的jar包是mail-1.4.jar 2 ...
- iPhone测试软件偷开照相机,iphone小软件让小偷现形 自动拍下照片发送邮箱
iphone小软件让小偷现形 自动拍下照片发送邮箱 iPhone手机能防盗,还能抓小偷,你听说过吗? 前几天,网友"l6shaoxt"在网上曝光了好几张照片,说这就是偷了自己手机的 ...
最新文章
- 基于用户投票的排名算法(四):牛顿冷却定律
- spring boot 核心_SpringBoot 核心技术 — 自动配置
- MySQL 多实例给root用户创建密码
- 真香!2020最新版《神经网络与深度学习》中文版更新完毕,PDF免费开放下载~...
- rooibos茶中单宁酸研究
- 和catch的区别_BIO、NIO、AIO 的区别是什么?
- 插件 脚本 线程 进程
- markdown的基础语言
- verilog实现多周期处理器之——目录及总述
- Ubuntu 16.04安装Docker
- 死链接检测 java,【死链接检测】工具查询方法及死链接处理方法
- 关于打印机状态的获取
- AndroidStudio安装之后虚拟机启动失败解决方法
- uni-app云打包成ipa文件安装到iPhone上全过程记录
- Photoshop 抠图(基础篇)
- 通过添加css样式cursor属性,改变鼠标的外形,变成放大镜
- uniapp 简单表单布局1
- CorelDraw插件开发-文字功能-文本分列-创建文本-函数分析-Cdr插件开发教程(二)
- 修改电脑配置的方法(被骗之后才学会的)
- 人在世、多交人,为人处事要留神
热门文章
- 【C语言】案例二十九 综合案例——体育成绩管理系统
- PyTorch 和 TensorFlow的区别
- 网格环境配置(三):安装SGE
- 百数谐韵咏物千字文全文释义
- C#实现PDF转PNG图片
- 问题解决:VScode在使用中文输入法时出现vim insert模式变成vim normal的奇怪现象( jj 映射成esc)
- Chromium硬件加速渲染的OpenGL命令执行过程分析
- request_threaded_irq
- linux non-iso extended-ascii,Linux 下文件Non-ISO extended-ASCII编码问题
- 将笔记本打造成遥控器――远程桌面控制台式机