我们几乎没有实现健康检查的Spring引导应用程序。对这些检查的响应根据@Thiru的
suggestion
. 我现在得到以下回复:
普罗米修斯服务器正在Ubuntu实例上运行。必须监视的Spring引导服务正在Windows server 2016上运行。我已经安装了
黑盒导出程序
(版本
0.12.0.windows-amd64
)在Windows服务器上
this
邮政。
在客户端(IP为的Windows服务器)上进行了以下更改:
172.16.x.yz
)侧入
blackbox.yml
:
modules:
http_2xx:
prober: http
http:
http_post_2xx:
prober: http
timeout: 5s
http:
method: POST
headers:
Content-Type: application/json
body: '{"status": "UP"}'
...
...
在普罗米修斯服务器上,以下是
prometheus.yml
:
...
...
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'blackbox'
metrics_path: /probe
params:
#module: [http_2xx] # Look for a HTTP 200 response.
module: [http_post_2xx] # Look for a HTTP 200 response.
static_configs:
- targets:
- http://172.16.x.yz:6300/serviceA/actuator/health
- http://172.16.x.yz:6340/serviceB/actuator/health
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 172.16.x.yz:9115 # The blackbox exporter's real hostname:port.
在客户机和服务器上进行上述更改后,当我重新启动
blackbox-exporter
和
prometheus
,我看到普罗米修斯
总是
显示
State
即使出口商正在监控的两项服务都会下跌。似乎普罗米修斯正在展示
黑盒导出程序
不是为了服务。有什么建议可以帮我解决吗?