我正在尝试在Spring引导应用程序上设置Prometheus监视,但出现错误:Get https://example.com:8080/actuator/prometheus: EOF
我的设置
application.yml
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
metrics:
enabled: true
prometheus:
enabled: true
metrics:
export:
prometheus:
enabled: true
Prometheus config
global:
scrape_interval: 5s # Set the scrape interval to every 5 seconds.
evaluation_interval: 5s # Evaluate rules every 5 seconds.
scrape_configs:
- job_name: 'app'
metrics_path: '/actuator/prometheus'
scheme: https
static_configs:
- targets: ['example.com:8080']
现在,当浏览到actuator/prometheus
时,我可以看到数据:
# HELP hikaricp_connections_usage_seconds Connection usage time
# TYPE hikaricp_connections_usage_seconds summary ....
....
但是在Prometheous目标屏幕上,我可以看到正确的网址,但带有指定的错误。
我正在使用Docker运行Prometheus。
level=info ts=2018-08-14T19:10:59.6844594Z caller=main.go:603 msg="Loading configuration file" filename=/etc/prometheus/prometheus.yml
level=info ts=2018-08-14T19:10:59.686749Z caller=main.go:629 msg="Completed loading of configuration file" filename=/etc/prometheus/prometheus.yml
level=info ts=2018-08-14T19:10:59.6867898Z caller=main.go:502 msg="Server is ready to receive web requests."
答案 0 :(得分:0)
Prometheus目标屏幕显示EOF错误,表明prometheus.yml文件中有问题
在prometheus配置文件中更改抓取配置
- job_name: 'person-app'
metrics_path: '/actuator/prometheus'
static_configs:
- targets: ['example.com:8080']
目标应包括您的主机名,而不是URL。 更改配置文件后重新启动Prometheus
用于更新的yml文件
方案标签应位于static_configs上方。正确的声明应该是
job_name: 'person-app'
metrics_path: '/actuator/prometheus'
scheme: 'https'
static_configs:
- targets: ['example.com:8080']
答案 1 :(得分:0)
我创建了a sample to reproduce your issue,但失败了。请注意,样本位于so-51765772
上,而不是master
和I changed scheme
and target
from your Prometheus configuration上,以便于重现,如下所示:
global:
scrape_interval: 5s # Set the scrape interval to every 5 seconds.
evaluation_interval: 5s # Evaluate rules every 5 seconds.
scrape_configs:
- job_name: 'app'
metrics_path: '/actuator/prometheus'
scheme: http
static_configs:
- targets: ['localhost:8080']
我想问题可能出在其他地方。因此,如果您可以使此示例无法按您所看到的方式失败,那么我可以再看一遍。