nixos/prometheus-wireguard-exporter: Add a new option to export wireguard_latest_handshake_delay_seconds. (#419815)

This commit is contained in:
Franz Pletz
2025-06-30 12:25:18 +02:00
committed by GitHub

View File

@@ -62,6 +62,14 @@ in
Whether or not the remote IP of a WireGuard peer should be exposed via prometheus. Whether or not the remote IP of a WireGuard peer should be exposed via prometheus.
''; '';
}; };
latestHandshakeDelay = mkOption {
type = types.bool;
default = false;
description = ''
Adds the `wireguard_latest_handshake_delay_seconds` metric that automatically calculates the seconds passed since the last handshake.
'';
};
}; };
serviceOpts = { serviceOpts = {
path = [ pkgs.wireguard-tools ]; path = [ pkgs.wireguard-tools ];
@@ -76,6 +84,7 @@ in
${optionalString cfg.verbose "-v true"} \ ${optionalString cfg.verbose "-v true"} \
${optionalString cfg.singleSubnetPerField "-s true"} \ ${optionalString cfg.singleSubnetPerField "-s true"} \
${optionalString cfg.withRemoteIp "-r true"} \ ${optionalString cfg.withRemoteIp "-r true"} \
${optionalString cfg.latestHandshakeDelay "-d true"} \
${optionalString (cfg.wireguardConfig != null) "-n ${escapeShellArg cfg.wireguardConfig}"} ${optionalString (cfg.wireguardConfig != null) "-n ${escapeShellArg cfg.wireguardConfig}"}
''; '';
RestrictAddressFamilies = [ RestrictAddressFamilies = [