summary refs log tree commit diff
path: root/nixos/modules/services/monitoring/prometheus/exporters/influxdb.nix
blob: ba45173e946a5bb60c916ae40787890750a23ea0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{ config, lib, pkgs, options }:

with lib;

let
  cfg = config.services.prometheus.exporters.influxdb;
in
{
  port = 9122;
  extraOpts = {
    sampleExpiry = mkOption {
      type = types.str;
      default = "5m";
      example = "10m";
      description = "How long a sample is valid for";
    };
    udpBindAddress = mkOption {
      type = types.str;
      default = ":9122";
      example = "192.0.2.1:9122";
      description = "Address on which to listen for udp packets";
    };
  };
  serviceOpts = {
    serviceConfig = {
      RuntimeDirectory = "prometheus-influxdb-exporter";
      ExecStart = ''
        ${pkgs.prometheus-influxdb-exporter}/bin/influxdb_exporter \
        --web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
        --influxdb.sample-expiry ${cfg.sampleExpiry} ${concatStringsSep " " cfg.extraFlags}
      '';
    };
  };
}