diff --git a/hosts/tower/configuration.nix b/hosts/tower/configuration.nix index daf0937..399ce58 100644 --- a/hosts/tower/configuration.nix +++ b/hosts/tower/configuration.nix @@ -36,6 +36,7 @@ services = { forgejo.enable = true; grafana.enable = true; + prometheus.enable = true; }; programs = { editors = { diff --git a/modules/services/grafana/module.nix b/modules/services/grafana/module.nix index 83d5b26..afeccb7 100644 --- a/modules/services/grafana/module.nix +++ b/modules/services/grafana/module.nix @@ -50,19 +50,19 @@ in { enable = true; datasources.settings = { datasources = [ - (mkIf config.modules.system.services.database.postgresql.enable { + (mkIf config.modules.system.services.prometheus.enable { name = "Prometheus"; type = "prometheus"; access = "proxy"; - url = "http://127.0.0.1:4024"; + url = "http://127.0.0.1:${toString config.services.prometheus.port}"; isDefault = true; }) - (mkIf config.modules.system.services.prometheus.enable { + (mkIf config.modules.system.services.database.postgresql.enable { name = "PostgreSQL"; type = "postgres"; access = "proxy"; - url = "http://127.0.0.1:${toString config.services.prometheus.port}"; + url = "http://127.0.0.1:${toString config.services.prometheus.exporters.postgres.port}"; }) ]; }; diff --git a/modules/services/prometheus/module.nix b/modules/services/prometheus/module.nix index bed6038..f978d0f 100644 --- a/modules/services/prometheus/module.nix +++ b/modules/services/prometheus/module.nix @@ -7,7 +7,7 @@ inherit (lib.modules) mkIf; inherit (lib.options) mkEnableOption; - cfg = config.modules.system.services.grafana; + cfg = config.modules.system.services.prometheus; port = 4022; in { options.modules.system.services.prometheus.enable = mkEnableOption "Grafana, a graphing service";