Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #302375 from SebastianWendel/init-prometheus-dnsse…
…c-exporter nixos/prometheus-dnssec-exporter: init
- Loading branch information
Showing
6 changed files
with
169 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
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
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,22 @@ | ||
{ lib, buildGoModule, fetchFromGitHub, }: | ||
buildGoModule { | ||
pname = "prometheus-dnssec-exporter"; | ||
version = "0-unstable-2023-03-05"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "chrj"; | ||
repo = "prometheus-dnssec-exporter"; | ||
rev = "b638685ed8d5919a88b45e85b3aec702f0fcc393"; | ||
hash = "sha256-SGoQKSgTRfSyA65xEZ9P7Z956sLMhB88h3HaXmFywiQ="; | ||
}; | ||
|
||
vendorHash = "sha256-u7X8v7h1aL8B1el4jFzGRKHvnaK+Rz0OCitaC6xgyjw="; | ||
|
||
meta = with lib; { | ||
homepage = "https://github.com/chrj/prometheus-dnssec-exporter"; | ||
description = "DNSSEC Exporter for Prometheus"; | ||
license = licenses.mit; | ||
maintainers = with maintainers; [ swendel ]; | ||
}; | ||
} | ||
|