diff --git a/machines/fuuko/hardware-configuration.nix b/machines/fuuko/hardware-configuration.nix index b617a02..3a187d0 100644 --- a/machines/fuuko/hardware-configuration.nix +++ b/machines/fuuko/hardware-configuration.nix @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2021-2023 Simon Bruder +# SPDX-FileCopyrightText: 2021-2024 Simon Bruder # # SPDX-License-Identifier: AGPL-3.0-or-later @@ -92,6 +92,8 @@ } ]; + services.prometheus.exporters.smartctl.devices = [ "/dev/nvme0n1" "/dev/sda" "/dev/sdb" "/dev/sdc" ]; + powerManagement.cpuFreqGovernor = "schedutil"; networking = { diff --git a/machines/hitagi/hardware-configuration.nix b/machines/hitagi/hardware-configuration.nix index 4678a1d..872fab6 100644 --- a/machines/hitagi/hardware-configuration.nix +++ b/machines/hitagi/hardware-configuration.nix @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2020-2023 Simon Bruder +# SPDX-FileCopyrightText: 2020-2024 Simon Bruder # # SPDX-License-Identifier: AGPL-3.0-or-later @@ -55,6 +55,8 @@ { device = "/dev/disk/by-uuid/98de7ced-4d7c-4915-bf5b-1a0300458ea6"; } ]; + services.prometheus.exporters.smartctl.devices = [ "/dev/nvme0n1" "/dev/nvme1n1" ]; + # GPU hardware.opengl = { package = pkgs.mesa.drivers; diff --git a/machines/koyomi/hardware-configuration.nix b/machines/koyomi/hardware-configuration.nix index c5d7647..72f9460 100644 --- a/machines/koyomi/hardware-configuration.nix +++ b/machines/koyomi/hardware-configuration.nix @@ -55,6 +55,8 @@ }; }; + services.prometheus.exporters.smartctl.devices = [ "/dev/nvme0n1" "/dev/nvme1n1" ]; + networking.useDHCP = false; networking.usePredictableInterfaceNames = false; systemd.network = { diff --git a/machines/mayushii/hardware-configuration.nix b/machines/mayushii/hardware-configuration.nix index f809403..f3d3a01 100644 --- a/machines/mayushii/hardware-configuration.nix +++ b/machines/mayushii/hardware-configuration.nix @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2021-2023 Simon Bruder +# SPDX-FileCopyrightText: 2021-2024 Simon Bruder # # SPDX-License-Identifier: AGPL-3.0-or-later @@ -45,6 +45,8 @@ }; }; + services.prometheus.exporters.smartctl.devices = [ "/dev/nvme0n1" ]; + powerManagement = { cpuFreqGovernor = "schedutil"; }; diff --git a/machines/renge/services/prometheus.nix b/machines/renge/services/prometheus.nix index 5c617db..347b016 100644 --- a/machines/renge/services/prometheus.nix +++ b/machines/renge/services/prometheus.nix @@ -83,6 +83,22 @@ in regex = "(.*)\\.vpn\\.sbruder\\.de:9100"; }; } + { + job_name = "smartctl"; + static_configs = mkStaticTargets [ + "fuuko.vpn.sbruder.de:9633" + "mayushii.vpn.sbruder.de:9633" + "nunotaba.vpn.sbruder.de:9633" + "hitagi.vpn.sbruder.de:9633" + "shinobu.vpn.sbruder.de:9633" + "koyomi.vpn.sbruder.de:9633" + ]; + relabel_configs = lib.singleton { + target_label = "instance"; + source_labels = lib.singleton "__address__"; + regex = "(.*)\\.vpn\\.sbruder\\.de:9633"; + }; + } { job_name = "qbittorrent"; static_configs = mkStaticTargets [ diff --git a/modules/default.nix b/modules/default.nix index 905f12a..8281527 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -56,6 +56,7 @@ ./pipewire.nix ./podman.nix ./prometheus/node_exporter.nix + ./prometheus/smartctl_exporter.nix ./pubkeys.nix ./qbittorrent ./restic diff --git a/modules/prometheus/smartctl_exporter.nix b/modules/prometheus/smartctl_exporter.nix new file mode 100644 index 0000000..7938d35 --- /dev/null +++ b/modules/prometheus/smartctl_exporter.nix @@ -0,0 +1,22 @@ +# SPDX-FileCopyrightText: 2020-2024 Simon Bruder +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +{ config, lib, ... }: + +{ + services.prometheus.exporters.smartctl = { + enable = config.sbruder.wireguard.home.enable && !config.sbruder.machine.isVm; + listenAddress = config.sbruder.wireguard.home.address; + # devices need to be specified for all systems that use NVMe + # https://github.com/NixOS/nixpkgs/issues/210041 + }; + + systemd.services.prometheus-smartctl-exporter = { + after = [ "wireguard-wg-home.service" ]; + serviceConfig = { + IPAddressAllow = lib.singleton config.sbruder.wireguard.home.subnet; + IPAddressDeny = "any"; + }; + }; +}