Blog translation (#1586)

Signed-off-by: tomsun28 <tomsun28@outlook.com>
Co-authored-by: tomsun28 <tomsun28@outlook.com>
Co-authored-by: cuipiheqiuqiu <76642201+cuipiheqiuqiu@users.noreply.github.com>
Co-authored-by: Logic <zqr10159@dromara.org>
This commit is contained in:
淞筱
2024-02-29 11:32:28 +08:00
committed by GitHub
co-authored by tomsun28 cuipiheqiuqiu Logic
parent e4aef6ea3a
commit 49d4a03055
4 changed files with 156 additions and 157 deletions
@@ -72,7 +72,7 @@ public class CommonProperties {
public static class DataQueueProperties {
private QueueType type = QueueType.Memory;
private KafkaProperties kafka;
public QueueType getType() {
+34 -34
View File
@@ -1,5 +1,5 @@
---
title: SSL证书过期监控最佳实践
title: Best Practices for SSL Certificate Expiration Monitoring
author: tom
author_title: tom
author_url: https://github.com/tomsun28
@@ -7,50 +7,50 @@ author_image_url: https://avatars.githubusercontent.com/u/24788200?s=400&v=4
tags: [opensource, practice]
---
先祝看到的同学中秋快乐,身体健康,在身体健康的基础上尽量暴富。
First of all, I would like to wish all the students who see it a happy mid-autumn festival, good health, and try to get rich on the basis of good health.
进入正题,现在大部分网站都默认支持 HTTPS,我们申请的证书一般是3个月或者1年,很容易随着时间的流逝SSL证书过期了我们却没有第一时间发现,或者在过期之前没有及时更新证书。
Into the main topic, most of the sites now support HTTPS by default, we apply for the certificate is generally 3 months or 1 year, it is easy with the passage of time SSL certificate expired we did not find the first time, or in the expiration of the certificate did not update the certificate in a timely manner.
今天这篇文章介绍如果使用 hertzbeat 监控系统来检测我们网站的SSL证书有效期,当证书过期时或证书快过期前几天,给我们发告警消息。
Today's article describes how to use hertzbeat monitoring system to detect the validity of our website's SSL certificate, when the certificate expires or a few days before the expiration of the certificate, send us an alert message.
#### HertzBeat是什么
#### What is HertzBeat?
HertzBeat 一个拥有强大自定义监控能力,无需Agent的实时监控工具。网站监测,PING连通性,端口可用性,数据库,操作系统,中间件,API监控,阈值告警,告警通知(邮件微信钉钉飞书)。
HertzBeat is a real-time monitoring tool with powerful customizable monitoring capabilities without the need for an agent. Website monitoring, PING connectivity, port availability, database, OS, middleware, API monitoring, threshold alerts, alert notifications (email wechat pinning flybook).
**官网: https://hertzbeat.com | https://tancloud.cn**
**Official website: https://hertzbeat.com | https://tancloud.cn**
github: https://github.com/dromara/hertzbeat
gitee: https://gitee.com/dromara/hertzbeat
#### 安装 HertzBeat
#### Install HertzBeat
1.如果不想安装可以直接使用云服务 [TanCloud探云 console.tancloud.cn](https://console.tancloud.cn)
1. If you don't want to install it, you can directly use the cloud service [TanCloud console.tancloud.cn](https://console.tancloud.cn)
2. `docker` 环境仅需一条命令即可安装
2. The `docker` environment can be installed with a single command
`docker run -d -p 1157:1157 --name hertzbeat tancloud/hertzbeat`
3. 安装成功浏览器访问 `localhost:1157` 即可开始,默认账号密码 `admin/hertzbeat`
3. Installation success browser visit `localhost:1157` to start, the default account password `admin/hertzbeat
#### 监控SSL证书
#### Monitoring SSL Certificates
1. 点击新增SSL证书监控
1. Click Add SSL Certificate Monitor
> 系统页面 -> 监控菜单 -> SSL证书 -> 新增SSL证书
> System Page -> Monitor Menu -> SSL Certificates -> New SSL Certificate
![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/bd53f343a5b54feab62e71458d076441~tplv-k3u1fbpfcp-zoom-1.image)
2. 配置监控网站
2. Configure monitoring website
> 我们这里举例监控百度网站, 配置监控host域名,名称,采集间隔等。
> 点击确定 注意⚠️新增前默认会先去测试网站连接性,连接成功才会新增,当然也可以把**是否测试**按钮置灰。
> Here is an example to monitor Baidu website, configure the host domain name, name, collection interval, etc. > Click OK.
> Click OK. Note that ⚠️ will test the connectivity of the website before adding it by default, and it will add it only if the connection is successful, of course, you can also gray out the **Whether to test** button.
![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/ad1154670648413bb82c8bdeb5b13609~tplv-k3u1fbpfcp-zoom-1.image)
3. 查看检测指标数据
3. Viewing Test Indicator Data
> 在监控列表可以查看任务状态,进监控详情可以查看指标数据图表等。
> You can view the task status in the monitor list, and go into the monitor details to view the metrics data graphs etc.
![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/f874b45e909c4bb0acdd28b3fb034a61~tplv-k3u1fbpfcp-zoom-1.image)
@@ -60,19 +60,19 @@ gitee: https://gitee.com/dromara/hertzbeat
4. 设置阈值(证书过期时触发)
4. Set the threshold (triggered when the certificate expires)
> 系统页面 -> 告警 -> 告警阈值 -> 新增阈值
> System Page -> Alarms -> Alarm Thresholds -> Add Thresholds
![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/8d6205172d43463aa34e534477f132f1~tplv-k3u1fbpfcp-zoom-1.image)
> 配置阈值,选择SSL证书指标对象,配置告警表达式-当指标`expired``true`触发,即`equals(expired,"true")` , 设置告警级别通知模版信息等。
> Configure thresholds, select SSL certificate indicator object, configure alert expression - triggered when indicator `expired` is `true`, i.e. `equals(expired, "true")` , set alert level notification template message etc.
![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/83d17b381d994f26a6240e01915b2001~tplv-k3u1fbpfcp-zoom-1.image)
> 关联阈值与监控, 在阈值列表设置此阈值应用于哪些监控。
> Associate thresholds with monitors, set which monitors this threshold should be applied to in the threshold list.
![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/9b9063d7bcf9454387be0491fc382bd1~tplv-k3u1fbpfcp-zoom-1.image)
@@ -80,44 +80,44 @@ gitee: https://gitee.com/dromara/hertzbeat
5. 设置阈值(证书过期前一周触发)
5. set the threshold (triggered one week before certificate expiration)
> 同理如上,新增配置阈值,配置告警表达式-当指标有效期时间戳 `end_timestamp``now()`函数为当前时间戳,若配置提前一周触发告警即:`end_timestamp <= (now() + 604800000)` , 其中 `604800000` 为7天总时间差毫秒值。
> Same as above, add a new configuration threshold, configure the alert expression - when the indicator validity timestamp `end_timestamp`, `now()` function for the current timestamp, if you configure to trigger the alert one week in advance i.e.: `end_timestamp <= (now() + 604800000)` , where `604800000` is the total time difference of 7 days. milliseconds.
![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/0d6f837f57c247e09f668f60eff4a0ff~tplv-k3u1fbpfcp-zoom-1.image)
> 最终可以在告警中心看到已触发的告警。
> Eventually you can see the triggered alarms in the alarm center.
![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/5a61b23127524976b2c209ce0ca6a339~tplv-k3u1fbpfcp-zoom-1.image)
6. 告警通知(通过钉钉微信飞书等及时通知)
6. Alarm notification (timely notification via NailWeChatFlysheet, etc.)
> 监控系统 -> 告警通知 -> 新增接收人
> Monitoring System -> Alert Notification -> Add Recipients
![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/7f36956060ef410a82bbecafcbb2957f~tplv-k3u1fbpfcp-zoom-1.image)
钉钉微信飞书等token配置可以参考帮助文档
You can refer to the help file for the token configuration of Nail WeChat Flying Book, etc.
https://hertzbeat.com/docs/help/alert_dingtalk
https://tancloud.cn/docs/help/alert_dingtalk
> 告警通知 -> 新增告警通知策略 -> 将刚才配置的接收人启用通知
> Alert Notification -> Add new alert notification policy -> Enable notification for the recipients you just configured
![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/d976343e81f843138344a039f3aff8a3~tplv-k3u1fbpfcp-zoom-1.image)
7. OK 当阈值触发后我们就可以收到对应告警消息啦,如果没有配通知,也可以在告警中心查看告警信息。
7. OK When the threshold is triggered, we can receive the corresponding alarm message, if there is no notification, you can also view the alarm information in the alarm center.
----
#### 完!
#### End!
监控SSL证书的实践就到这里,当然对hertzbeat来说这个功能只是冰山一角,如果您觉得hertzbeat这个开源项目不错的话欢迎给我们在GitHub Gitee star哦,灰常感谢。感谢老铁们的支持。笔芯!
The practice of monitoring SSL certificates here, of course, for hertzbeat this function is just the tip of the iceberg, if you think hertzbeat this open source project is good if you welcome to give us in the GitHub Gitee star oh, thank you very much. Thank you for your support. The author!
**github: https://github.com/dromara/hertzbeat**
**gitee: https://gitee.com/dromara/hertzbeat**
**gitee: https://gitee.com/dromara/hertzbeat**
+33 -34
View File
@@ -1,5 +1,5 @@
---
title: HertzBeat v1.2.0 发布!易用友好的开源实时监控工具
title: HertzBeat v1.2.0 Released! Easy-to-use and friendly open source real-time monitoring tool
author: tom
author_title: tom
author_url: https://github.com/tomsun28
@@ -11,43 +11,43 @@ tags: [opensource]
Home: hertzbeat.com | tancloud.cn
Hi guys! HertzBeat v1.2.0 is coming. This version supports more powerful metrics collect jsonpath, upgrade springboot version to 2.7.4, support metrics unit convert display, and more. Fixed several bugs and improved the overall stable usability.
Hi guys! HertzBeat v1.2.0 is coming. This version supports more powerful metrics collect jsonpath, upgrade springboot version to 2.7.4, support This version supports more powerful metrics collect jsonpath, upgrade springboot version to 2.7.4, support metrics unit convert display, and more. Fixed several bugs and improved the overall stable usability.
Only one docker command is needed to install and experience heartbeat
Only one docker command is needed to install and experience heartbeat:
`docker run -d -p 1157:1157 --name hertzbeat tancloud/hertzbeat`
Thanks to the contributors! 👍👍 @Ceilzcx @Privauto @VampireAchao @DreamGirl524 @CharlieXCL @emrys-he @SxLiuYu @tomsun28
Thanks to the contributors! 👍👍 @Ceilzcx @Privauto @VampireAchao @DreamGirl524 @CharlieXCL @emrys-he @SxLiuYu @tomsun28
We urgently need contributors to test cases, new application monitoring, documentation, etc., and very welcome you to join. Come on! HertzBeat is so easy!
Feature
Features. 1. [[home,manager]]
1. [[home,manager]add practice learn doc and hertzbeat monitor yml #284](https://github.com/dromara/hertzbeat/pull/284)
2. [[webapp] auto redirect url when detect browser language #289](https://github.com/dromara/hertzbeat/pull/289) contribute by @DreamGirl524
3. [[home] update logo icon cdn url with fault tolerance #293](https://github.com/dromara/hertzbeat/pull/293) contribute by @VampireAchao
4. [[monitor] enable powerful jsonpath parser, add es metrics #295](https://github.com/dromara/hertzbeat/pull/295) contribute by @Ceilzcx
5. [[webapp] update ui theme #296](https://github.com/dromara/hertzbeat/pull/296)
6. [Feature change main pom artifactId #300](https://github.com/dromara/hertzbeat/pull/300) contribute by @Privauto
7. [[home,webapp] add users logo and update hertzbeat brand #302](https://github.com/dromara/hertzbeat/pull/302)
8. [[monitor] alerter notify test throw msg to front, optional spring.email config #305](https://github.com/dromara/hertzbeat/pull/305) contribute by @Ceilzcx
9. [[home]doc:update docker-deploy.md and tdengine-init.md #306](https://github.com/dromara/hertzbeat/pull/306) contribute by @Privauto
3. [[home] update logo icon cdn url with fault tolerance #293](https://github.com/dromara/hertzbeat/pull/293) contributed by @VampireAchao
4. [[monitor] enable powerful jsonpath parser, add es metrics #295](https://github.com/dromara/hertzbeat/pull/295) contributed by @Ceilzcx
5. [[webapp] update ui theme #296](https://github.com/dromara/hertzbeat/pull/296)
6. [Feature change main pom artifactId #300](https://github.com/dromara/hertzbeat/pull/300) contributed by @Privauto
7. [[home,webapp] add users logo and update hertzbeat brand #302](https://github.com/dromara/hertzbeat/pull/302)
8. [[monitor] alerter notify test throw msg to front, optional spring.email config #305](https://github.com/dromara/hertzbeat/pull/305) contributed by @Ceilzcx
9. [[home]doc:update docker-deploy.md and tdengine-init.md #306](https://github.com/dromara/hertzbeat/pull/306) contributed by @Privauto
10. [[hertzbeat] refactor common collect metrics data and alert data queue #320](https://github.com/dromara/hertzbeat/pull/320)
11. [[hertzbeat] upgrade springboot version 2.4.13 to 2.7.4 #316](https://github.com/dromara/hertzbeat/pull/316) contribute by @Privauto
11. [[hertzbeat] upgrade springboot version 2.4.13 to 2.7.4 #316](https://github.com/dromara/hertzbeat/pull/316) contributed by @Privauto
12. [[web-app] optimize the monitor detect feedback method #322](https://github.com/dromara/hertzbeat/pull/322)
13. [[github,webapp] add webapp ci action, fix eslint warning and upgrade codeql #323](https://github.com/dromara/hertzbeat/pull/323)
14. [[hertzbeat] add more unit test and test example #324](https://github.com/dromara/hertzbeat/pull/324)
15. [support metrics unit extract, convert and display #326](https://github.com/dromara/hertzbeat/pull/326) contribute by @Ceilzcx
15. [support metrics unit extract, convert and display #326](https://github.com/dromara/hertzbeat/pull/326) contributed by @Ceilzcx
16. [[common] optimize common aviator configuration #327](https://github.com/dromara/hertzbeat/pull/327)
Bugfix.
Bugfixes.
1. [[webapp,home] fix middle category icon and update home doc #283](https://github.com/dromara/hertzbeat/pull/283)
2. [[web-app] fix redirect when monitors app is null #286](https://github.com/dromara/hertzbeat/pull/286)
3. [[alerter] bugfix aviator expression match npe #297](https://github.com/dromara/hertzbeat/pull/297)
4. [[doc] fix project name error #294](https://github.com/dromara/hertzbeat/pull/294) contribute by @CharlieXCL
5. [[common]feature:use "apache.http.conn.util" replace "sun.net.util" for upgrading java version #299](https://github.com/dromara/hertzbeat/pull/299) contribute by @Privauto
6. [Update docker-deploy.md #304](https://github.com/dromara/hertzbeat/pull/304) contribute by @emrys-he
7. [fix(sec): upgrade snakeyaml to 1.31 #313](https://github.com/dromara/hertzbeat/pull/313) contribute by @SxLiuYu
4. [[doc] fix project name error #294](https://github.com/dromara/hertzbeat/pull/294) contributed by @CharlieXCL
5. [[common]feature:use "apache.http.conn.util" replace "sun.net.util" for upgrading java version #299](https://github.com/dromara/ hertzbeat/pull/299) contributed by @Privauto
6. [Update docker-deploy.md #304](https://github.com/dromara/hertzbeat/pull/304) contributed by @emrys-he
7. [fix(sec): upgrade snakeyaml to 1.31 #313](https://github.com/dromara/hertzbeat/pull/313) contributed by @SxLiuYu
8. [[script] add startup log and optimize port service judgment #321](https://github.com/dromara/hertzbeat/pull/321)
9. [[web-app] fix echarts y-axis value tip overflow #325](https://github.com/dromara/hertzbeat/pull/325)
10. [[webapp] fix interceptor http resp common error-msg when error #329](https://github.com/dromara/hertzbeat/pull/329)
@@ -55,25 +55,24 @@ Bugfix.
Have Fun!
### Upgrade⚠️
### Upgrade ⚠️
Need Convert `application.yml`
Need Convert `application.yml`.
```
spring:
resources:
static-locations:
spring.
resources: static-locations.
static-locations.
- classpath:/dist/
- classpath:../dist/
- classpath:... /dist/
```
To
```
spring:
web:
resources:
static-locations:
- classpath:/dist/
- classpath:../dist/
``
spring.
web.
resources: static-locations.
static-locations.
- classpath:/dist/
- classpath:... /dist/
```
----
----
+88 -88
View File
@@ -1,47 +1,47 @@
---
title: 使用 HertzBeat 对 API 网关 Apache ShenYu 的监控实践
author: tom
author_title: tom
author_url: https://github.com/tomsun28
author_image_url: https://avatars.githubusercontent.com/u/24788200?s=400&v=4
title: HertzBeat's Monitoring Practice for API Gateway Apache ShenYu
author: tom
author_title: tom
author_url: https://github.com/tomsun28
author_image_url: https://avatars.githubusercontent.com/u/24788200?s=400&v=4
tags: [opensource, practice]
---
## 使用 HertzBeat 对 API 网关 Apache ShenYu 进行监控实践,5分钟搞定!
### Monitoring practice for API gateway Apache ShenYu using HertzBeat, 5 minutes!
### Apache ShenYu 介绍
### Introduction to Apache ShenYu
> Apache ShenYu 一个异步的,高性能的,跨语言的,响应式的 API 网关。
> Apache ShenYu is an asynchronous, high-performance, cross-language, responsive API gateway.
- 代理:支持Apache DubboSpring CloudgRPCMotanSOFATARSWebSocketMQTT
- 安全性:签名,OAuth 2.0JSON Web令牌,WAF插件
- API治理:请求、响应、参数映射、HystrixRateLimiter插件
- 可观测性:跟踪、指标、日志记录插件
- 仪表板:动态流量控制,用户菜单权限的可视化后端
- 扩展:插件热插拔,动态加载
- 集群:NGINXDockerKubernetes
- 语言:提供.NETPythonGoJava客户端用于API注册
- Proxy: supports Apache Dubbo, Spring Cloud, gRPC, Motan, SOFA, TARS, WebSocket, MQTT.
- Security: Signature, OAuth 2.0, JSON Web Token, WAF Plugin
- API Governance: Request, Response, Parameter Mapping, Hystrix, RateLimiter Plugin
- Observability: tracing, metrics, logging plug-ins
- Dashboard: dynamic flow control, visual backend for user menu permissions
- Extension: plugin hot-plugging, dynamic loading
- Clustering: NGINX, Docker, Kubernetes
- Languages: .NET, Python, Go, Java clients available for API registration
### HertzBeat 介绍
### HertzBeat Introduction
> HertzBeat 是一款开源,易用友好的实时监控工具,无需Agent,拥有强大自定义监控能力。
> 支持对应用服务,数据库,操作系统,中间件,云原生等监控,阈值告警,告警通知(邮件微信钉钉飞书)。
> HertzBeat 的强大自定义,多类型支持,易扩展,低耦合,希望能帮助开发者和中小团队快速搭建自有监控系统。
> HertzBeat is an open source, easy to use and friendly real-time monitoring tool, no Agent, with powerful custom monitoring capabilities.
> Support for application services, database, operating system, middleware, cloud native monitoring, threshold alarms, alarm notification (email WeChat Nail Flybook).
> HertzBeat's powerful customization, multi-type support, easy to extend, low-coupling, hope to help developers and small and medium-sized teams to quickly build their own monitoring system.
### 在 HertzBeat 5分钟搞定监控 Apache ShenYu
### Monitor Apache ShenYu in HertzBeat in 5 minutes!
#### 操作前提,您已拥有 ShenYu 环境和 HertzBeat 环境。
#### You must have a ShenYu environment and a HertzBeat environment.
- ShenYu [部署安装文档](https://shenyu.apache.org/zh/docs/deployment/deployment-before)
- HertzBeat [部署安装文档](https://hertzbeat.com/docs/start/docker-deploy)
- ShenYu [Deployment and Installation Documentation](https://shenyu.apache.org/zh/docs/deployment/deployment-before)
- HertzBeat [Deployment and Installation Documentation](https://hertzbeat.com/docs/start/docker-deploy)
#### . 在 ShenYu 端开启`metrics`插件,它将提供 metrics 接口数据。
#### i. Enable the `metrics` plugin on the ShenYu side, which will provide the metrics interface data.
> 插件是 Apache ShenYu 网关的核心执行者,指标数据采集在 `ShenYu` 也是以插件的形式集成的 - `Metrics插件`。
> `Metrics插件`是网关用来监控自身运行状态(`JVM`相关),请求响应等相关指标进行监测。
> The plugin is the core implementer of the Apache ShenYu gateway, and metrics data collection is also integrated at `ShenYu` in the form of a plugin - `Metrics Plugin`.
> The `Metrics plugin` is used by the gateway to monitor its own operational status (`JVM` related), request responses and other related metrics.
1. 在网关的 `pom.xml` 文件中添加 `metrics插件` 的依赖。
1. Add the `metrics plugin` dependency to the `pom.xml` file of the gateway.
```xml
<dependency>
@@ -51,118 +51,118 @@ tags: [opensource, practice]
</dependency>
```
2. `metric`插件 采集默认是关闭的, 在网关的配置`yaml`文件中编辑如下内容:
2. `metric` plugin Capture is turned off by default, edit the following in the gateway's configuration `yaml` file:
```yaml
shenyu:
metrics:
enabled: true #设置为 true 表示开启
name : prometheus
host: 127.0.0.1 #暴露的ip
port: 8090 #暴露的端口
jmxConfig: #jmx配置
props:
jvm_enabled: true #开启jvm的监控指标
enabled: true #Set to true to enable
name: prometheus
host: 127.0.0.1 #exposed ip
port: 8090 #Exposed port
jmxConfig: #jmx configuration
props: #jvm_enabled: true
jvm_enabled: true #Enable monitoring metrics for jvm
```
3. 重启 ShenYu网关, 打开浏览器或者用curl 访问 `http://ip:8090`, 就能看到metric数据了。
3. Restart ShenYu Gateway, open a browser or use curl to access `http://ip:8090`, you can see the metric data.
#### 二. 在 HertzBeat 监控页面添加 ShenYu 监控
#### ii. Adding ShenYu Monitor in HertzBeat Monitor Page
1. 点击新增 ShenYu 监控
1. Click Add ShenYu Monitor
路径:菜单 -> 中间件监控 -> ShenYu监控 -> 新增ShenYu监控
Path: Menu -> Middleware Monitor -> ShenYu Monitor -> Add ShenYu Monitor
![hertzbeat](/img/blog/monitor-shenyu-1.png)
![hertzbeat](/img/blog/monitor-shenyu-1.png)
2. 配置监控 ShenYu 所需参数
2. Configure the parameters required for monitoring ShenYu
在监控页面填写 ShenYu **服务IP**,**监控端口**(默认8090),最后点击确定添加即可。
其他参数如**采集间隔**,**超时时间**等可以参考[帮助文档](https://hertzbeat.com/docs/help/shenyu/) https://hertzbeat.com/docs/help/shenyu/
On the monitor page, fill in ShenYu **service IP**, **monitor port** (default 8090), and click OK to add.
For other parameters such as **collection interval**, **timeout**, etc., you can refer to the [help file](https://hertzbeat.com/docs/help/shenyu/) https://hertzbeat.com/docs/help/shenyu/
![hertzbeat](/img/blog/monitor-shenyu-1.png)
![hertzbeat](/img/blog/monitor-shenyu-1.png)
3. 完成✅,现在我们已经添加好对 ShenYu 的监控了,查看监控列表即可看到我们的添加项。
3. Done ✅, now we have added monitoring for ShenYu, check the monitor list to see our additions.
![hertzbeat](/img/blog/monitor-shenyu-3.png)
![hertzbeat](/img/blog/monitor-shenyu-3.png)
4. 点击监控列表项的**操作**->**监控详情图标** 即可浏览 ShenYu 的实时监控指标数据。
4. Click **Options**->**Monitoring Details icon** in the monitor list to view ShenYu's real-time monitoring metrics.
![hertzbeat](/img/blog/monitor-shenyu-4.png)
![hertzbeat](/img/blog/monitor-shenyu-4.png)
5. 点击**监控历史详情TAB** 即可浏览 ShenYu 的历史监控指标数据图表📈。
5. Click the **Monitor History TAB** to view ShenYu's historical monitoring metrics graphs 📈.
![hertzbeat](/img/blog/monitor-shenyu-5.png)
![hertzbeat](/img/blog/monitor-shenyu-5.png)
![hertzbeat](/img/blog/monitor-shenyu-6.png)
**DONE!完成啦!通过上面几步,总结起来其实也就只用两步**
- **第一步开启 ShenYu 端`metrics`插件功能**
- **第二步在 HertzBeat 监控页面配置IP端口添加监控即可**
**DONE! With the above steps, it's really only two steps**
- **The first step is to enable the `metrics` plugin on the ShenYu side**.
- **The second step is to configure the IP ports on the HertzBeat monitoring page to add monitoring
:::tip
通过上面的两步我们就完成了对 Apache ShenYu 的监控,我们可以在 HertzBeat 随时查看监控详情指标信息来观测其服务状态。
当然只是看肯定是不完美的,监控往往伴随着告警阈值,当 ShenYu 的某些指标超出我们的期望值或异常时,能及时的通知到我们对应的负责人,负责人收到通知处理问题,这样才是一个完整的监控告警流程。
By the above two steps we have finished monitoring Apache ShenYu, we can check the monitoring details and metrics information in HertzBeat anytime to observe its service status.
Of course, just looking at it is not perfect, monitoring is often accompanied by alarm thresholds, when some of ShenYu's indicators exceed our expectations or abnormalities, we can promptly notify the person in charge of our counterparts, the person in charge of the notification to deal with the problem, so that is a complete monitoring and alerting process.
:::
**接下来我们就来一步一步演示如何配置 HertzBeat 系统里的阈值告警通知,让 ShenYu 的指标异常时,及时通知给我们**
**Next we will demonstrate step by step how to configure the threshold alarm notification in HertzBeat system, so that when ShenYu's metrics are abnormal, we will be notified in a timely manner** **This is a complete monitoring and alerting process.
#### 三. 在 HertzBeat 系统添加 ShenYu 指标阈值告警
#### III. Adding ShenYu Metrics Threshold Alerts to the HertzBeat System
1. 对某个重要指标配置告警阈值
1. Configure an alarm threshold for an important metric.
路径:菜单 -> 告警阈值 -> 新增阈值
Path: Menu -> Alert Thresholds -> Add Thresholds
- 选择配置的指标对象,ShenYu 监控有非常多的指标,我们举例对 `打开的文件描述符的数量` `process_open_fds` -> `value` 这个指标进行阈值设置, 当服务端打开文件描述符数量大于3000时发出告警。
- 这里我们就配置当此指标`process_open_fds``value>3000` 时发出告警,告警级别为**警告告警**,三次即触发,具体如下图。
- There are a lot of metrics in ShenYu monitoring, for example, we will set the threshold for the `number of open file descriptors` `process_open_fds` -> `value` metric, which will alert you when the number of open file descriptors on the server side is greater than 3,000.
- Here we configure an alert to be issued when the `value' of `process_open_fds` exceeds 3000, with an alert level of **Warning alert**, which is triggered three times, as shown in the following figure.
![hertzbeat](/img/blog/monitor-shenyu-7.png)
![hertzbeat](/img/blog/monitor-shenyu-7.png)
2. 新增消息通知接收人
2. Add message notification recipients
> 配置接收人,让告警消息知道要发给谁,用什么方式发。
> Configure recipients to let alert message know who to send to and in what way.
路径:菜单 -> 告警通知 -> 告警接收人 -> 新增接收人
Path: Menu -> Alert Notification -> Alert Recipients -> Add New Recipient.
消息通知方式支持 **邮件,钉钉,企业微信,飞书,WebHook,短信**等,我们这里以常用的钉钉为例。
Message notification methods support **Email, Nail, WeChat, Flybook, WebHook, SMS**, etc. Here we take the commonly used Nail as an example.
- 参照此[帮助文档](https://hertzbeat.com/docs/help/alert_dingtalk) https://hertzbeat.com/docs/help/alert_dingtalk 在钉钉端配置机器人,设置安全自定义关键词`HertzBeat`,获取对应`access_token`值。
- 在 HertzBeat 配置接收人参数如下。
- Refer to this [help document](https://hertzbeat.com/docs/help/alert_dingtalk) https://hertzbeat.com/docs/help/alert_dingtalk Configure the bot on the pinning side, set the security customization keyword ` HertzBeat`, get the corresponding `access_token` value.
- Configure the recipient parameters in HertzBeat as follows.
【告警通知】->【新增接收人】 ->【选择钉钉机器人通知方式】->【设置钉钉机器人ACCESS_TOKEN-> 【确定】
[Alert Notification] -> [Add Recipient] -> [Select Nailed Bot Notification Method] -> [Set Nailed Bot ACCESS_TOKEN] -> [OK]
![hertzbeat](/img/blog/alert-notice-1.png)
![hertzbeat](/img/blog/alert-notice-1.png)
3. 配置关联的告警通知策略⚠️ 【新增通知策略】-> 【将刚设置的接收人关联】-> 【确定】
3. Configure the associated alert notification policy ⚠️ [Add Notification Policy] -> [Associate the recipient you just set] -> [OK] !
> 配置告警通知策略,让告警消息与接收人绑定,这样就能决定哪些告警发给哪个人。
> Configure the alert notification policy to bind alert messages to recipients so that you can decide which alerts go to which person.
![hertzbeat](/img/blog/alert-notice-2.png)
![hertzbeat](/img/blog/alert-notice-2.png)
### 完毕,现在坐等告警消息过来啦。叮叮叮叮
### Over and out, now wait for the alert message to come through. Ding, ding, ding, ding.
```
[HertzBeat告警通知]
告警目标对象 : shenyu.process_open_fds.value
所属监控任务ID : 205540620349696
所属任务名称 : SHENYU_localhost
告警级别 : 警告告警
告警触发时间 : 2023-01-08 22:17:06
内容详情 : 请注意⚠️ ShenYu网关打开的文件描述符的数量为 3044 超过3000
[HertzBeat Alert Notification]
Alert target object : shenyu.process_open_fds.value
Task ID : 205540620349696
Task name : SHENYU_localhost
Alarm level : Warning alarm
Alarm Trigger Time : 2023-01-08 22:17:06
Details : Please note that the number of file descriptors opened by ⚠️ ShenYu gateway is 3044 more than 3000
```
## 小结
## Summary
:::tip
这篇实践文章带我们体验了如何使用 HertzBeat 监控 Apache ShenYu 指标数据,可以发现将 `监控-告警-通知` 集一体的 HertzBeat 在操作与使用方面更加的便捷,在页面上简单点一点就能把 ShenYu 纳入监控,再也不需要部署多个组件,写多个有门槛的YML配置文件了。
This hands-on article takes us through how to use HertzBeat to monitor Apache ShenYu metrics data, and we can find that HertzBeat, which combines ``Monitoring-Alert-Notification``, is much more convenient to operate and use, and you can include ShenYu in the monitoring by simply clicking on a page. There is no need to deploy multiple components and write multiple YML configuration files.
:::
Apache ShenYu Github: https://github.com/apache/shenyu
HertzBeat Github: https://github.com/dromara/hertzbeat
HertzBeat Github: https://github.com/dromara/hertzbeat
**欢迎了解使用Star支持哦!**
**Welcome to learn about using Star Support Oh! **
只需要一条docker命令即可安装体验heartbeat
`docker run -d -p 1157:1157 --name hertzbeat tancloud/hertzbeat`
Experience heartbeat with a single docker command:
`docker run -d -p 1157:1157 --name hertzbeat tancloud/hertzbeat`