【问题标题】:Configure prometheus-operator to scrape static icmp targets from blackbox-operator配置 prometheus-operator 以从 blackbox-operator 中抓取静态 icmp 目标
【发布时间】:2021-05-22 14:02:24
【问题描述】:

我需要如何配置 monitoring.coreos.com/v1 Probe 来检测我的 prometheus-operator 以从定义的目标列表中收集 icmp 指标?

【问题讨论】:

    标签: prometheus-operator prometheus-blackbox-exporter


    【解决方案1】:

    这假设您已经安装了 prometheus- 和 blackbox-exporter,如下所示:

    helm install prometheus prometheus-community/kube-prometheus-stack -n monitoring --create-namespace
    helm install prometheus-blackbox-exporter prometheus-community/prometheus-blackbox-exporter -n monitoring
    

    首先,您需要在值文件中启用 blackbox-exporter 的 icmp 模块,例如blackbox-exporter.yml:

    config:
      modules:
        icmp:
          prober: icmp
          icmp:
            preferred_ip_protocol: ip4
    
    allowIcmp: true
    

    应用配置:

    helm upgrade prometheus-blackbox-exporter prometheus-community/prometheus-blackbox-exporter -f blackbox-exporter.yml
    

    那么你可以像这样定义Probe

    apiVersion: monitoring.coreos.com/v1
    kind: Probe
    metadata:
      name: blackbox-probe-icmp
      namespace: monitoring
      labels:
        release: prometheus
    spec:
      jobName: icmp
      interval: 1m
      scrapeTimeout: 5s
      module: icmp
      prober:
        url: prometheus-blackbox-exporter:9115
      targets:
        staticConfig:
          static:
            - 192.168.1.1
            - 8.8.8.8 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-06-11
      • 1970-01-01
      • 2021-07-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-24
      相关资源
      最近更新 更多