summaryrefslogtreecommitdiffstats
path: root/nixos/modules/services/monitoring/prometheus/exporters/mpd.nix
blob: 7b459d86a07d4e1eb3974eb1fd2a585004e4d7ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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}
  '';
}