diff options
author | Karel Kočí <cynerd@email.cz> | 2024-05-07 09:59:50 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2024-05-07 09:59:50 +0200 |
commit | a39660e8218d20177bcf95218e9bca3d9fcb5831 (patch) | |
tree | 4525b07b6dba9e1945b198e17916f6f2ded7f143 | |
parent | 33508b99c036be8d90be2ad424fbe43143f06afa (diff) | |
download | nixos-personal-a39660e8218d20177bcf95218e9bca3d9fcb5831.tar.gz nixos-personal-a39660e8218d20177bcf95218e9bca3d9fcb5831.tar.bz2 nixos-personal-a39660e8218d20177bcf95218e9bca3d9fcb5831.zip |
nixos/monitoring: fix wireguard and skip some inputs
-rw-r--r-- | nixos/configurations/dean.nix | 5 | ||||
-rw-r--r-- | nixos/configurations/lipwig.nix | 4 | ||||
-rw-r--r-- | nixos/configurations/spt-mox.nix | 1 | ||||
-rw-r--r-- | nixos/configurations/spt-mox2.nix | 1 | ||||
-rw-r--r-- | nixos/modules/monitoring.nix | 24 | ||||
-rw-r--r-- | nixos/modules/packages.nix | 1 |
6 files changed, 31 insertions, 5 deletions
diff --git a/nixos/configurations/dean.nix b/nixos/configurations/dean.nix index 6feae96..187e148 100644 --- a/nixos/configurations/dean.nix +++ b/nixos/configurations/dean.nix @@ -4,7 +4,10 @@ cynerd = { wireguard = true; - monitoring.speedtest = true; + monitoring = { + speedtest = true; + drives = false; + }; }; networking = { diff --git a/nixos/configurations/lipwig.nix b/nixos/configurations/lipwig.nix index dd183b3..e6ec96a 100644 --- a/nixos/configurations/lipwig.nix +++ b/nixos/configurations/lipwig.nix @@ -15,6 +15,10 @@ }; cynerd = { + monitoring = { + hw = false; + drives = false; + }; syncthing = { enable = false; baseDir = "/nas"; diff --git a/nixos/configurations/spt-mox.nix b/nixos/configurations/spt-mox.nix index c5ad7fb..4e29bca 100644 --- a/nixos/configurations/spt-mox.nix +++ b/nixos/configurations/spt-mox.nix @@ -7,6 +7,7 @@ cynerd = { home-assistant = true; + monitoring.drives = false; switch = { enable = true; lanAddress = "${config.cynerd.hosts.spt.mox}/24"; diff --git a/nixos/configurations/spt-mox2.nix b/nixos/configurations/spt-mox2.nix index c713477..9ffde96 100644 --- a/nixos/configurations/spt-mox2.nix +++ b/nixos/configurations/spt-mox2.nix @@ -6,6 +6,7 @@ }; cynerd = { + monitoring.drives = false; switch = { enable = true; lanAddress = "${config.cynerd.hosts.spt.mox2}/24"; diff --git a/nixos/modules/monitoring.nix b/nixos/modules/monitoring.nix index db77b00..394915a 100644 --- a/nixos/modules/monitoring.nix +++ b/nixos/modules/monitoring.nix @@ -18,6 +18,11 @@ in { default = true; description = "If hardware should be reported"; }; + drives = mkOption { + type = types.bool; + default = true; + description = "If S.M.A.R.T. should be enabled"; + }; speedtest = mkOption { type = types.bool; default = false; @@ -30,6 +35,9 @@ in { # Telegraf configuration services.telegraf = { enable = true; + package = pkgs.writeShellScriptBin "telegraf" '' + exec /run/wrappers/bin/telegraf "$@" + ''; environmentFiles = ["/run/secrets/telegraf.env"]; extraConfig = { agent = {}; @@ -66,20 +74,23 @@ in { } ]; diskio = [{}]; - net = [{}]; + net = [{ignore_protocol_stats = false;}]; + nstat = [{}]; system = [{}]; processes = [{}]; systemd_units = [{}]; wireguard = [{}]; } - // (optionalAttrs cnf.hw { - sensors = [{}]; + // (optionalAttrs cnf.drives { smart = [ { path_smartctl = "${pkgs.smartmontools}/bin/smartctl"; use_sudo = true; } ]; + }) + // (optionalAttrs cnf.hw { + sensors = [{}]; wireless = [{}]; }) // (optionalAttrs cnf.speedtest { @@ -115,6 +126,13 @@ in { ]; } ]; + + security.wrappers.telegraf = { + owner = "root"; + group = "root"; + capabilities = "CAP_NET_ADMIN+epi"; + source = "${pkgs.telegraf}/bin/telegraf"; + }; }) (mkIf (config.networking.hostName == "lipwig") { diff --git a/nixos/modules/packages.nix b/nixos/modules/packages.nix index bbb3e8e..d321901 100644 --- a/nixos/modules/packages.nix +++ b/nixos/modules/packages.nix @@ -68,7 +68,6 @@ in { termshark lm_sensors - ] ++ optionals (system == "x86_64-linux") [ nmap |