【发布时间】:2016-10-31 18:08:53
【问题描述】:
当我想检查具有 Spring Boot Actuator 的应用程序的运行状况指标时,我可以看到该结果:
{
"status": "UP",
"diskSpace": {
"status": "UP",
"total": 299055067136,
"free": 246445404160,
"threshold": 10485760
}
}
我还可以看到/metrics 结果。我想从另一个 Spring 应用程序中获取此类信息。这适用于/metrics:
restTemplate.getForObject(metricsPath, HashMap.class);
当我为了健康而尝试时:
restTemplate.getForObject(healthPath, String.class);
我收到一般的503 错误。我已经调试了系统并意识到 Spring 由于我的 Solr 依赖项而引发错误。它尝试向127.0.0.1发出ping请求
我的问题:
1) 当我不使用restTemplate 时它是如何工作的?
2) 我怎样才能指出SolrHealthIndicator 的Solr 路径是什么?
PS:我可以验证问题与 Solr 有关,因为当我添加时:
management:
health:
solr:
enabled: false
我可以看到Status 是UP 和restTemplate。
【问题讨论】:
标签: java spring spring-boot spring-boot-actuator