使用开源实时监控工具 HertzBeat 对 SpringBoot2 应用的监控告警实践,5分钟搞定!
HertzBeat 介绍
HertzBeat 是一款开源,易用友好的实时监控工具,无需Agent,拥有强大自定义监控能力。
- 集监控-告警-通知为一体,支持对应用服务,数据库,操作系统,中间件,云原生,网络等监控,阈值告警,告警通知(邮件微信钉钉飞书短信 Slack Discord Telegram)。
- 其将Http,Jmx,Ssh,Snmp,Jdbc等协议规范可配置化,只需配置YML就能使用这些协议去自定义采集任何您想要采集的指标。您相信只需配置YML就能立刻适配一个K8s或Docker等新的监控类型吗?
- HertzBeat 的强大自定义,多类型支持,易扩展,低耦合,希望能帮助开发者和中小团队快速搭建自有监控系统。
Github: github.com/dromara/her…
在 HertzBeat 5分钟搞定对 SpringBoot2 应用的监控
操作前提,您已拥有 SpringBoot2 应用环境和 HertzBeat 环境。
- HertzBeat 安装部署文档 hertzbeat.com/docs/start/…
一. 在 SpringBoot2 应用端暴露出actuator
指标接口,它将提供 metrics 接口数据。
- 开启 SpringBoot Actuator Endpoint 暴露出
metrics health env
指标接口
management:
endpoints:
web:
exposure:
include:
- 'metrics'
- 'health'
- 'env'
enabled-by-default: on
复制代码
- 重启后测试访问指标接口
ip:port/actuator
是否有响应json数据如下:
{
"_links": {
"self": {
"href": "http://localhost:1157/actuator",
"templated": false
},
"health-path": {
"href": "http://localhost:1157/actuator/health/{*path}",