summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2021-01-03 20:50:32 +0100
committerMatthias Beyer <mail@beyermatthias.de>2021-02-01 15:24:37 +0100
commit7b2fe9de05f43ebb9b20bcf3e03691c96ba6efef (patch)
treea48d07e3a4309516ebc6d39886b0be0775ced3e5
parent1402c588cb66d7e2c8a83b9137f6ee90a4c5f9de (diff)
Add prometheus-mpd-exporter serviceinit-prometheus-mpd-exporter
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters/mpd.nix51
1 files changed, 51 insertions, 0 deletions
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}
+ '';
+}
+