diff --git a/machines/odin/configuration.nix b/machines/odin/configuration.nix index b350796..7116000 100644 --- a/machines/odin/configuration.nix +++ b/machines/odin/configuration.nix @@ -15,6 +15,7 @@ ./storage.nix ./network.nix ./virtualisation.nix + ./promtail ../../users/erwin ../../users/root ]; @@ -105,6 +106,12 @@ lvm = { enable = true; }; + prometheus.exporters = { + node = { + enable = true; + enabledCollectors = [ "systemd" ]; + }; + }; }; system.stateVersion = "24.05"; diff --git a/machines/odin/promtail/default.nix b/machines/odin/promtail/default.nix new file mode 100644 index 0000000..000d18c --- /dev/null +++ b/machines/odin/promtail/default.nix @@ -0,0 +1,33 @@ +{ + services.promtail = { + enable = true; + configuration = { + clients = [ { url = "http://saga:3100/loki/api/v1/push"; } ]; + positions = { + filename = "/tmp/positions.yaml"; + }; + scrape_configs = [ + { + job_name = "journal"; + journal = { + labels = { + host = "odin"; + job = "systemd-journal"; + }; + max_age = "12h"; + }; + relabel_configs = [ + { + source_labels = [ "__journal__systemd_unit" ]; + target_label = "unit"; + } + ]; + } + ]; + server = { + grpc_listen_port = 0; + http_listen_port = 28183; + }; + }; + }; +}