prometheus-bird-exporter: init at 1.3.5-git

This commit is contained in:
Luke Granger-Brown 2021-01-01 04:43:59 +00:00
parent 9960088893
commit 699e402705
5 changed files with 97 additions and 0 deletions

View file

@ -23,6 +23,7 @@ let
exporterOpts = genAttrs [
"apcupsd"
"bind"
"bird"
"blackbox"
"collectd"
"dnsmasq"

View file

@ -0,0 +1,46 @@
{ config, lib, pkgs, options }:
with lib;
let
cfg = config.services.prometheus.exporters.bird;
in
{
port = 9324;
extraOpts = {
birdVersion = mkOption {
type = types.enum [ 1 2 ];
default = 2;
description = ''
Specifies whether BIRD1 or BIRD2 is in use.
'';
};
birdSocket = mkOption {
type = types.path;
default = "/var/run/bird.ctl";
description = ''
Path to BIRD2 (or BIRD1 v4) socket.
'';
};
newMetricFormat = mkOption {
type = types.bool;
default = true;
description = ''
Enable the new more-generic metric format.
'';
};
};
serviceOpts = {
serviceConfig = {
SupplementaryGroups = singleton (if cfg.birdVersion == 1 then "bird" else "bird2");
ExecStart = ''
${pkgs.prometheus-bird-exporter}/bin/bird_exporter \
-web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
-bird.socket ${cfg.birdSocket} \
-bird.v2=${if cfg.birdVersion == 2 then "true" else "false"} \
-format.new=${if cfg.newMetricFormat then "true" else "false"} \
${concatStringsSep " \\\n " cfg.extraFlags}
'';
};
};
}

View file

@ -96,6 +96,31 @@ let
'';
};
bird = {
exporterConfig = {
enable = true;
};
metricProvider = {
services.bird2.enable = true;
services.bird2.config = ''
protocol kernel MyObviousTestString {
ipv4 {
import all;
export none;
};
}
protocol device {
}
'';
};
exporterTest = ''
wait_for_unit("prometheus-bird-exporter.service")
wait_for_open_port(9324)
succeed("curl -sSf http://localhost:9324/metrics | grep -q 'MyObviousTestString'")
'';
};
blackbox = {
exporterConfig = {
enable = true;

View file

@ -0,0 +1,24 @@
{ stdenv, buildGoModule, fetchFromGitHub, nixosTests }:
buildGoModule rec {
pname = "bird-exporter";
version = "1.3.5-git";
src = fetchFromGitHub {
owner = "czerwonk";
repo = "bird_exporter";
rev = "019fc09804625658d452a8e043cc16559c3b5b84";
sha256 = "1iym46368k8zzy4djx511m926dg8x5mg3xi91f65sknqv26zfggb";
};
vendorSha256 = null;
passthru.tests = { inherit (nixosTests.prometheus-exporters) bird; };
meta = with stdenv.lib; {
description = "Prometheus exporter for the bird routing daemon";
homepage = "https://github.com/czerwonk/bird_exporter";
license = licenses.mit;
maintainers = with maintainers; [ lukegb ];
};
}

View file

@ -17672,6 +17672,7 @@ in
prometheus-apcupsd-exporter = callPackage ../servers/monitoring/prometheus/apcupsd-exporter.nix { };
prometheus-aws-s3-exporter = callPackage ../servers/monitoring/prometheus/aws-s3-exporter.nix { };
prometheus-bind-exporter = callPackage ../servers/monitoring/prometheus/bind-exporter.nix { };
prometheus-bird-exporter = callPackage ../servers/monitoring/prometheus/bird-exporter.nix { };
prometheus-blackbox-exporter = callPackage ../servers/monitoring/prometheus/blackbox-exporter.nix { };
prometheus-collectd-exporter = callPackage ../servers/monitoring/prometheus/collectd-exporter.nix { };
prometheus-cups-exporter = callPackage ../servers/monitoring/prometheus/cups-exporter.nix { };