at 24.11-pre 1.7 kB view raw
1import ../make-test-python.nix ({ lib, pkgs, ... }: 2 3{ 4 name = "vector-test1"; 5 meta.maintainers = [ pkgs.lib.maintainers.happysalada ]; 6 7 nodes.machine = { config, pkgs, ... }: { 8 services.vector = { 9 enable = true; 10 journaldAccess = true; 11 settings = { 12 sources = { 13 journald.type = "journald"; 14 15 vector_metrics.type = "internal_metrics"; 16 17 vector_logs.type = "internal_logs"; 18 }; 19 20 sinks = { 21 file = { 22 type = "file"; 23 inputs = [ "journald" "vector_logs" ]; 24 path = "/var/lib/vector/logs.log"; 25 encoding = { codec = "json"; }; 26 }; 27 28 prometheus_exporter = { 29 type = "prometheus_exporter"; 30 inputs = [ "vector_metrics" ]; 31 address = "[::]:9598"; 32 }; 33 }; 34 }; 35 }; 36 }; 37 38 # ensure vector is forwarding the messages appropriately 39 testScript = '' 40 machine.wait_for_unit("vector.service") 41 machine.wait_for_open_port(9598) 42 machine.wait_until_succeeds("journalctl -o cat -u vector.service | grep 'version=\"${pkgs.vector.version}\"'") 43 machine.wait_until_succeeds("journalctl -o cat -u vector.service | grep 'API is disabled'") 44 machine.wait_until_succeeds("curl -sSf http://localhost:9598/metrics | grep vector_build_info") 45 machine.wait_until_succeeds("curl -sSf http://localhost:9598/metrics | grep vector_component_received_bytes_total | grep journald") 46 machine.wait_until_succeeds("curl -sSf http://localhost:9598/metrics | grep vector_utilization | grep prometheus_exporter") 47 machine.wait_for_file("/var/lib/vector/logs.log") 48 ''; 49})