Skip to content

Commit

Permalink
collectd: show warning if the xencpu plugin is enabled without root
Browse files Browse the repository at this point in the history
  • Loading branch information
hehongbo committed Oct 8, 2024
1 parent 9abcf00 commit c1a8455
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions nixos/modules/services/monitoring/collectd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ in {
};

config = mkIf cfg.enable {
warnings = lib.optional ((cfg.plugins ? xencpu) || cfg.user == "root") ''
The xencpu plugin for collectd typically requires root privileges. You
have enabled the xencpu plugin but collectd is not configured to run as
root. If you're running in a Xen dom0 environment and want to collect
metrics of hardware CPU load, you may need
`services.collectd.user = "root"`;
'';

# 1200 is after the default (1000) but before mkAfter (1500).
services.collectd.extraConfig = lib.mkOrder 1200 ''
${baseDirLine}
Expand Down

0 comments on commit c1a8455

Please sign in to comment.