smartctl_exporter: Add

This commit is contained in:
Simon Bruder 2024-05-25 16:13:03 +02:00
parent 6a01f78adc
commit ecc2065201
Signed by: simon
GPG key ID: 347FF8699CDA0776
7 changed files with 50 additions and 3 deletions

View file

@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2021-2023 Simon Bruder <simon@sbruder.de> # SPDX-FileCopyrightText: 2021-2024 Simon Bruder <simon@sbruder.de>
# #
# SPDX-License-Identifier: AGPL-3.0-or-later # 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"; powerManagement.cpuFreqGovernor = "schedutil";
networking = { networking = {

View file

@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2020-2023 Simon Bruder <simon@sbruder.de> # SPDX-FileCopyrightText: 2020-2024 Simon Bruder <simon@sbruder.de>
# #
# SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-License-Identifier: AGPL-3.0-or-later
@ -55,6 +55,8 @@
{ device = "/dev/disk/by-uuid/98de7ced-4d7c-4915-bf5b-1a0300458ea6"; } { device = "/dev/disk/by-uuid/98de7ced-4d7c-4915-bf5b-1a0300458ea6"; }
]; ];
services.prometheus.exporters.smartctl.devices = [ "/dev/nvme0n1" "/dev/nvme1n1" ];
# GPU # GPU
hardware.opengl = { hardware.opengl = {
package = pkgs.mesa.drivers; package = pkgs.mesa.drivers;

View file

@ -55,6 +55,8 @@
}; };
}; };
services.prometheus.exporters.smartctl.devices = [ "/dev/nvme0n1" "/dev/nvme1n1" ];
networking.useDHCP = false; networking.useDHCP = false;
networking.usePredictableInterfaceNames = false; networking.usePredictableInterfaceNames = false;
systemd.network = { systemd.network = {

View file

@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2021-2023 Simon Bruder <simon@sbruder.de> # SPDX-FileCopyrightText: 2021-2024 Simon Bruder <simon@sbruder.de>
# #
# SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-License-Identifier: AGPL-3.0-or-later
@ -45,6 +45,8 @@
}; };
}; };
services.prometheus.exporters.smartctl.devices = [ "/dev/nvme0n1" ];
powerManagement = { powerManagement = {
cpuFreqGovernor = "schedutil"; cpuFreqGovernor = "schedutil";
}; };

View file

@ -83,6 +83,22 @@ in
regex = "(.*)\\.vpn\\.sbruder\\.de:9100"; 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"; job_name = "qbittorrent";
static_configs = mkStaticTargets [ static_configs = mkStaticTargets [

View file

@ -56,6 +56,7 @@
./pipewire.nix ./pipewire.nix
./podman.nix ./podman.nix
./prometheus/node_exporter.nix ./prometheus/node_exporter.nix
./prometheus/smartctl_exporter.nix
./pubkeys.nix ./pubkeys.nix
./qbittorrent ./qbittorrent
./restic ./restic

View file

@ -0,0 +1,22 @@
# SPDX-FileCopyrightText: 2020-2024 Simon Bruder <simon@sbruder.de>
#
# 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";
};
};
}