nixpkgs/nixos/modules/services/monitoring/prometheus/exporters/influxdb.nix
Pyrox ae359d1ef2
nixos/prometheus/exporters: Remove all with lib; usage
Fixes issues described in #208242 for this part of the nixpkgs tree.

There are no behavioral changes in this, it only adjusts the code so
that it is easier to understand.
2024-04-24 14:42:16 -04:00

34 lines
911 B
Nix

{ config, lib, pkgs, options, ... }:
let
cfg = config.services.prometheus.exporters.influxdb;
inherit (lib) mkOption types concatStringsSep;
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}
'';
};
};
}