From ca2663cdd55205c64deabe371af668f61eef4d30 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 4 Apr 2022 14:17:59 -0700 Subject: prometheus: configure correctly the blackbox --- hosts/common/server/prometheus.nix | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'hosts/common') diff --git a/hosts/common/server/prometheus.nix b/hosts/common/server/prometheus.nix index bf6cb54..012fdb5 100644 --- a/hosts/common/server/prometheus.nix +++ b/hosts/common/server/prometheus.nix @@ -60,17 +60,30 @@ in { "--web.enable-admin-api" ]; - blackboxTargets = [{ - job_name = "icmp_probe"; - metrics_path = "/probe/blackbox"; - scrape_interval = "1m"; - params = { module = [ "icmp" ]; }; - targets = [ "8.8.8.8" ]; - static_configs = [{ targets = [ "127.0.0.1:9115" ]; }]; - relabel_configs = relabelConfigs; - }]; - scrapeConfigs = [ + { + job_name = "blackbox-ping"; + metrics_path = "/probe"; + params = { module = [ "icmp" ]; }; + static_configs = [{ + targets = + [ "8.8.8.8" "1.1.1.1" "4.4.4.4" "fcuny.net" "git.fcuny.net" ]; + }]; + relabel_configs = [ + { + source_labels = [ "__address__" ]; + target_label = "__param_target"; + } + { + source_labels = [ "__param_target" ]; + target_label = "instance"; + } + { + target_label = "__address__"; + replacement = "localhost:9115"; + } + ]; + } { job_name = "node"; static_configs = -- cgit 1.4.1