1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00

prometheus-node-exporter: fix log permissions

The daemon won’t start as the assigned user doesn’t have
permissions to create the log file.
This commit is contained in:
Emily 2024-11-05 02:59:00 +00:00
parent 2f05a81019
commit 84d14d4043

View file

@ -81,7 +81,8 @@ in {
users.users._prometheus-node-exporter = {
uid = config.ids.uids._prometheus-node-exporter;
gid = config.ids.gids._prometheus-node-exporter;
home = "/var/empty";
home = "/var/lib/prometheus-node-exporter";
createHome = true;
shell = "/usr/bin/false";
description = "System user for the Prometheus Node exporter";
};
@ -104,11 +105,14 @@ in {
++ (map (collector: "--collector.${collector}") cfg.enabledCollectors)
++ (map (collector: "--no-collector.${collector}") cfg.disabledCollectors)
) + escapeShellArgs cfg.extraFlags;
serviceConfig = {
serviceConfig = let
logPath = config.users.users._prometheus-node-exporter.home
+ "/prometheus-node-exporter.log";
in {
KeepAlive = true;
RunAtLoad = true;
StandardErrorPath = "/var/log/prometheus-node-exporter.log";
StandardOutPath = "/var/log/prometheus-node-exporter.log";
StandardErrorPath = logPath;
StandardOutPath = logPath;
GroupName = "_prometheus-node-exporter";
UserName = "_prometheus-node-exporter";
};