prometheus-wireguard-exporter: init at 2.0.1
This is a simple exporter which exports the information provided by `wg show all dump` to prometheus. Co-authored-by: Franz Pletz <fpletz@fnordicwalking.de>
This commit is contained in:
co-authored by
Franz Pletz
parent
b7d1bd8efb
commit
bf09e6a14e
@@ -34,6 +34,7 @@ let
|
||||
unifi = import ./exporters/unifi.nix { inherit config lib pkgs; };
|
||||
varnish = import ./exporters/varnish.nix { inherit config lib pkgs; };
|
||||
bind = import ./exporters/bind.nix { inherit config lib pkgs; };
|
||||
wireguard = import ./exporters/wireguard.nix { inherit config lib pkgs; };
|
||||
};
|
||||
|
||||
mkExporterOpts = ({ name, port }: {
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
{ config, lib, pkgs }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.prometheus.exporters.wireguard;
|
||||
in {
|
||||
port = 9586;
|
||||
extraOpts = {
|
||||
verbose = mkEnableOption "Verbose logging mode for prometheus-wireguard-exporter";
|
||||
|
||||
wireguardConfig = mkOption {
|
||||
type = with types; nullOr (either path str);
|
||||
default = null;
|
||||
|
||||
description = ''
|
||||
Path to the Wireguard Config to
|
||||
<link xlink:href="https://github.com/MindFlavor/prometheus_wireguard_exporter/tree/2.0.0#usage">add the peer's name to the stats of a peer</link>.
|
||||
|
||||
Please note that <literal>networking.wg-quick</literal> is required for this feature
|
||||
as <literal>networking.wireguard</literal> uses
|
||||
<citerefentry><refentrytitle>wg</refentrytitle><manvolnum>8</manvolnum></citerefentry>
|
||||
to set the peers up.
|
||||
'';
|
||||
};
|
||||
};
|
||||
serviceOpts = {
|
||||
script = ''
|
||||
${pkgs.prometheus-wireguard-exporter}/bin/prometheus_wireguard_exporter \
|
||||
-p ${toString cfg.port} \
|
||||
${optionalString cfg.verbose "-v"} \
|
||||
${optionalString (cfg.wireguardConfig != null) "-n ${cfg.wireguardConfig}"}
|
||||
'';
|
||||
|
||||
path = [ pkgs.wireguard-tools ];
|
||||
|
||||
serviceConfig = {
|
||||
DynamicUser = true;
|
||||
AmbientCapabilities = [ "CAP_NET_ADMIN" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user