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