From 0f4ae458284dd9584da142c3794a4a6a6714d331 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Thu, 15 Jul 2021 10:14:03 +0200 Subject: [PATCH] services: monitoring: set prometheus scrape interval --- services/monitoring.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/services/monitoring.nix b/services/monitoring.nix index ff37171..930743e 100644 --- a/services/monitoring.nix +++ b/services/monitoring.nix @@ -15,6 +15,13 @@ in { example = "monitoring.example.com"; description = "Domain to use in reverse proxy"; }; + + scrapeInterval = mkOption { + type = types.str; + default = "15s"; + example = "1m"; + description = "prometheus scrape interval"; + }; }; config = mkIf cfg.enable { @@ -32,6 +39,9 @@ in { name = "Prometheus"; type = "prometheus"; url = "http://localhost:${toString config.services.prometheus.port}"; + jsonData = { + timeInterval = cfg.scrapeInterval; + }; } ]; @@ -66,6 +76,10 @@ in { }; }; + globalConfig = { + scrape_interval = cfg.scrapeInterval; + }; + scrapeConfigs = [ { job_name = config.networking.hostName;