I've tried to follow the documentation, but I only see "status : UP" every time I check. I even went as far as to return Health.down.build() universally, but I still just see "status : UP". I'm not sure what I've done wrong. I have no errors.
答案 0 :(得分:0)
如果您将HealthIndicator
注释添加到班级,则您的自定义@Component
会随时随地注册。
如果您随后调用方法 actuator / health ,我想您将获得摘要状态:
{"status":"DOWN"}
只需将其添加到您的 application.properties 中,即可查看HealthIndicator
结果的详细视图:
management.endpoint.health.show-details=always
,您将得到如下内容:
{
"status": "DOWN",
"details": {
"MyCustomHealthCheck": {
"status": "DOWN",
"details": {
"remote.system.down": "There is something wrong with system XXX"
}
},
"diskSpace": {
"status": "UP",
"details": {
"total": 499963174912,
"free": 434322321408,
"threshold": 10485760
}
}
}
}