nixos/prometheus-wireguard-exporter: add support for `-r` switch

With this switch activated, the exporter also exposes the remote IP of
each active WireGuard peer.
This commit is contained in:
Maximilian Bosch 2019-08-08 21:54:49 +02:00
parent e80b0b2b22
commit 41b9c5f1da
No known key found for this signature in database
GPG Key ID: 091DBF4D1FC46B8E
1 changed files with 9 additions and 0 deletions

View File

@ -34,6 +34,14 @@ in {
<literal>allowed_ip_1</literal> and so on.
'';
};
withRemoteIp = mkOption {
type = types.bool;
default = false;
description = ''
Whether or not the remote IP of a WireGuard peer should be exposed via prometheus.
'';
};
};
serviceOpts = {
path = [ pkgs.wireguard-tools ];
@ -45,6 +53,7 @@ in {
-p ${toString cfg.port} \
${optionalString cfg.verbose "-v"} \
${optionalString cfg.singleSubnetPerField "-s"} \
${optionalString cfg.withRemoteIp "-r"} \
${optionalString (cfg.wireguardConfig != null) "-n ${cfg.wireguardConfig}"}
'';
};