1{ 2 config, 3 lib, 4 pkgs, 5 options, 6 ... 7}: 8 9let 10 cfg = config.services.prometheus.exporters.influxdb; 11 inherit (lib) mkOption types concatStringsSep; 12in 13{ 14 port = 9122; 15 extraOpts = { 16 sampleExpiry = mkOption { 17 type = types.str; 18 default = "5m"; 19 example = "10m"; 20 description = "How long a sample is valid for"; 21 }; 22 udpBindAddress = mkOption { 23 type = types.str; 24 default = ":9122"; 25 example = "192.0.2.1:9122"; 26 description = "Address on which to listen for udp packets"; 27 }; 28 }; 29 serviceOpts = { 30 serviceConfig = { 31 RuntimeDirectory = "prometheus-influxdb-exporter"; 32 ExecStart = '' 33 ${pkgs.prometheus-influxdb-exporter}/bin/influxdb_exporter \ 34 --web.listen-address ${cfg.listenAddress}:${toString cfg.port} \ 35 --influxdb.sample-expiry ${cfg.sampleExpiry} ${concatStringsSep " " cfg.extraFlags} 36 ''; 37 }; 38 }; 39}