nixos/prometheus/storagebox: Init module

Changed files
+65
nixos
doc
manual
release-notes
modules
services
monitoring
prometheus
tests
+2
nixos/doc/manual/release-notes/rl-2511.section.md
···
- [SuiteNumérique Meet](https://github.com/suitenumerique/meet) is an open source alternative to Google Meet and Zoom powered by LiveKit: HD video calls, screen sharing, and chat features. Built with Django and React. Available as [services.lasuite-meet](#opt-services.lasuite-meet.enable).
- [lemurs](https://github.com/coastalwhite/lemurs), a customizable TUI display/login manager. Available at [services.displayManager.lemurs](#opt-services.displayManager.lemurs.enable).
- [paisa](https://github.com/ananthakumaran/paisa), a personal finance tracker and dashboard. Available as [services.paisa](#opt-services.paisa.enable).
···
- [SuiteNumérique Meet](https://github.com/suitenumerique/meet) is an open source alternative to Google Meet and Zoom powered by LiveKit: HD video calls, screen sharing, and chat features. Built with Django and React. Available as [services.lasuite-meet](#opt-services.lasuite-meet.enable).
+
- [Prometheus Storagebox Exporter](https://github.com/fleaz/prometheus-storagebox-exporter), a Prometheus exporter for Hetzner storage boxes.
+
- [lemurs](https://github.com/coastalwhite/lemurs), a customizable TUI display/login manager. Available at [services.displayManager.lemurs](#opt-services.displayManager.lemurs.enable).
- [paisa](https://github.com/ananthakumaran/paisa), a personal finance tracker and dashboard. Available as [services.paisa](#opt-services.paisa.enable).
+1
nixos/modules/services/monitoring/prometheus/exporters.nix
···
"snmp"
"sql"
"statsd"
"surfboard"
"systemd"
"tibber"
···
"snmp"
"sql"
"statsd"
+
"storagebox"
"surfboard"
"systemd"
"tibber"
+47
nixos/modules/services/monitoring/prometheus/exporters/storagebox.nix
···
···
+
{
+
config,
+
lib,
+
pkgs,
+
options,
+
...
+
}:
+
+
let
+
cfg = config.services.prometheus.exporters.storagebox;
+
inherit (lib) mkPackageOption;
+
in
+
{
+
port = 9509;
+
extraOpts = {
+
package = mkPackageOption pkgs "prometheus-storagebox-exporter" { };
+
tokenFile = lib.mkOption {
+
type = lib.types.pathWith {
+
inStore = false;
+
absolute = true;
+
};
+
description = "File that contains the Hetzner API token to use.";
+
};
+
+
};
+
serviceOpts = {
+
after = [ "network.target" ];
+
wantedBy = [ "multi-user.target" ];
+
script = ''
+
export HETZNER_TOKEN=$(< "''${CREDENTIALS_DIRECTORY}/token")
+
exec ${lib.getExe cfg.package}
+
'';
+
+
environment = {
+
LISTEN_ADDR = "${toString cfg.listenAddress}:${toString cfg.port}";
+
};
+
+
serviceConfig = {
+
DynamicUser = true;
+
Restart = "always";
+
RestartSec = "10s";
+
LoadCredential = [
+
"token:${cfg.tokenFile}"
+
];
+
};
+
};
+
}
+15
nixos/tests/prometheus-exporters.nix
···
'';
};
snmp = {
exporterConfig = {
enable = true;
···
'';
};
+
storagebox = {
+
exporterConfig = {
+
enable = true;
+
tokenFile = "/tmp/faketoken";
+
};
+
exporterTest = ''
+
succeed(
+
'echo faketoken > /tmp/faketoken'
+
)
+
wait_for_unit("prometheus-storagebox-exporter.service")
+
wait_for_open_port(9509)
+
succeed("curl -sSf localhost:9509/metrics | grep 'process_open_fds'")
+
'';
+
};
+
snmp = {
exporterConfig = {
enable = true;