nixpkgs/nixos/modules/services/monitoring/prometheus/exporters/fritzbox.nix
Martin Weinelt d702c91302
nixos/prometheus/exporters: pass utils into exporter modules
This is useful, because it provides escapeSystemdShellArgs.
2024-03-21 05:27:21 +01:00

39 lines
879 B
Nix

{ config, lib, pkgs, options, ... }:
with lib;
let
cfg = config.services.prometheus.exporters.fritzbox;
in
{
port = 9133;
extraOpts = {
gatewayAddress = mkOption {
type = types.str;
default = "fritz.box";
description = lib.mdDoc ''
The hostname or IP of the FRITZ!Box.
'';
};
gatewayPort = mkOption {
type = types.int;
default = 49000;
description = lib.mdDoc ''
The port of the FRITZ!Box UPnP service.
'';
};
};
serviceOpts = {
serviceConfig = {
ExecStart = ''
${pkgs.prometheus-fritzbox-exporter}/bin/exporter \
-listen-address ${cfg.listenAddress}:${toString cfg.port} \
-gateway-address ${cfg.gatewayAddress} \
-gateway-port ${toString cfg.gatewayPort} \
${concatStringsSep " \\\n " cfg.extraFlags}
'';
};
};
}