mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-10-06 12:39:54 +03:00
nixos/vector: Added Prometheus exporter/Vector logs integration to tests.
This commit is contained in:
parent
af979d2d48
commit
c97e5f8d17
@ -14,15 +14,27 @@ with pkgs.lib;
|
|||||||
enable = true;
|
enable = true;
|
||||||
journaldAccess = true;
|
journaldAccess = true;
|
||||||
settings = {
|
settings = {
|
||||||
sources.journald.type = "journald";
|
sources = {
|
||||||
|
journald.type = "journald";
|
||||||
|
|
||||||
|
vector_metrics.type = "internal_metrics";
|
||||||
|
|
||||||
|
vector_logs.type = "internal_logs";
|
||||||
|
};
|
||||||
|
|
||||||
sinks = {
|
sinks = {
|
||||||
file = {
|
file = {
|
||||||
type = "file";
|
type = "file";
|
||||||
inputs = [ "journald" ];
|
inputs = [ "journald" "vector_logs" ];
|
||||||
path = "/var/lib/vector/logs.log";
|
path = "/var/lib/vector/logs.log";
|
||||||
encoding = { codec = "json"; };
|
encoding = { codec = "json"; };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
prometheus_exporter = {
|
||||||
|
type = "prometheus_exporter";
|
||||||
|
inputs = [ "vector_metrics" ];
|
||||||
|
address = "[::]:9598";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -31,6 +43,10 @@ with pkgs.lib;
|
|||||||
# ensure vector is forwarding the messages appropriately
|
# ensure vector is forwarding the messages appropriately
|
||||||
testScript = ''
|
testScript = ''
|
||||||
machine.wait_for_unit("vector.service")
|
machine.wait_for_unit("vector.service")
|
||||||
|
machine.wait_for_open_port(9598)
|
||||||
|
machine.wait_until_succeeds("curl -sSf http://localhost:9598/metrics | grep vector_build_info")
|
||||||
|
machine.wait_until_succeeds("curl -sSf http://localhost:9598/metrics | grep vector_component_received_bytes_total | grep journald")
|
||||||
|
machine.wait_until_succeeds("curl -sSf http://localhost:9598/metrics | grep vector_utilization | grep prometheus_exporter")
|
||||||
machine.wait_for_file("/var/lib/vector/logs.log")
|
machine.wait_for_file("/var/lib/vector/logs.log")
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user