track smartd with telegraf
This commit is contained in:
parent
5db34b518a
commit
209867b501
3 changed files with 32 additions and 3 deletions
|
@ -30,6 +30,7 @@
|
|||
./prometheus.nix
|
||||
./grafana.nix
|
||||
./telegraf.nix
|
||||
./telegraf-smart.nix
|
||||
|
||||
#./home-display.nix
|
||||
|
||||
|
@ -86,7 +87,6 @@
|
|||
#};
|
||||
|
||||
services.printing.enable = false;
|
||||
services.smartd.enable = true;
|
||||
|
||||
#home-manager.users.mailUser.home.stateVersion = "22.11";
|
||||
|
||||
|
|
28
nixos/machines/chungus/telegraf-smart.nix
Normal file
28
nixos/machines/chungus/telegraf-smart.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
systemd.services.telegraf.path = [ pkgs.smartmontools pkgs.nvme-cli "/run/wrappers" ];
|
||||
environment.systemPackages = [ pkgs.smartmontools pkgs.nvme-cli ];
|
||||
|
||||
services.telegraf = {
|
||||
enable = true;
|
||||
extraConfig.inputs.smart = {
|
||||
attributes = true;
|
||||
use_sudo = true;
|
||||
};
|
||||
};
|
||||
|
||||
services.smartd.enable = true;
|
||||
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
|
||||
'';
|
||||
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, ... }:
|
||||
{ config, pkgs, ... }:
|
||||
let
|
||||
urls = [
|
||||
{ url = "https://bitwarden.ingolf-wagner.de"; path = ""; }
|
||||
|
@ -24,6 +24,7 @@ in
|
|||
inputs = {
|
||||
cpu = { };
|
||||
diskio = { };
|
||||
smart.attributes = true;
|
||||
x509_cert = [{
|
||||
sources = (map (url: "${url.url}:443") urls);
|
||||
interval = "30m"; # agent.interval = "10s" is default
|
||||
|
@ -49,7 +50,7 @@ in
|
|||
targets = [ "localhost:9273" ];
|
||||
labels = {
|
||||
service = "telegraf";
|
||||
server = "pepe";
|
||||
server = config.networking.hostName;
|
||||
};
|
||||
}];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue