Merge pull request #116037 from petabyteboy/feature/jitsi-exporter

prometheus-jitsi-exporter: init at 0.2.18
This commit is contained in:
WilliButz 2021-03-13 13:37:10 +01:00 committed by GitHub
commit 3971cda05f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 88 additions and 0 deletions

View File

@ -31,6 +31,7 @@ let
"dovecot"
"fritzbox"
"json"
"jitsi"
"keylight"
"knot"
"lnd"

View File

@ -0,0 +1,40 @@
{ config, lib, pkgs, options }:
with lib;
let
cfg = config.services.prometheus.exporters.jitsi;
in
{
port = 9700;
extraOpts = {
url = mkOption {
type = types.str;
default = "http://localhost:8080/colibri/stats";
description = ''
Jitsi Videobridge metrics URL to monitor.
This is usually /colibri/stats on port 8080 of the jitsi videobridge host.
'';
};
interval = mkOption {
type = types.str;
default = "30s";
example = "1min";
description = ''
How often to scrape new data
'';
};
};
serviceOpts = {
serviceConfig = {
ExecStart = ''
${pkgs.prometheus-jitsi-exporter}/bin/jitsiexporter \
-url ${escapeShellArg cfg.url} \
-host ${cfg.listenAddress} \
-port ${toString cfg.port} \
-interval ${toString cfg.interval} \
${concatStringsSep " \\\n " cfg.extraFlags}
'';
};
};
}

View File

@ -233,6 +233,29 @@ let
'';
};
jitsi = {
exporterConfig = {
enable = true;
};
metricProvider = {
systemd.services.prometheus-jitsi-exporter.after = [ "jitsi-videobridge2.service" ];
services.jitsi-videobridge = {
enable = true;
apis = [ "colibri" "rest" ];
};
};
exporterTest = ''
wait_for_unit("jitsi-videobridge2.service")
wait_for_open_port(8080)
wait_for_unit("prometheus-jitsi-exporter.service")
wait_for_open_port(9700)
wait_until_succeeds(
'journalctl -eu prometheus-jitsi-exporter.service -o cat | grep -q "key=participants"'
)
succeed("curl -sSf 'localhost:9700/metrics' | grep -q 'jitsi_participants 0'")
'';
};
json = {
exporterConfig = {
enable = true;

View File

@ -0,0 +1,23 @@
{ lib, buildGoModule, fetchgit, nixosTests }:
buildGoModule rec {
pname = "jitsiexporter";
version = "0.2.18";
src = fetchgit {
url = "https://git.xsfx.dev/prometheus/jitsiexporter";
rev = "v${version}";
sha256 = "1cf46wp96d9dwlwlffcgbcr0v3xxxfdv6il0zqkm2i7cfsfw0skf";
};
vendorSha256 = null;
passthru.tests = { inherit (nixosTests.prometheus-exporters) jitsi; };
meta = with lib; {
description = "Export Jitsi Videobridge metrics to Prometheus";
homepage = "https://git.xsfx.dev/prometheus/jitsiexporter";
license = licenses.mit;
maintainers = with maintainers; [ petabyteboy ];
};
}

View File

@ -18599,6 +18599,7 @@ in
prometheus-fritzbox-exporter = callPackage ../servers/monitoring/prometheus/fritzbox-exporter.nix { };
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-jitsi-exporter = callPackage ../servers/monitoring/prometheus/jitsi-exporter.nix { };
prometheus-json-exporter = callPackage ../servers/monitoring/prometheus/json-exporter.nix { };
prometheus-keylight-exporter = callPackage ../servers/monitoring/prometheus/keylight-exporter.nix { };
prometheus-knot-exporter = callPackage ../servers/monitoring/prometheus/knot-exporter.nix { };