mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 06:45:16 +01:00
nixos/prometheus/exporters/knot: init
This commit is contained in:
parent
bae2759a37
commit
b4bd584b64
3 changed files with 69 additions and 0 deletions
|
@ -31,6 +31,7 @@ let
|
|||
"fritzbox"
|
||||
"json"
|
||||
"keylight"
|
||||
"knot"
|
||||
"lnd"
|
||||
"mail"
|
||||
"mikrotik"
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
{ config, lib, pkgs, options }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.prometheus.exporters.knot;
|
||||
in {
|
||||
port = 9433;
|
||||
extraOpts = {
|
||||
knotLibraryPath = mkOption {
|
||||
type = types.str;
|
||||
default = "${pkgs.knot-dns.out}/lib/libknot.so";
|
||||
defaultText = "\${pkgs.knot-dns}/lib/libknot.so";
|
||||
description = ''
|
||||
Path to the library of <package>knot-dns</package>.
|
||||
'';
|
||||
};
|
||||
|
||||
knotSocketPath = mkOption {
|
||||
type = types.str;
|
||||
default = "/run/knot/knot.sock";
|
||||
description = ''
|
||||
Socket path of <citerefentry><refentrytitle>knotd</refentrytitle>
|
||||
<manvolnum>8</manvolnum></citerefentry>.
|
||||
'';
|
||||
};
|
||||
|
||||
knotSocketTimeout = mkOption {
|
||||
type = types.int;
|
||||
default = 2000;
|
||||
description = ''
|
||||
Timeout in seconds.
|
||||
'';
|
||||
};
|
||||
};
|
||||
serviceOpts = {
|
||||
serviceConfig = {
|
||||
ExecStart = ''
|
||||
${pkgs.prometheus-knot-exporter}/bin/knot_exporter \
|
||||
--web-listen-addr ${cfg.listenAddress} \
|
||||
--web-listen-port ${toString cfg.port} \
|
||||
--knot-library-path ${cfg.knotLibraryPath} \
|
||||
--knot-socket-path ${cfg.knotSocketPath} \
|
||||
--knot-socket-timeout ${toString cfg.knotSocketTimeout} \
|
||||
${concatStringsSep " \\\n " cfg.extraFlags}
|
||||
'';
|
||||
SupplementaryGroups = [ "knot" ];
|
||||
};
|
||||
};
|
||||
}
|
|
@ -248,6 +248,24 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
knot = {
|
||||
exporterConfig = {
|
||||
enable = true;
|
||||
};
|
||||
metricProvider = {
|
||||
services.knot = {
|
||||
enable = true;
|
||||
extraArgs = [ "-v" ];
|
||||
};
|
||||
};
|
||||
exporterTest = ''
|
||||
wait_for_unit("knot.service")
|
||||
wait_for_unit("prometheus-knot-exporter.service")
|
||||
wait_for_open_port(9433)
|
||||
succeed("curl -sSf 'localhost:9433' | grep -q 'knot_server_zone_count 0.0'")
|
||||
'';
|
||||
};
|
||||
|
||||
keylight = {
|
||||
# A hardware device is required to properly test this exporter, so just
|
||||
# perform a couple of basic sanity checks that the exporter is running
|
||||
|
|
Loading…
Reference in a new issue