Merge pull request #113370 from chkno/prometheus-systemd-exporter-no-flags
prometheus-systemd-exporter: Init at 0.4.0
This commit is contained in:
commit
f5c01cf9d4
|
@ -53,6 +53,7 @@ let
|
||||||
"smokeping"
|
"smokeping"
|
||||||
"sql"
|
"sql"
|
||||||
"surfboard"
|
"surfboard"
|
||||||
|
"systemd"
|
||||||
"tor"
|
"tor"
|
||||||
"unifi"
|
"unifi"
|
||||||
"unifi-poller"
|
"unifi-poller"
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let cfg = config.services.prometheus.exporters.systemd;
|
||||||
|
|
||||||
|
in {
|
||||||
|
port = 9558;
|
||||||
|
|
||||||
|
serviceOpts = {
|
||||||
|
serviceConfig = {
|
||||||
|
ExecStart = ''
|
||||||
|
${pkgs.prometheus-systemd-exporter}/bin/systemd_exporter \
|
||||||
|
--web.listen-address ${cfg.listenAddress}:${toString cfg.port}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -835,6 +835,22 @@ let
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
systemd = {
|
||||||
|
exporterConfig = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
metricProvider = { };
|
||||||
|
exporterTest = ''
|
||||||
|
wait_for_unit("prometheus-systemd-exporter.service")
|
||||||
|
wait_for_open_port(9558)
|
||||||
|
succeed(
|
||||||
|
"curl -sSf localhost:9558/metrics | grep -q '{}'".format(
|
||||||
|
'systemd_unit_state{name="basic.target",state="active",type="target"} 1'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
tor = {
|
tor = {
|
||||||
exporterConfig = {
|
exporterConfig = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
25
pkgs/servers/monitoring/prometheus/systemd-exporter.nix
Normal file
25
pkgs/servers/monitoring/prometheus/systemd-exporter.nix
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{ lib, buildGoModule, fetchFromGitHub, nixosTests }:
|
||||||
|
|
||||||
|
buildGoModule rec {
|
||||||
|
pname = "systemd_exporter";
|
||||||
|
version = "0.4.0";
|
||||||
|
|
||||||
|
vendorSha256 = "sha256-bYoB0r+d0j3esi/kK2a7/Duup9cf4M3WJjiBNs2+bj8=";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "povilasv";
|
||||||
|
repo = pname;
|
||||||
|
rev = "v${version}";
|
||||||
|
sha256 = "sha256-JDfRHczFnTP9sxA7polUE9qzJhSPIiAU58GBNDYkX4c=";
|
||||||
|
};
|
||||||
|
|
||||||
|
passthru.tests = { inherit (nixosTests.prometheus-exporters) systemd; };
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "Exporter for systemd unit metrics";
|
||||||
|
homepage = "https://github.com/povilasv/systemd_exporter";
|
||||||
|
license = licenses.asl20;
|
||||||
|
maintainers = with maintainers; [ chkno ];
|
||||||
|
platforms = platforms.unix;
|
||||||
|
};
|
||||||
|
}
|
|
@ -18619,6 +18619,7 @@ in
|
||||||
prometheus-smokeping-prober = callPackage ../servers/monitoring/prometheus/smokeping-prober.nix { };
|
prometheus-smokeping-prober = callPackage ../servers/monitoring/prometheus/smokeping-prober.nix { };
|
||||||
prometheus-snmp-exporter = callPackage ../servers/monitoring/prometheus/snmp-exporter.nix { };
|
prometheus-snmp-exporter = callPackage ../servers/monitoring/prometheus/snmp-exporter.nix { };
|
||||||
prometheus-sql-exporter = callPackage ../servers/monitoring/prometheus/sql-exporter.nix { };
|
prometheus-sql-exporter = callPackage ../servers/monitoring/prometheus/sql-exporter.nix { };
|
||||||
|
prometheus-systemd-exporter = callPackage ../servers/monitoring/prometheus/systemd-exporter.nix { };
|
||||||
prometheus-tor-exporter = callPackage ../servers/monitoring/prometheus/tor-exporter.nix { };
|
prometheus-tor-exporter = callPackage ../servers/monitoring/prometheus/tor-exporter.nix { };
|
||||||
prometheus-statsd-exporter = callPackage ../servers/monitoring/prometheus/statsd-exporter.nix { };
|
prometheus-statsd-exporter = callPackage ../servers/monitoring/prometheus/statsd-exporter.nix { };
|
||||||
prometheus-surfboard-exporter = callPackage ../servers/monitoring/prometheus/surfboard-exporter.nix { };
|
prometheus-surfboard-exporter = callPackage ../servers/monitoring/prometheus/surfboard-exporter.nix { };
|
||||||
|
|
Loading…
Reference in a new issue