如何为 ping 丢失率设置 prometheus、grafana 和 blackbox_exporter
How to setup prometheus, grafana and blackbox_exporter for ping lost rate
我正在尝试使用 prometheus、grafana 和 blackbox_exporter 通过 ping(icmp) 来监控我的服务器。我们最近遇到网络不稳定,但我的设置无法显示警报。我想知道我应该使用 'probe_duration_seconds' 还是其他探测方法?
grfana 设置指标:probe_duration_seconds 面板数据源为 prometheus
blackbox.yml:
modules:
icmp:
prober: icmp
timeout: 5s
icmp:
protocol: "icmp"
preferred_ip_protocol: "ip4"
prometheus.yml:
global:
scrape_interval: 15s
external_labels:
monitor: 'codelab-monitor'
scrape_configs:
- job_name: 'blackbox'
scrape_interval: 5s
metrics_path: /probe
params:
module: [icmp] #ping
static_configs:
- targets: ['192.168.1.29']
labels:
group: 'env A'
- targets: ['192.168.2.185', '192.168.3.185', '192.168.4.185']
labels:
group: 'env B'
relabel_configs:
- source_labels: [__address__]
regex: (.*)(:80)?
target_label: __param_target
replacement:
- source_labels: [__param_target]
regex: (.*)
target_label: instance
replacement:
- source_labels: []
regex: .*
target_label: __address__
replacement: 127.0.0.1:9115
probe_success
根据ping是否成功会是1/0
我正在尝试使用 prometheus、grafana 和 blackbox_exporter 通过 ping(icmp) 来监控我的服务器。我们最近遇到网络不稳定,但我的设置无法显示警报。我想知道我应该使用 'probe_duration_seconds' 还是其他探测方法?
grfana 设置指标:probe_duration_seconds 面板数据源为 prometheus
blackbox.yml:
modules:
icmp:
prober: icmp
timeout: 5s
icmp:
protocol: "icmp"
preferred_ip_protocol: "ip4"
prometheus.yml:
global:
scrape_interval: 15s
external_labels:
monitor: 'codelab-monitor'
scrape_configs:
- job_name: 'blackbox'
scrape_interval: 5s
metrics_path: /probe
params:
module: [icmp] #ping
static_configs:
- targets: ['192.168.1.29']
labels:
group: 'env A'
- targets: ['192.168.2.185', '192.168.3.185', '192.168.4.185']
labels:
group: 'env B'
relabel_configs:
- source_labels: [__address__]
regex: (.*)(:80)?
target_label: __param_target
replacement:
- source_labels: [__param_target]
regex: (.*)
target_label: instance
replacement:
- source_labels: []
regex: .*
target_label: __address__
replacement: 127.0.0.1:9115
probe_success
根据ping是否成功会是1/0