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