Skip to content

Commit c161f61

Browse files
prometheus-frr-exporter: init prometheus exporter module (#313651)
2 parents 145137c + 578c5b6 commit c161f61

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

nixos/modules/services/monitoring/prometheus/exporters.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ let
4040
"flow"
4141
"fritz"
4242
"fritzbox"
43+
"frr"
4344
"graphite"
4445
"idrac"
4546
"imap-mailstat"
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
config,
3+
lib,
4+
pkgs,
5+
...
6+
}:
7+
8+
let
9+
cfg = config.services.prometheus.exporters.frr;
10+
inherit (lib)
11+
mkOption
12+
types
13+
concatStringsSep
14+
concatMapStringsSep
15+
;
16+
in
17+
{
18+
port = 9342;
19+
extraOpts = {
20+
enabledCollectors = mkOption {
21+
type = types.listOf types.str;
22+
default = [ ];
23+
example = [ "vrrp" ];
24+
description = ''
25+
Collectors to enable. The collectors listed here are enabled in addition to the default ones.
26+
'';
27+
};
28+
disabledCollectors = mkOption {
29+
type = types.listOf types.str;
30+
default = [ ];
31+
example = [ "bfd" ];
32+
description = ''
33+
Collectors to disable which are enabled by default.
34+
'';
35+
};
36+
};
37+
serviceOpts = {
38+
serviceConfig = {
39+
DynamicUser = false;
40+
RuntimeDirectory = "prometheus-frr-exporter";
41+
ExecStart = ''
42+
${lib.getExe pkgs.prometheus-frr-exporter} \
43+
${concatMapStringsSep " " (x: "--collector." + x) cfg.enabledCollectors} \
44+
${concatMapStringsSep " " (x: "--no-collector." + x) cfg.disabledCollectors} \
45+
--web.listen-address ${cfg.listenAddress}:${toString cfg.port} ${concatStringsSep " " cfg.extraFlags}
46+
'';
47+
};
48+
};
49+
}

0 commit comments

Comments
 (0)