fuuko: Add prometheus fritzbox exporter

This commit is contained in:
Simon Bruder 2021-03-05 19:49:44 +01:00
parent f388995ef6
commit 70ee44fbc5
Signed by: simon
GPG key ID: 8D3C82F9F309F8EC
3 changed files with 47 additions and 0 deletions

View file

@ -66,6 +66,10 @@ in
"vueko.vpn.sbruder.de:9100"
];
}
{
job_name = "fritzbox";
static_configs = mkStaticTarget "127.0.0.1:9133";
}
];
rules =
@ -113,7 +117,18 @@ in
};
})
];
exporters = {
fritzbox = {
enable = true;
gatewayAddress = "192.168.100.1";
listenAddress = "127.0.0.1";
};
};
};
# get rid of “could not call action: authorization required” every scrape
systemd.services.prometheus-fritzbox-exporter.serviceConfig.StandardOutput = "null";
krops.secrets.prometheus-htpasswd = {
group = "nginx";

View file

@ -18,6 +18,10 @@ in
aria2_exporter = import srcs.aria2_exporter { pkgs = self; };
# adapted nixpkgs upstream but changed to buildGoModule and updated to
# version that works in my setup
prometheus-fritzbox-exporter = super.callPackage ./prometheus-fritzbox-exporter { };
# FIXME: 21.05: Move to home-manager module package attribute
mpv-unwrapped = super.mpv-unwrapped.overrideAttrs (o: o // {
patches = [

View file

@ -0,0 +1,28 @@
{ stdenv, buildGoModule, fetchFromGitHub, nixosTests }:
buildGoModule rec {
pname = "fritzbox-exporter";
version = "unstable-2021-03-03";
rev = "6d66f6b8e47878c61feb710e36306fe714350658";
src = fetchFromGitHub {
inherit rev;
owner = "mxschmitt";
repo = "fritzbox_exporter";
sha256 = "0n9fwslcwgfghscrwbz7p3zamb474zk425ijkkh6cixpnc7p3vi6";
};
subPackages = [ "cmd/exporter" ];
vendorSha256 = "0k6bd052pjfg5c1ba1yhni8msv3wl512vfzy2hrk49jibh8h052n";
passthru.tests = { inherit (nixosTests.prometheus-exporters) fritzbox; };
meta = with stdenv.lib; {
description = "Prometheus Exporter for FRITZ!Box (TR64 and UPnP)";
homepage = "https://github.com/mxschmitt/fritzbox_exporter";
license = licenses.asl20;
maintainers = with maintainers; [ bachp flokli ];
platforms = platforms.unix;
};
}