为 Alertmanager 配置 HTTPS 和基本身份验证

时间:2021-04-26 15:28:44

标签: security https prometheus basic-authentication prometheus-alertmanager

我想使用 tls 和身份验证来保护我的 Alertmanager,以便在我的网络中,不是每个人都能够访问面向公众的端点。我不想使用 nginx 服务器进行代理。 这将是我的 prometheus 配置:

global:
  scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
  alertmanagers:
  - scheme: https
    basic_auth:
      username: abc
      password: ####
    tls_config:
      ca_file: ca.crt
      cert_file: ca.crt
      key_file: ca.key
    static_configs:
    - targets: ['localhost:9093']

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  - "alertRules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'
    scheme: https
    basic_auth:
      username: abc
      password: ###
    tls_config:
      ca_file: ca.crt
    static_configs:
    - targets: ['localhost:9090']

0 个答案:

没有答案