From 7b2fe9de05f43ebb9b20bcf3e03691c96ba6efef Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 3 Jan 2021 20:50:32 +0100 Subject: Add prometheus-mpd-exporter service Signed-off-by: Matthias Beyer --- .../monitoring/prometheus/exporters/mpd.nix | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 nixos/modules/services/monitoring/prometheus/exporters/mpd.nix diff --git a/nixos/modules/services/monitoring/prometheus/exporters/mpd.nix b/nixos/modules/services/monitoring/prometheus/exporters/mpd.nix new file mode 100644 index 000000000000..7b459d86a07d --- /dev/null +++ b/nixos/modules/services/monitoring/prometheus/exporters/mpd.nix @@ -0,0 +1,51 @@ +{ config, lib, pkgs, options }: + +with lib; +let + cfg = config.services.prometheus.exporters.mpd; +in +{ + port = 9806; + extraOpts = { + port = mkOption { + type = types.port; + default = "9806"; + description = '' + Port to bind to + ''; + }; + + host = mkOption { + type = types.str; + default = "127.0.0.1"; + description = '' + Address to bind to + ''; + }; + + mpdPort = mkOption { + type = types.port; + default = 6600; + description = '' + Port of the MPD server + ''; + }; + + mpdHost = mkOption { + type = types.str; + default = "127.0.0.1"; + description = '' + Address of the MPD server + ''; + }; + + }; + + serviceOpts.serviceConfig.ExecStart = ''${pkgs.prometheus-mpd-exporter}/bin/prometheus-mpd-exporter \ + --bind-addr ${cfg.host} \ + --bind-port ${builtins.toString cfg.port} \ + --mpd-server-addr ${cfg.mpdHost} \ + --mpd-server-port ${builtins.toString cfg.mpdPort} + ''; +} + -- cgit v1.2.3