How do I need to configure a monitoring.coreos.com/v1
Probe
to instrument my prometheus-operator to collect icmp
metrics from a defined list of targets?
This assumes that you have installed both prometheus- and blackbox-exporter as follows:
helm install prometheus prometheus-community/kube-prometheus-stack -n monitoring --create-namespace
helm install prometheus-blackbox-exporter prometheus-community/prometheus-blackbox-exporter -n monitoring
First you need to enable the icmp
module of the blackbox-exporter in a values file, e.g. blackbox-exporter.yml
:
config:
modules:
icmp:
prober: icmp
icmp:
preferred_ip_protocol: ip4
allowIcmp: true
apply the config:
helm upgrade prometheus-blackbox-exporter prometheus-community/prometheus-blackbox-exporter -f blackbox-exporter.yml
then you can define the Probe
like this:
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