feat: add eBPF flow collector with helper binary contract and agent integration

Add EBPF_HELPER_CONTRACT.md documenting helper binary invocation with --json/--limit/--duration/--interfaces parameters and expected JSON output format with flows/diagnostics, implement collect_ebpf_flows to invoke helper binary with configurable timeout/window/interfaces and normalize flow fields (source_ip/destination_ip/protocol/ports/packets/bytes/state), add executable_exists and flow_int helpers for binary validation
This commit is contained in:
2026-07-10 14:15:15 +02:00
parent af68949e07
commit e6c9a92ff0
4 changed files with 148 additions and 3 deletions
+9
View File
@@ -663,6 +663,11 @@ def compact_agent_payload(payload: AgentHeartbeat) -> dict:
value["flow_count"] = len(flows)
value["flows"] = flows[:50]
value["flows_truncated"] = len(flows) > 50
ebpf_flows = value.get("ebpf_flows")
if isinstance(ebpf_flows, list):
value["ebpf_flow_count"] = len(ebpf_flows)
value["ebpf_flows"] = ebpf_flows[:50]
value["ebpf_flows_truncated"] = len(ebpf_flows) > 50
return value
@@ -1417,6 +1422,10 @@ cat > "$CONFIG_DIR/config.json" <<'JSON'
"node_name": "{node.name}",
"interval_seconds": 30,
"flow_limit": 1500,
"ebpf_collector": true,
"ebpf_binary": "/opt/nexafabric-agent/nexafabric-ebpf",
"ebpf_window_seconds": 10,
"ebpf_timeout_seconds": 15,
"packet_flow_collector": true,
"packet_flow_window_seconds": 10,
"firewall_log_collector": true,