nixos/prometheus-domain-exporter: init
This commit is contained in:
parent
2c76567af3
commit
6840746f2d
|
@ -28,6 +28,7 @@ let
|
||||||
"blackbox"
|
"blackbox"
|
||||||
"collectd"
|
"collectd"
|
||||||
"dnsmasq"
|
"dnsmasq"
|
||||||
|
"domain"
|
||||||
"dovecot"
|
"dovecot"
|
||||||
"fritzbox"
|
"fritzbox"
|
||||||
"json"
|
"json"
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
{ config, lib, pkgs, options }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.services.prometheus.exporters.domain;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
port = 9222;
|
||||||
|
serviceOpts = {
|
||||||
|
serviceConfig = {
|
||||||
|
ExecStart = ''
|
||||||
|
${pkgs.prometheus-domain-exporter}/bin/domain_exporter \
|
||||||
|
--bind ${cfg.listenAddress}:${toString cfg.port} \
|
||||||
|
${concatStringsSep " \\\n " cfg.extraFlags}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -201,6 +201,22 @@ let
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Access to WHOIS server is required to properly test this exporter, so
|
||||||
|
# just perform basic sanity check that the exporter is running and returns
|
||||||
|
# a failure.
|
||||||
|
domain = {
|
||||||
|
exporterConfig = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
exporterTest = ''
|
||||||
|
wait_for_unit("prometheus-domain-exporter.service")
|
||||||
|
wait_for_open_port(9222)
|
||||||
|
succeed(
|
||||||
|
"curl -sSf 'http://localhost:9222/probe?target=nixos.org' | grep -q 'domain_probe_success 0'"
|
||||||
|
)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
dovecot = {
|
dovecot = {
|
||||||
exporterConfig = {
|
exporterConfig = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
@ -15,6 +15,8 @@ buildGoModule rec {
|
||||||
|
|
||||||
doCheck = false; # needs internet connection
|
doCheck = false; # needs internet connection
|
||||||
|
|
||||||
|
passthru.tests = { inherit (nixosTests.prometheus-exporters) domain; };
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
homepage = "https://github.com/caarlos0/domain_exporter";
|
homepage = "https://github.com/caarlos0/domain_exporter";
|
||||||
description = "Exports the expiration time of your domains as prometheus metrics";
|
description = "Exports the expiration time of your domains as prometheus metrics";
|
||||||
|
|
Loading…
Reference in New Issue