1{ config, lib, pkgs, options }: 2 3with lib; 4 5let 6 cfg = config.services.prometheus.exporters.fritzbox; 7in 8{ 9 port = 9133; 10 extraOpts = { 11 gatewayAddress = mkOption { 12 type = types.str; 13 default = "fritz.box"; 14 description = lib.mdDoc '' 15 The hostname or IP of the FRITZ!Box. 16 ''; 17 }; 18 19 gatewayPort = mkOption { 20 type = types.int; 21 default = 49000; 22 description = lib.mdDoc '' 23 The port of the FRITZ!Box UPnP service. 24 ''; 25 }; 26 }; 27 serviceOpts = { 28 serviceConfig = { 29 ExecStart = '' 30 ${pkgs.prometheus-fritzbox-exporter}/bin/exporter \ 31 -listen-address ${cfg.listenAddress}:${toString cfg.port} \ 32 -gateway-address ${cfg.gatewayAddress} \ 33 -gateway-port ${toString cfg.gatewayPort} \ 34 ${concatStringsSep " \\\n " cfg.extraFlags} 35 ''; 36 }; 37 }; 38}