【问题标题】:x509: certificate signed by unknown authority for prometheusx509:prometheus 的未知权威签署的证书
【发布时间】:2020-08-20 14:13:21
【问题描述】:

我试图使用 Prometheus 监控我们的一个 Spring Boot 应用程序,但不幸的是,该服务的状态在 ubuntu 服务器中没有启动,它显示了一些错误,例如 –

/prometheus: x509: 由未知机构签署的证书,在我本地的 Prometheus 中,此服务已启动,并且还能够监控一些 http 请求。 enter image description here

【问题讨论】:

  • 我的服务器似乎没有使用自签名证书运行,所以当 prometheus 尝试调用它时,它在证书问题上失败了。 Yiou 可以: 在 prometheus 服务器上安装你的证书。或者告诉 prometheus 忽略 ssl 验证。 (顺便说一句,你可能会丢失 url https 默认为 443 的端口号)

标签: prometheus grafana spring-boot-actuator


【解决方案1】:

我也遇到过同样的问题。 解决方法:

按照@Shmuel 的建议配置 Prometheus 以忽略 ssl 验证

global:
  scrape_interval:     15s
  external_labels:
    monitor: 'prometheus'

scrape_configs:
  - job_name: 'job-name'

    static_configs:
      - targets:
        - host_name_or_ip_address1
        - host_name_or_ip_address2
        - host_name_or_ip_address2

    scheme: https  # to use https instead of http for scraping

    tls_config:
      insecure_skip_verify: true  # This is the key

【讨论】:

    【解决方案2】:

    如果您使用的是自签名证书,您可以将证书添加到scrape_configs 下的tls_config

    global:
      scrape_interval:     15s
      external_labels:
        monitor: 'prometheus'
    
    scrape_configs:
      - job_name: 'job-name'
    
        static_configs:
          - targets:
            - host_name_or_ip_address1
    
        tls_config:
          ca_file: /path/to/prometheus.crt
    
        scheme: https
    

    【讨论】:

      猜你喜欢
      • 2016-08-24
      • 2018-07-13
      • 2019-04-12
      • 2018-04-22
      • 2021-11-04
      • 2021-02-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多