diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/prometheus-lvm-exporter.nix | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/modules/prometheus-lvm-exporter.nix b/modules/prometheus-lvm-exporter.nix index f1d3616a..fe5c4efa 100644 --- a/modules/prometheus-lvm-exporter.nix +++ b/modules/prometheus-lvm-exporter.nix | |||
@@ -10,8 +10,8 @@ in { | |||
10 | enable = mkEnableOption "Prometheus LVM exporter"; | 10 | enable = mkEnableOption "Prometheus LVM exporter"; |
11 | 11 | ||
12 | listenAddress = mkOption { | 12 | listenAddress = mkOption { |
13 | type = types.str; | 13 | type = types.nullOr types.str; |
14 | default = "localhost"; | 14 | default = null; |
15 | }; | 15 | }; |
16 | port = mkOption { | 16 | port = mkOption { |
17 | type = types.port; | 17 | type = types.port; |
@@ -47,11 +47,15 @@ in { | |||
47 | 47 | ||
48 | serviceConfig = { | 48 | serviceConfig = { |
49 | ExecStart = "${pkgs.prometheus-lvm-exporter}/bin/prometheus-lvm-exporter ${utils.escapeSystemdExecArgs [ | 49 | ExecStart = "${pkgs.prometheus-lvm-exporter}/bin/prometheus-lvm-exporter ${utils.escapeSystemdExecArgs [ |
50 | "--web.listen-address" "${cfg.listenAddress}:${toString cfg.port}" | 50 | "--web.systemd-socket" |
51 | ]}"; | 51 | ]}"; |
52 | 52 | ||
53 | Restart = "always"; | 53 | Restart = "always"; |
54 | }; | 54 | }; |
55 | }; | 55 | }; |
56 | |||
57 | systemd.sockets."prometheus-lvm-exporter" = { | ||
58 | socketConfig.ListenStream = "${optionalString (cfg.listenAddress != null) (cfg.listenAddress + ":")}${toString cfg.port}"; | ||
59 | }; | ||
56 | }; | 60 | }; |
57 | } | 61 | } |