services: monitoring: set prometheus scrape interval

This commit is contained in:
Antoine Martin 2021-07-15 10:14:03 +02:00
parent 40bb8ff33b
commit 0f4ae45828

View file

@ -15,6 +15,13 @@ in {
example = "monitoring.example.com"; example = "monitoring.example.com";
description = "Domain to use in reverse proxy"; description = "Domain to use in reverse proxy";
}; };
scrapeInterval = mkOption {
type = types.str;
default = "15s";
example = "1m";
description = "prometheus scrape interval";
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
@ -32,6 +39,9 @@ in {
name = "Prometheus"; name = "Prometheus";
type = "prometheus"; type = "prometheus";
url = "http://localhost:${toString config.services.prometheus.port}"; url = "http://localhost:${toString config.services.prometheus.port}";
jsonData = {
timeInterval = cfg.scrapeInterval;
};
} }
]; ];
@ -66,6 +76,10 @@ in {
}; };
}; };
globalConfig = {
scrape_interval = cfg.scrapeInterval;
};
scrapeConfigs = [ scrapeConfigs = [
{ {
job_name = config.networking.hostName; job_name = config.networking.hostName;