2019-07-17 05:19:18 -07:00
|
|
|
{ config, lib, pkgs, options }:
|
2018-03-09 12:33:09 -08:00
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.prometheus.exporters.fritzbox;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
port = 9133;
|
|
|
|
extraOpts = {
|
|
|
|
gatewayAddress = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "fritz.box";
|
|
|
|
description = ''
|
|
|
|
The hostname or IP of the FRITZ!Box.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
gatewayPort = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = 49000;
|
|
|
|
description = ''
|
|
|
|
The port of the FRITZ!Box UPnP service.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
serviceOpts = {
|
|
|
|
serviceConfig = {
|
|
|
|
ExecStart = ''
|
2019-05-31 09:50:27 -07:00
|
|
|
${pkgs.prometheus-fritzbox-exporter}/bin/exporter \
|
2018-03-09 12:33:09 -08:00
|
|
|
-listen-address ${cfg.listenAddress}:${toString cfg.port} \
|
|
|
|
-gateway-address ${cfg.gatewayAddress} \
|
|
|
|
-gateway-port ${toString cfg.gatewayPort} \
|
|
|
|
${concatStringsSep " \\\n " cfg.extraFlags}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|