nixos/tests/prometheus-exporters: add graphite

This commit is contained in:
Gabriel Fontes 2023-05-30 12:30:31 -03:00 committed by Anderson Torres
parent dff2e184f4
commit 4ff3a5795b
2 changed files with 25 additions and 0 deletions

View file

@ -284,6 +284,29 @@ let
'';
};
graphite = {
exporterConfig = {
enable = true;
port = 9108;
graphitePort = 9109;
mappingSettings.mappings = [{
match = "test.*.*";
name = "testing";
labels = {
protocol = "$1";
author = "$2";
};
}];
};
exporterTest = ''
wait_for_unit("prometheus-graphite-exporter.service")
wait_for_open_port(9108)
wait_for_open_port(9109)
succeed("echo test.tcp.foo-bar 1234 $(date +%s) | nc -w1 localhost 9109")
succeed("curl -sSf http://localhost:9108/metrics | grep 'testing{author=\"foo-bar\",protocol=\"tcp\"} 1234'")
'';
};
influxdb = {
exporterConfig = {
enable = true;

View file

@ -25,6 +25,8 @@ buildGoModule rec {
buildFlagsArray+=("-run" "[^(${builtins.concatStringsSep "|" skippedTests})]")
'';
passthru.tests = { inherit (nixosTests.prometheus-exporters) graphite; };
meta = {
description = "An exporter for metrics exported in the Graphite plaintext protocol";
homepage = "https://github.com/prometheus/graphite_exporter";