nixos-config/machines/chungus/telemetry/telegraf-smart.nix

34 lines
763 B
Nix
Raw Permalink Normal View History

2023-05-15 09:30:42 +02:00
{ pkgs, ... }:
{
2023-06-01 07:51:37 +02:00
services.smartd.enable = true;
2024-08-29 03:26:04 +02:00
environment.systemPackages = [
pkgs.smartmontools
pkgs.nvme-cli
];
2023-05-15 09:30:42 +02:00
services.telegraf.extraConfig.inputs.smart = {
attributes = true;
use_sudo = true;
2023-05-15 09:30:42 +02:00
};
2024-08-29 03:26:04 +02:00
systemd.services.telegraf.path = [
pkgs.smartmontools
pkgs.nvme-cli
"/run/wrappers"
];
2023-05-15 09:30:42 +02:00
security.sudo.configFile = ''
# For smartctl add the following lines:
Cmnd_Alias SMARTCTL = ${pkgs.smartmontools}/bin/smartctl
telegraf ALL=(ALL) NOPASSWD: SMARTCTL
Defaults!SMARTCTL !logfile, !syslog, !pam_session
# For nvme-cli add the following lines:
Cmnd_Alias NVME = ${pkgs.nvme-cli}/bin/nvme
telegraf ALL=(ALL) NOPASSWD: NVME
Defaults!NVME !logfile, !syslog, !pam_session
'';
}