mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-27 22:03:54 +03:00
Merge pull request #89810 from mdlayher/mdl-keylight-exporter
prometheus-keylight-exporter: init at 0.1.1
This commit is contained in:
commit
016a538f71
@ -28,6 +28,7 @@ let
|
||||
"dovecot"
|
||||
"fritzbox"
|
||||
"json"
|
||||
"keylight"
|
||||
"mail"
|
||||
"mikrotik"
|
||||
"minio"
|
||||
|
@ -0,0 +1,19 @@
|
||||
{ config, lib, pkgs, options }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.prometheus.exporters.keylight;
|
||||
in
|
||||
{
|
||||
port = 9288;
|
||||
serviceOpts = {
|
||||
serviceConfig = {
|
||||
ExecStart = ''
|
||||
${pkgs.prometheus-keylight-exporter}/bin/keylight_exporter \
|
||||
-metrics.addr ${cfg.listenAddress}:${toString cfg.port} \
|
||||
${concatStringsSep " \\\n " cfg.extraFlags}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
@ -202,6 +202,25 @@ let
|
||||
'';
|
||||
};
|
||||
|
||||
keylight = {
|
||||
# A hardware device is required to properly test this exporter, so just
|
||||
# perform a couple of basic sanity checks that the exporter is running
|
||||
# and requires a target, but cannot reach a specified target.
|
||||
exporterConfig = {
|
||||
enable = true;
|
||||
};
|
||||
exporterTest = ''
|
||||
wait_for_unit("prometheus-keylight-exporter.service")
|
||||
wait_for_open_port(9288)
|
||||
succeed(
|
||||
"curl -sS --write-out '%{http_code}' -o /dev/null http://localhost:9288/metrics | grep -q '400'"
|
||||
)
|
||||
succeed(
|
||||
"curl -sS --write-out '%{http_code}' -o /dev/null http://localhost:9288/metrics?target=nosuchdevice | grep -q '500'"
|
||||
)
|
||||
'';
|
||||
};
|
||||
|
||||
mail = {
|
||||
exporterConfig = {
|
||||
enable = true;
|
||||
|
22
pkgs/servers/monitoring/prometheus/keylight-exporter.nix
Normal file
22
pkgs/servers/monitoring/prometheus/keylight-exporter.nix
Normal file
@ -0,0 +1,22 @@
|
||||
{ stdenv, buildGoModule, fetchFromGitHub }:
|
||||
|
||||
buildGoModule rec {
|
||||
pname = "keylight-exporter";
|
||||
version = "0.1.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "mdlayher";
|
||||
repo = "keylight_exporter";
|
||||
rev = "v${version}";
|
||||
sha256 = "141npawcnxj3sz2xqsnyf06r4x1azk3g55941i8gjr7pwcla34r7";
|
||||
};
|
||||
|
||||
vendorSha256 = "0w065ls8dp687jmps4xdffcarss1wyls14dngr43g58xjw6519gb";
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
homepage = "https://github.com/mdlayher/keylight_exporter";
|
||||
description = "Prometheus exporter for Elgato Key Light devices.";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ mdlayher ];
|
||||
};
|
||||
}
|
@ -16167,6 +16167,7 @@ in
|
||||
prometheus-gitlab-ci-pipelines-exporter = callPackage ../servers/monitoring/prometheus/gitlab-ci-pipelines-exporter.nix { };
|
||||
prometheus-haproxy-exporter = callPackage ../servers/monitoring/prometheus/haproxy-exporter.nix { };
|
||||
prometheus-json-exporter = callPackage ../servers/monitoring/prometheus/json-exporter.nix { };
|
||||
prometheus-keylight-exporter = callPackage ../servers/monitoring/prometheus/keylight-exporter.nix { };
|
||||
prometheus-mail-exporter = callPackage ../servers/monitoring/prometheus/mail-exporter.nix { };
|
||||
prometheus-mesos-exporter = callPackage ../servers/monitoring/prometheus/mesos-exporter.nix { };
|
||||
prometheus-mikrotik-exporter = callPackage ../servers/monitoring/prometheus/mikrotik-exporter.nix { };
|
||||
|
Loading…
Reference in New Issue
Block a user