summaryrefslogtreecommitdiff
path: root/modules/prometheus-lvm-exporter.nix
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2022-12-29 20:45:46 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2022-12-29 20:45:46 +0100
commitb861d607deb155465dfc95bbc5f79843c1dc0036 (patch)
treebe56098ab8a6e845889c46d18e475cbf69bb202f /modules/prometheus-lvm-exporter.nix
parent9daef214fc1a4ca91c3946262f87576797a0e65a (diff)
downloadnixos-b861d607deb155465dfc95bbc5f79843c1dc0036.tar
nixos-b861d607deb155465dfc95bbc5f79843c1dc0036.tar.gz
nixos-b861d607deb155465dfc95bbc5f79843c1dc0036.tar.bz2
nixos-b861d607deb155465dfc95bbc5f79843c1dc0036.tar.xz
nixos-b861d607deb155465dfc95bbc5f79843c1dc0036.zip
...
Diffstat (limited to 'modules/prometheus-lvm-exporter.nix')
-rw-r--r--modules/prometheus-lvm-exporter.nix10
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}