【问题标题】:Prometheus endpoint error when using micrometer使用千分尺时的 Prometheus 端点错误
【发布时间】:2018-08-09 11:27:14
【问题描述】:

我正在尝试在 Spring Boot 应用程序上设置 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 目标屏幕上,我可以看到正确的 Url,但出现了指定的错误。

我正在使用 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."

【问题讨论】:

    标签: spring-boot prometheus micrometer spring-micrometer


    【解决方案1】:

    Prometheus 目标屏幕显示 EOF 错误表明 prometheus.yml 文件有问题

    更改 prometheus 配置文件中的抓取配置

    - job_name: 'person-app' metrics_path: '/actuator/prometheus' static_configs: - targets: ['example.com:8080']

    targets 应该包含您的主机名,而不是 url。 修改配置文件后重启prometheus

    对于更新的 yml 文件

    scheme 标签应该在 static_configs 之上。正确的声明应该是

    job_name: 'person-app' metrics_path: '/actuator/prometheus' scheme: 'https' static_configs: - targets: ['example.com:8080']

    【讨论】:

    • 对不起,给出了一个错误的 yml 示例。更新为“真正的” yml 配置文件(使用方案)
    • 我已经根据新的yml配置文件更新了答案
    • 感谢您的帮助@Sania。我遇到了同样的错误(使用方案:https 和方案:'https'
    • 没什么有趣的,添加
    【解决方案2】:

    我创建了a sample to reproduce your issue 但失败了。请注意,样本在so-51765772,而不是masterI 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']
    

    我想问题可能出在其他地方。因此,如果您可以让这个示例按照您所看到的方式失败,我可以再看看。

    【讨论】:

      猜你喜欢
      • 2018-11-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多