Merge pull request #108096 from lukegb/bird-exporter

prometheus-bird-exporter: init at 1.3.5-git

Changed files
+97
nixos
modules
services
monitoring
prometheus
tests
pkgs
servers
monitoring
prometheus
top-level
+1
nixos/modules/services/monitoring/prometheus/exporters.nix
···
exporterOpts = genAttrs [
"apcupsd"
"bind"
+
"bird"
"blackbox"
"collectd"
"dnsmasq"
+46
nixos/modules/services/monitoring/prometheus/exporters/bird.nix
···
+
{ 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}
+
'';
+
};
+
};
+
}
+25
nixos/tests/prometheus-exporters.nix
···
'';
};
+
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;
+24
pkgs/servers/monitoring/prometheus/bird-exporter.nix
···
+
{ 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 ];
+
};
+
}
+1
pkgs/top-level/all-packages.nix
···
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 { };