nixos/prometheus/storagebox: Init module
This commit is contained in:
@@ -116,6 +116,8 @@
|
||||
|
||||
- [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).
|
||||
|
||||
@@ -124,6 +124,7 @@ let
|
||||
"snmp"
|
||||
"sql"
|
||||
"statsd"
|
||||
"storagebox"
|
||||
"surfboard"
|
||||
"systemd"
|
||||
"tibber"
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
{
|
||||
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}"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1615,6 +1615,21 @@ let
|
||||
'';
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user