Merge pull request #281555 from fpletz/nixos/ntpd-rs-fix-metrics

nixos/ntpd-rs: fix metrics service
This commit is contained in:
Robin Gloster 2024-01-17 15:49:24 +01:00 committed by GitHub
commit e59524560c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 6 deletions

View file

@ -74,13 +74,13 @@ in
};
};
systemd.services.ntp-rs-metrics = lib.mkIf cfg.metrics.enable {
systemd.services.ntpd-rs-metrics = lib.mkIf cfg.metrics.enable {
wantedBy = [ "multi-user.target" ];
serviceConfig = {
User = "";
Group = "";
DynamicUser = true;
ExecStart = [ "" "${lib.makeBinPath [ cfg.package ]}/bin/ntp-metrics-exporter --config=${configFile}" ];
ExecStart = [ "" "${lib.makeBinPath [ cfg.package ]}/ntp-metrics-exporter --config=${configFile}" ];
};
};
};

View file

@ -41,9 +41,11 @@ import ./make-test-python.nix ({ lib, ... }:
testScript = { nodes, ... }: ''
start_all()
server.wait_for_unit('multi-user.target')
client.wait_for_unit('multi-user.target')
server.succeed('systemctl is-active ntpd-rs.service')
client.succeed('systemctl is-active ntpd-rs.service')
for machine in (server, client):
machine.wait_for_unit('multi-user.target')
machine.succeed('systemctl is-active ntpd-rs.service')
machine.succeed('systemctl is-active ntpd-rs-metrics.service')
machine.succeed('curl http://localhost:9975/metrics | grep ntp_uptime_seconds')
'';
})