From 9871517be29ee6415ad33fc2b71a214933dd48a9 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Tue, 24 Oct 2023 11:49:42 +0200 Subject: [PATCH] Add ICMP probes These probes check if we can reach several targets via ICMP, which is not proxied, so they can be used to see if ICMP forwarding is working in the login node. In particular, we test if we can reach the Google (8.8.8.8) and Cloudflare (1.1.1.1) DNS servers, the BSC gateway which responds to ping only from the intranet and the login node (ssfhead). Reviewed-By: Aleix Roca Nonell --- m/hut/blackbox.yml | 3 +-- m/hut/monitoring.nix | 32 +++++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/m/hut/blackbox.yml b/m/hut/blackbox.yml index 83de003..e69acd3 100644 --- a/m/hut/blackbox.yml +++ b/m/hut/blackbox.yml @@ -121,12 +121,11 @@ modules: - expect: "PING :([^ ]+)" send: "PONG ${1}" - expect: "^:[^ ]+ 001" - icmp_example: + icmp: prober: icmp timeout: 5s icmp: preferred_ip_protocol: "ip4" - source_ip_address: "127.0.0.1" dns_udp_example: prober: dns timeout: 5s diff --git a/m/hut/monitoring.nix b/m/hut/monitoring.nix index 304590f..61fa22c 100644 --- a/m/hut/monitoring.nix +++ b/m/hut/monitoring.nix @@ -100,7 +100,7 @@ }]; } { - job_name = "blackbox"; + job_name = "blackbox-http"; metrics_path = "/probe"; params = { module = [ "http_2xx" ]; }; static_configs = [{ @@ -128,6 +128,36 @@ } ]; } + { + job_name = "blackbox-icmp"; + metrics_path = "/probe"; + params = { module = [ "icmp" ]; }; + static_configs = [{ + targets = [ + "1.1.1.1" + "8.8.8.8" + "ssfhead" + "gw.bsc.es" + ]; + }]; + relabel_configs = [ + { + # Takes the address and sets it in the "target=" URL parameter + source_labels = [ "__address__" ]; + target_label = "__param_target"; + } + { + # Sets the "instance" label with the remote host we are querying + source_labels = [ "__param_target" ]; + target_label = "instance"; + } + { + # Shows the host target address instead of the blackbox address + target_label = "__address__"; + replacement = "127.0.0.1:${toString config.services.prometheus.exporters.blackbox.port}"; + } + ]; + } { # Scrape the IPMI info of the hosts remotely via LAN job_name = "ipmi-lan";