diff options
Diffstat (limited to '')
-rw-r--r-- | hosts/common/server/prometheus.nix | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/hosts/common/server/prometheus.nix b/hosts/common/server/prometheus.nix index 6ae25cf..bf6cb54 100644 --- a/hosts/common/server/prometheus.nix +++ b/hosts/common/server/prometheus.nix @@ -1,6 +1,23 @@ { config, pkgs, lib, ... }: let + blackboxConfig = { + modules = { + https_2xx = { + prober = "http"; + timeout = "5s"; + http = { + method = "GET"; + valid_status_codes = [ ]; + fail_if_not_ssl = true; + }; + }; + icmp = { + prober = "icmp"; + timeout = "5s"; + }; + }; + }; relabelConfigs = [ { source_labels = [ "__address__" ]; @@ -25,6 +42,13 @@ let } ]; in { + services.prometheus.exporters.blackbox = { + enable = true; + listenAddress = "127.0.0.1"; + port = 9115; + configFile = pkgs.writeText "blackbox.yml" (builtins.toJSON blackboxConfig); + }; + services.prometheus = { enable = true; @@ -36,6 +60,16 @@ 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 = "node"; |