0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-09 20:16:16 +03:00
nixpkgs/nixos/modules/services/monitoring/prometheus/exporters/apcupsd.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

38 lines
971 B
Nix

{ config, lib, pkgs, options, ... }:
with lib;
let
cfg = config.services.prometheus.exporters.apcupsd;
in
{
port = 9162;
extraOpts = {
apcupsdAddress = mkOption {
type = types.str;
default = ":3551";
description = lib.mdDoc ''
Address of the apcupsd Network Information Server (NIS).
'';
};
apcupsdNetwork = mkOption {
type = types.enum ["tcp" "tcp4" "tcp6"];
default = "tcp";
description = lib.mdDoc ''
Network of the apcupsd Network Information Server (NIS): one of "tcp", "tcp4", or "tcp6".
'';
};
};
serviceOpts = {
serviceConfig = {
ExecStart = ''
${pkgs.prometheus-apcupsd-exporter}/bin/apcupsd_exporter \
-telemetry.addr ${cfg.listenAddress}:${toString cfg.port} \
-apcupsd.addr ${cfg.apcupsdAddress} \
-apcupsd.network ${cfg.apcupsdNetwork} \
${concatStringsSep " \\\n " cfg.extraFlags}
'';
};
};
}