Merge pull request #65225 from Ma27/bump-prometheus-wireguard-exporter

prometheus-wireguard-exporter: 2.0.1 -> 3.0.0
This commit is contained in:
Franz Pletz 2019-07-21 20:19:22 +00:00 committed by GitHub
commit bc418837d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 6 deletions

View File

@ -23,12 +23,24 @@ in {
to set the peers up. to set the peers up.
''; '';
}; };
singleSubnetPerField = mkOption {
type = types.bool;
default = false;
description = ''
By default, all allowed IPs and subnets are comma-separated in the
<literal>allowed_ips</literal> field. With this option enabled,
a single IP and subnet will be listed in fields like <literal>allowed_ip_0</literal>,
<literal>allowed_ip_1</literal> and so on.
'';
};
}; };
serviceOpts = { serviceOpts = {
script = '' script = ''
${pkgs.prometheus-wireguard-exporter}/bin/prometheus_wireguard_exporter \ ${pkgs.prometheus-wireguard-exporter}/bin/prometheus_wireguard_exporter \
-p ${toString cfg.port} \ -p ${toString cfg.port} \
${optionalString cfg.verbose "-v"} \ ${optionalString cfg.verbose "-v"} \
${optionalString cfg.singleSubnetPerField "-s"} \
${optionalString (cfg.wireguardConfig != null) "-n ${cfg.wireguardConfig}"} ${optionalString (cfg.wireguardConfig != null) "-n ${cfg.wireguardConfig}"}
''; '';

View File

@ -331,11 +331,12 @@ let
inherit (snakeoil.peer1) publicKey; inherit (snakeoil.peer1) publicKey;
}; };
}; };
systemd.services.prometheus-wireguard-exporter.after = [ "wireguard-wg0.service" ];
}; };
exporterTest = '' exporterTest = ''
waitForUnit("prometheus-wireguard-exporter.service"); waitForUnit("prometheus-wireguard-exporter.service");
waitForOpenPort(9586); waitForOpenPort(9586);
succeed("curl -sSf http://localhost:9586/metrics | grep '${snakeoil.peer1.publicKey}'"); waitUntilSucceeds("curl -sSf http://localhost:9586/metrics | grep '${snakeoil.peer1.publicKey}'");
''; '';
}; };
}; };

View File

@ -2,21 +2,19 @@
rustPlatform.buildRustPackage rec { rustPlatform.buildRustPackage rec {
pname = "wireguard-exporter"; pname = "wireguard-exporter";
version = "2.0.1"; version = "3.0.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "MindFlavor"; owner = "MindFlavor";
repo = "prometheus_wireguard_exporter"; repo = "prometheus_wireguard_exporter";
rev = version; rev = version;
sha256 = "11yrry8fzalcigqsx1wx371w543gdcsx48fd7dacbrsfl2dk2azp"; sha256 = "1vgwsg81xcxh7pcdc667mfviwwpzsm4lpllykf78vfahi9qmwffn";
}; };
cargoSha256 = "1wnk39p144zjsdhnyjk6y41xs448bxnbbxkqk53r6i2f2wzrsk2m"; cargoSha256 = "06s9194lvwd7lynxnsrjfbjfj87ngvjbqjhx3idf7d1w9mgi4ysw";
buildInputs = lib.optional stdenv.isDarwin Security; buildInputs = lib.optional stdenv.isDarwin Security;
doCheck = false;
meta = with lib; { meta = with lib; {
description = "A Prometheus exporter for WireGuard, written in Rust."; description = "A Prometheus exporter for WireGuard, written in Rust.";
license = licenses.mit; license = licenses.mit;