nixpkgs/nixos/modules/services/monitoring/prometheus/exporters/scaphandre.nix
Martin Weinelt d702c91302
nixos/prometheus/exporters: pass utils into exporter modules
This is useful, because it provides escapeSystemdShellArgs.
2024-03-21 05:27:21 +01:00

35 lines
711 B
Nix

{ config
, lib
, pkgs
, options
, ...
}:
let
logPrefix = "services.prometheus.exporter.scaphandre";
cfg = config.services.prometheus.exporters.scaphandre;
in {
port = 8080;
extraOpts = {
telemetryPath = lib.mkOption {
type = lib.types.str;
default = "/metrics";
description = lib.mdDoc ''
Path under which to expose metrics.
'';
};
};
serviceOpts = {
serviceConfig = {
ExecStart = ''
${pkgs.scaphandre}/bin/scaphandre prometheus \
--address ${cfg.listenAddress} \
--port ${toString cfg.port} \
--suffix ${cfg.telemetryPath} \
${lib.concatStringsSep " \\\n " cfg.extraFlags}
'';
};
};
}