Merge pull request #118505 from mmilata/domain-exporter

prometheus-domain-exporter: init at 1.10.0
This commit is contained in:
Robert Scott 2021-04-04 23:00:46 +01:00 committed by GitHub
commit 0874169a0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 63 additions and 0 deletions

View File

@ -28,6 +28,7 @@ let
"blackbox"
"collectd"
"dnsmasq"
"domain"
"dovecot"
"fritzbox"
"json"

View File

@ -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}
'';
};
};
}

View File

@ -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 = {
exporterConfig = {
enable = true;

View File

@ -0,0 +1,26 @@
{ lib, buildGoModule, fetchFromGitHub, nixosTests }:
buildGoModule rec {
pname = "domain-exporter";
version = "1.10.0";
src = fetchFromGitHub {
owner = "caarlos0";
repo = "domain_exporter";
rev = "v${version}";
sha256 = "0pvz5vx9jvxdrkmzqzh7dfi09sb55j6zpx5728m5v38p8cl8vyh6";
};
vendorSha256 = "02m2mnx93xq6cl54waazgxq6vqbswfn9aafz0h694n6rskvdn784";
doCheck = false; # needs internet connection
passthru.tests = { inherit (nixosTests.prometheus-exporters) domain; };
meta = with lib; {
homepage = "https://github.com/caarlos0/domain_exporter";
description = "Exports the expiration time of your domains as prometheus metrics";
license = licenses.mit;
maintainers = with maintainers; [ mmilata prusnak ];
};
}

View File

@ -18868,6 +18868,7 @@ in
prometheus-consul-exporter = callPackage ../servers/monitoring/prometheus/consul-exporter.nix { };
prometheus-dnsmasq-exporter = callPackage ../servers/monitoring/prometheus/dnsmasq-exporter.nix { };
prometheus-dovecot-exporter = callPackage ../servers/monitoring/prometheus/dovecot-exporter.nix { };
prometheus-domain-exporter = callPackage ../servers/monitoring/prometheus/domain-exporter.nix { };
prometheus-flow-exporter = callPackage ../servers/monitoring/prometheus/flow-exporter.nix { };
prometheus-fritzbox-exporter = callPackage ../servers/monitoring/prometheus/fritzbox-exporter.nix { };
prometheus-gitlab-ci-pipelines-exporter = callPackage ../servers/monitoring/prometheus/gitlab-ci-pipelines-exporter.nix { };