spring admin

服务监测相关:

背景

监测:监测方与被监测方通信,收集被监测方存活及指标等相关信息,给予显示和报警。
以服务存活为例:监测方每隔一段时间询问被监测方“是否存活”,被监测方回答“是”则仍为被监测方存活。

监测需要:
   被监测方:提供接口来响应检测方
   检测方:1.向被监测方发送请求 2.处理被监测方返回的信息

由于各种服务增多,程序员肯定懒得写,于是就有了监测相关的框架。

spring boot actuator

what:
- spring boot子项目
- 提供了很多生产级的特性
- 通过http端口或JMX来监测和管理服务的功能。

how:
- actuator使用端点(endpoints)来监测应用/和应用交互。

- 各个端点彼此独立,都可以根据需要开关(enabled/disabled)。
  yml/properties中配置

- actuator内置了大量端点供用户使用。
  如:health/metrics/loggers/shutdown。。。
  web端还包括:logfile/heapdump/prometheus/jolokia
  内置端点可对外暴露HTTP接口。通过/prefix(default actuator)/endpoint-id

  ps:
     1. prefix可以修改,但不建议直接/,不然配置拦截器和过滤器神烦。
     
     2. 内置端点logfile通过在yml/properties中配置logging.file&logging.path属性,可以通过接口读取日志文件内容。
        并不能读取appender。如需要读取appender,可以采取自定义实现。

- endpoint可以自定义
 
- 内置endpoint

- 如果不希望接口对外暴露可以配合springboot security一起食用风味更加。本篇暂略下不表。


参考:

官方文档: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#production-ready

quick-start&内置端口详解: http://www.ityouknow.com/springboot/2018/02/06/spring-boot-actuator.html

看起来比官方文档舒服的网站:https://www.baeldung.com/spring-boot-actuators

### springboot admin:
https://github.com/codecentric/spring-boot-admin
http://codecentric.github.io/spring-boot-admin/2.0.2/

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值