diff --git a/modules/system/services/alloy.nix b/modules/system/services/alloy.nix index 78f9c01..b9c6fb1 100644 --- a/modules/system/services/alloy.nix +++ b/modules/system/services/alloy.nix @@ -64,8 +64,8 @@ in } prometheus.scrape "node_exporter" { - targets = prometheus.exporter.unix.default.targets - forward_to = [prometheus.remote_write.default.receiver] + targets = prometheus.exporter.unix.default.targets + forward_to = [prometheus.remote_write.default.receiver] scrape_interval = "15s" } ''; @@ -76,8 +76,10 @@ in prometheus.scrape "victorialogs" { targets = [{ __address__ = "localhost:${builtins.toString config.custom.services.victorialogs.port}", + job = "victorialogs", + instance = constants.hostname, }] - forward_to = [prometheus.remote_write.default.receiver] + forward_to = [prometheus.remote_write.default.receiver] scrape_interval = "15s" } ''; @@ -86,7 +88,7 @@ in "alloy/sshd-logs.alloy" = lib.mkIf cfg.collect.sshdLogs { text = '' loki.source.journal "sshd" { - matches = "_SYSTEMD_UNIT=sshd.service" + matches = "_SYSTEMD_UNIT=sshd.service" forward_to = [loki.write.default.receiver] } ''; diff --git a/modules/system/services/victoriametrics.nix b/modules/system/services/victoriametrics.nix index c27d1d2..169cf98 100644 --- a/modules/system/services/victoriametrics.nix +++ b/modules/system/services/victoriametrics.nix @@ -50,7 +50,11 @@ in } ); listenAddress = "localhost:${builtins.toString cfg.port}"; - extraOptions = [ "-selfScrapeInterval=15s" ]; + extraOptions = [ + "-selfScrapeInterval=15s" + "-selfScrapeJob=victoriametrics" + "-selfScrapeInstance=${config.networking.hostName}" + ]; }; custom.persist.directories = [ "/var/lib/${config.services.victoriametrics.stateDir}" ];