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