-
-
Notifications
You must be signed in to change notification settings - Fork 14k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nixos/prometheus.exporters.dnssec: init module
- Loading branch information
Sebastian Wendel
authored and
Sebastian Wendel
committed
Apr 12, 2024
1 parent
33d6119
commit 8737490
Showing
4 changed files
with
141 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ let | |
"collectd" | ||
"dmarc" | ||
"dnsmasq" | ||
"dnssec" | ||
"domain" | ||
"dovecot" | ||
"fastly" | ||
|
90 changes: 90 additions & 0 deletions
90
nixos/modules/services/monitoring/prometheus/exporters/dnssec.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
{ config, lib, pkgs, ... }: | ||
let | ||
cfg = config.services.prometheus.exporters.dnssec; | ||
configFormat = pkgs.formats.toml { }; | ||
configFile = configFormat.generate "dnssec-checks.toml" cfg.configuration; | ||
in { | ||
port = 9204; | ||
extraOpts = { | ||
configuration = lib.mkOption { | ||
type = lib.types.nullOr lib.types.attrs; | ||
default = null; | ||
description = '' | ||
dnssec exporter configuration as nix attribute set. | ||
See <https://github.com/chrj/prometheus-dnssec-exporter/blob/master/README.md> | ||
for the description of the configuration file format. | ||
''; | ||
example = lib.literalExpression '' | ||
{ | ||
records = [ | ||
{ | ||
zone = "ietf.org"; | ||
record = "@"; | ||
type = "SOA"; | ||
} | ||
{ | ||
zone = "verisigninc.com"; | ||
record = "@"; | ||
type = "SOA"; | ||
} | ||
]; | ||
} | ||
''; | ||
}; | ||
|
||
listenAddress = lib.mkOption { | ||
type = lib.types.nullOr lib.types.str; | ||
default = null; | ||
description = '' | ||
Listen address as host IP and port definition. | ||
''; | ||
example = ":9204"; | ||
}; | ||
|
||
resolvers = lib.mkOption { | ||
type = lib.types.listOf lib.types.str; | ||
default = [ ]; | ||
description = '' | ||
DNSSEC capable resolver to be used for the check. | ||
''; | ||
example = [ "0.0.0.0:53" ]; | ||
}; | ||
|
||
timeout = lib.mkOption { | ||
type = lib.types.nullOr lib.types.str; | ||
default = null; | ||
description = '' | ||
DNS request timeout duration. | ||
''; | ||
example = "10s"; | ||
}; | ||
|
||
extraFlags = lib.mkOption { | ||
type = lib.types.listOf lib.types.str; | ||
default = [ ]; | ||
description = '' | ||
Extra commandline options when launching Prometheus. | ||
''; | ||
}; | ||
}; | ||
|
||
serviceOpts = { | ||
serviceConfig = let | ||
startScript = pkgs.writeShellScriptBin "prometheus-dnssec-exporter-start" | ||
"${lib.concatStringsSep " " | ||
([ "${pkgs.prometheus-dnssec-exporter}/bin/prometheus-dnssec-exporter" ] | ||
++ lib.optionals (cfg.configuration != null) | ||
[ "-config ${configFile}" ] | ||
++ lib.optionals (cfg.listenAddress != null) | ||
[ "-listen-address ${lib.escapeShellArg cfg.listenAddress}" ] | ||
++ lib.optionals (cfg.resolvers != [ ]) [ | ||
"-resolvers ${ | ||
lib.escapeShellArg (lib.concatStringsSep "," cfg.resolvers) | ||
}" | ||
] ++ lib.optionals (cfg.timeout != null) | ||
[ "-timeout ${lib.escapeShellArg cfg.timeout}" ] ++ cfg.extraFlags)}"; | ||
in { ExecStart = lib.getExe startScript; }; | ||
}; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters