diff options
author | Matt Layher <mdlayher@gmail.com> | 2020-06-10 14:13:07 -0400 |
---|---|---|
committer | Matt Layher <mdlayher@gmail.com> | 2020-06-10 17:33:41 -0400 |
commit | e45146d94bf6d27cbde107e82a2520b007344055 (patch) | |
tree | 94efe2cbf2db430fe48809a9ccd15bf6df23a371 /nixos/modules | |
parent | 9930b8fd3d98a6d44c4518a10056ee0b9f0866fc (diff) | |
download | nixlib-e45146d94bf6d27cbde107e82a2520b007344055.tar nixlib-e45146d94bf6d27cbde107e82a2520b007344055.tar.gz nixlib-e45146d94bf6d27cbde107e82a2520b007344055.tar.bz2 nixlib-e45146d94bf6d27cbde107e82a2520b007344055.tar.lz nixlib-e45146d94bf6d27cbde107e82a2520b007344055.tar.xz nixlib-e45146d94bf6d27cbde107e82a2520b007344055.tar.zst nixlib-e45146d94bf6d27cbde107e82a2520b007344055.zip |
nixos/prometheus-apcupsd-exporter: new module
Signed-off-by: Matt Layher <mdlayher@gmail.com>
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/services/monitoring/prometheus/exporters.nix | 1 | ||||
-rw-r--r-- | nixos/modules/services/monitoring/prometheus/exporters/apcupsd.nix | 38 |
2 files changed, 39 insertions, 0 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/exporters.nix b/nixos/modules/services/monitoring/prometheus/exporters.nix index f9ad1457fc85..18a714360cf0 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters.nix @@ -21,6 +21,7 @@ let # `serviceOpts.script` or `serviceOpts.serviceConfig.ExecStart` exporterOpts = genAttrs [ + "apcupsd" "bind" "blackbox" "collectd" diff --git a/nixos/modules/services/monitoring/prometheus/exporters/apcupsd.nix b/nixos/modules/services/monitoring/prometheus/exporters/apcupsd.nix new file mode 100644 index 000000000000..57c35a742c5f --- /dev/null +++ b/nixos/modules/services/monitoring/prometheus/exporters/apcupsd.nix @@ -0,0 +1,38 @@ +{ 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 = '' + Address of the apcupsd Network Information Server (NIS). + ''; + }; + + apcupsdNetwork = mkOption { + type = types.enum ["tcp" "tcp4" "tcp6"]; + default = "tcp"; + description = '' + 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} + ''; + }; + }; +} |