通过http://localhost:8100/health 访问监控信息发现只有有限的信息,如下:

1
2
3
4
{
"description": "Spring Cloud Eureka Discovery Client",
"status": "UP"
}

只展示了注册中心Eureka的信息。

经过阅读文档发现,新版本当中,actuator增加了安全机制,需要在配置文件中添加参数:

1
2
3
management:
security:
enabled: false

默认为true,需要校验权限才能访问/env、/mappings、 /beans,这里关闭后重新启动就可以看到很多health 的信息了。更多配置需要参考:https://docs.spring.io/spring-boot/docs/1.5.7.RELEASE/reference/htmlsingle/#production-ready

访问http://localhost:8100/health 获得如下数据:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{
"description": "Spring Cloud Eureka Discovery Client",
"status": "UP",
"discoveryComposite": {
"description": "Spring Cloud Eureka Discovery Client",
"status": "UP",
"discoveryClient": {
"description": "Spring Cloud Eureka Discovery Client",
"status": "UP",
"services": [
"itmuch-customer-movie",
"itmuch-provider-user"
]
},
"eureka": {
"description": "Remote status from Eureka server",
"status": "UP",
"applications": {
"ITMUCH-CUSTOMER-MOVIE": 1,
"ITMUCH-PROVIDER-USER": 1
}
}
},
"diskSpace": {
"status": "UP",
"total": 164282499072,
"free": 151694168064,
"threshold": 10485760
},
"refreshScope": {
"status": "UP"
},
"hystrix": {
"status": "UP"
}
}

更多参数设置参考:https://segmentfault.com/a/1190000004318360?_ea=568366


简单记录,有待深入挖坑!欢迎留言交流!