SpringBoot+actuator+prometheus+Consul+grafana监控系列(一)

11 篇文章 1 订阅
10 篇文章 0 订阅

由于单位项目,部分业务以及服务器需要做到实时监控,便找了行业较为前沿流行的技术进行摸索,经过部署实践,做以总结,将小小心得分享,也便于日后查看;
本文采取一键安装,一键卸载,文中脚本可以直接使用,搭建环境如下:
Linux 麒麟OS + 红莲花浏览器 + 神通数据库

项目地址在下方

sringboot项目搭建(略)
添加actuator,prometheus依赖
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-registry-prometheus</artifactId>
        </dependency>
编写application文件
#应用端口
server.port=8081
#监控端口
management.server.port=8100
#设置上下文路径
server.servlet.context-path=/monitor
management.server.servlet.context-path=${server.servlet.context-path}
#监控所包含的内容
management.endpoints.web.exposure.include=prometheus,info,health
#显示详情
management.endpoint.health.show-details=always
#应用名
spring.application.name=monitor

配置参考: https://docs.spring.io/spring-boot/docs/2.1.6.RELEASE/reference/html/production-ready-endpoints.html

测试actuator,peoemtheus 显示
# 健康检查
http://localhost:8100/monitor/actuator
http://localhost:8100/monitor/actuator/health
#以prometheus 指标方式显示数据
http://localhost:8100/monitor/actuator/prometheus

当出现类似以下信息,就说明actuator,prometheus配置好了. 第一步也就完成了.
在这里插入图片描述

GitHub: https://github.com/qinyunsurd/monitor

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值