diff options
Diffstat (limited to 'modules/monitoring/module.nix')
-rw-r--r-- | modules/monitoring/module.nix | 50 |
1 files changed, 20 insertions, 30 deletions
diff --git a/modules/monitoring/module.nix b/modules/monitoring/module.nix index 30c313b..62ff1ea 100644 --- a/modules/monitoring/module.nix +++ b/modules/monitoring/module.nix @@ -13,7 +13,7 @@ in imports = [ # crutches due to nix limitations: ./crutches/synapse.nix - + # modules ./system.nix ./postgres.nix @@ -28,15 +28,10 @@ in nginxHost = mkStringOption "The virtual host name"; nginxSsl = lib.mkEnableOption "Enable SSL for Nginx"; - prometheusScrapeIntervals = lib.mkOption { - type = lib.types.listOf lib.types.int; - default = [ - 1 - #2 # kinda pointless? - #5 # doesnt help with reliability - #15 # might aswell just use a 15s interval on grafana - ]; - description = "Scrape intervals for Prometheus"; + prometheusScrapeInterval = lib.mkOption { + type = lib.types.int; + default = 1; + description = "Scrape interval for Prometheus"; }; }; @@ -45,9 +40,7 @@ in prometheus = lib.mkIf (cfg.localPrometheus) { enable = true; listenAddress = "127.0.0.1"; - extraFlags = [ - "--storage.tsdb.wal-compression" - ]; + extraFlags = [ "--storage.tsdb.wal-compression" ]; }; grafana = lib.mkIf (cfg.localGrafana) { enable = true; @@ -62,24 +55,21 @@ in provision = { datasources.settings = { apiVersion = 1; - # datasources = [ - # { - # name = "Prometheus"; - # type = "prometheus"; - # access = "proxy"; - # url = "http://127.0.0.1:${toString config.services.prometheus.port}"; - # isDefault = true; - # } - # ]; - datasources = lib.map (interval: { - name = "Prometheus-${toString interval}"; - type = "prometheus"; - access = "proxy"; - url = "http://127.0.0.1:${toString config.services.prometheus.port}"; - #isDefault = true; - jsonData.timeInterval = "${toString interval}s"; - }) cfg.prometheusScrapeIntervals; + datasources = + lib.map + (interval: { + name = "Prometheus-${toString interval}"; + type = "prometheus"; + access = "proxy"; + url = "http://127.0.0.1:${toString config.services.prometheus.port}"; + #isDefault = true; + jsonData.timeInterval = "${toString interval}s"; + }) + [ + 1 + 15 + ]; }; }; }; |