【发布时间】:2021-05-22 14:02:24
【问题描述】:
我需要如何配置 monitoring.coreos.com/v1 Probe 来检测我的 prometheus-operator 以从定义的目标列表中收集 icmp 指标?
【问题讨论】:
标签: prometheus-operator prometheus-blackbox-exporter
我需要如何配置 monitoring.coreos.com/v1 Probe 来检测我的 prometheus-operator 以从定义的目标列表中收集 icmp 指标?
【问题讨论】:
标签: prometheus-operator prometheus-blackbox-exporter
这假设您已经安装了 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
【讨论】: