diff --git a/machines/configuration.nix b/machines/configuration.nix index 35897e7..69fdb0d 100644 --- a/machines/configuration.nix +++ b/machines/configuration.nix @@ -43,6 +43,7 @@ let defaultModules = baseModules; makeMicroVM = hostName: ipv4Addr: macAddr: modules: [ + self.nixosModules.malobeo.metrics { microvm = { hypervisor = "cloud-hypervisor"; @@ -79,6 +80,13 @@ let } ]; }; + + malobeo.metrics = { + enable = true; + enablePromtail = true; + logNginx = false; + lokiHost = "10.0.0.14"; + }; systemd.network.enable = true; diff --git a/machines/infradocs/configuration.nix b/machines/infradocs/configuration.nix index 0c2c2ee..441e73a 100644 --- a/machines/infradocs/configuration.nix +++ b/machines/infradocs/configuration.nix @@ -16,25 +16,7 @@ with lib; networking.firewall.allowedTCPPorts = [ 9002 ]; - services.prometheus = { - exporters = { - node = { - enable = true; - enabledCollectors = [ "systemd" "processes" ]; - port = 9002; - }; - }; - }; - - services.promtail = { - enable = true; - configFile = import ../modules/malobeo/promtail_config.nix { - lokiAddress = "10.0.0.14"; - logNginx = true; - config = config; - pkgs = pkgs; - }; - }; + malobeo.metrics.logNginx = lib.mkForce true; users.users.promtail.extraGroups = [ "nginx" "systemd-journal" ]; diff --git a/machines/overwatch/configuration.nix b/machines/overwatch/configuration.nix index 71f8de6..5d50c7c 100644 --- a/machines/overwatch/configuration.nix +++ b/machines/overwatch/configuration.nix @@ -39,13 +39,6 @@ with lib; services.prometheus = { enable = true; port = 9001; - exporters = { - node = { - enable = true; - enabledCollectors = [ "systemd" "processes" ]; - port = 9002; - }; - }; scrapeConfigs = [ { @@ -54,12 +47,25 @@ with lib; targets = [ "127.0.0.1:9002" ]; }]; } + { + job_name = "durruti"; + static_configs = [{ + targets = [ "10.0.0.5:9002" ]; + }]; + } { job_name = "infradocs"; static_configs = [{ targets = [ "10.0.0.11:9002" ]; }]; } + { + job_name = "nextcloud"; + static_configs = [{ + targets = [ "10.0.0.13:9002" ]; + }]; + } + # add vpn - check how to reach it first. most probably 10.100.0.1 ]; }; @@ -68,16 +74,6 @@ with lib; configFile = ./loki.yaml; }; - services.promtail = { - enable = true; - configFile = import ../modules/malobeo/promtail_config.nix { - lokiAddress = "10.0.0.13"; - logNginx = false; - config = config; - pkgs = pkgs; - }; - }; - users.users.promtail.extraGroups = [ "nginx" "systemd-journal" ];