1. 程式人生 > 其它 >Prometheus之blackbox exporter實現ICMP監控

Prometheus之blackbox exporter實現ICMP監控

一 ICMP監控配置

1.1 修改Prometheus Server配置檔案

root@prometheus-01:~# cat /usr/local/prometheus/prometheus.yml 

#ICMP 檢測
  - job_name: 'ping_status'
    metrics_path: /probe
    params:
      module: [icmp]
    static_configs:
      - targets:
        - 192.168.174.200
        - 192.168.174.103
        labels:
          instance: ping_status
          group: icmp
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: ip
      - target_label: __address__
        replacement: 192.168.174.104:9115  # The blackbox exporter's real hostname:port.

1.2 檢查檔案

root@prometheus-01:~# /usr/local/prometheus/promtool check config /usr/local/prometheus/prometheus.yml 
Checking /usr/local/prometheus/prometheus.yml
  SUCCESS: 1 rule files found

Checking /usr/local/prometheus/alert_rules/instance_up.yaml
  SUCCESS: 1 rules found

1.3 重啟Prometheus服務

root@prometheus-01:~# systemctl restart prometheus

二 Prometheus驗證資料

三 blackbox exporter驗證資料