如何在目标 prometheus 上添加 https url

Yoh*_*nes 30 https prometheus

我想将我的 HTTPS 目标 URL 添加到 Prometheus,出现如下错误:

"https://myDomain.dev" is not a valid hostname"
Run Code Online (Sandbox Code Playgroud)

我的域可以使用代理通过 Nginx 和端口 9100 访问和运行(基本上我为节点导出器创建了一个域)

我的配置 prometheus.yml

scrape_configs:
  - job_name: 'prometheus'

    static_configs:
    - targets: ['localhost:9090']

  - job_name: 'domain-job'
    static_configs:
    - targets: ['https://myDomain.dev']
Run Code Online (Sandbox Code Playgroud)

还有什么配置需要添加吗?

Mar*_*ira 55

使用以下配置:

  - job_name: 'domain-job'
    scheme: https
    static_configs:
    - targets: ['myDomain.dev']
Run Code Online (Sandbox Code Playgroud)


jum*_*key 9

除了配置 https 方案之外,如果您需要跳过 tls 或需要配置不记名令牌,此配置将起作用:

job_name: 'spring-actuator'
  scheme: https
  authorization:
      type: Bearer
      credentials: <your_token>
  tls_config:
      insecure_skip_verify: true
  metrics_path: '/actuator/prometheus'
  scrape_interval: 5s
  static_configs:
    - targets: ['your_ip:your_port']
Run Code Online (Sandbox Code Playgroud)

如果您需要其他配置,此参考可能会对您有所帮助。