95761a0643
Closes the agent-module coverage gap the reconciler flagged (activeteller + 14). Grounded per module in hiveops-agent/hiveops-module-*; audience dev (dev-only). Reconciler now green. Grounding surfaced agent-side bugs (log-error route mismatch, atec poll-interval hardcoded) — to verify + file next. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
6.2 KiB
6.2 KiB
module, title, tab, order, audience
| module | title | tab | order | audience |
|---|---|---|---|---|
| agent.packet-capture | Packet Capture — on-demand network capture for ATM diagnostics | Claude | 40 | dev |
Internal · agent reference. Terse. Confirmed against
hiveops-module-packet-capturesource 2026-07-01.
Identity
- Module name (
AgentModule.getName()):packet-capture - Maven artifact:
hiveops-module-packet-capture(own version1.0.0; parenthiveops-agent-parentcurrently4.4.3) - Entry class:
com.hiveops.packetcapture.PacketCaptureModule(SPI file:META-INF/services/com.hiveops.core.module.AgentModule) - Other classes:
PacketCaptureHandler(task execution),PacketCaptureTool(OS-specific capture runner) - Log package (
getLogPackage()):com.hiveops.packetcapture→logs/modules/packet-capture.log - Fleet task kind it implements:
PACKET_CAPTURE(exact string, passed toqueryCurrentAtmPendingTask(country, atm, "PACKET_CAPTURE"); the matchingFleetTaskKindenum lives inhiveops-fleet— (unverified, cross-repo))
Config properties
- No dedicated
packet-capture.*keys exist in code. Reuses whichever is set:agent.endpoint(preferred) orincident.endpoint(fallback) — HTTP base URLagent.auth.token/agent.institution.key— auth (shared across modules)modules.disabled— comma list; includepacket-captureto disable
isEnabled()= true wheneveragent.endpointORincident.endpointis non-blank (on by default).- Hardcoded (not configurable):
POLL_INTERVAL_SECONDS = 30,MAX_DURATION = 300(seconds, hard cap),SEGMENT_SIZE = 100_000(upload chunk bytes).
Fleet task configPatch keys (set by the operator in Fleet UI)
| Key | Default if absent | Notes |
|---|---|---|
duration |
60 |
seconds; clamped agent-side to ≤300 (Math.min(parsed, MAX_DURATION)) |
interface |
"auto" |
blank or "auto" → OS default interface |
filter |
"" |
BPF filter string, e.g. tcp port 443; ignored by pktmon/netsh Windows fallbacks |
Event / status strings emitted
- No
EventType/IAT_*/ journal-incident events. This module never callsIncidentEventClient. - Only emits fleet task status via
FileUploadClient.statusReport(tid, aid, status, message):"RUNNING","COMPLETED","FAILED"(plus free-text progress messages while running).
HTTP endpoints used (agent → agent-proxy)
| Call | Path |
|---|---|
| Poll (kind-filtered) | GET {endpoint}/api/agent/{country}/{atm}/task?kind=PACKET_CAPTURE |
| Status report | POST {endpoint}/api/agent/tasks/{tid}/status |
| Upload chunk | POST {endpoint}/api/agent/tasks/{tid}/upload?o=<base36offset>&f=<filename> |
Base URL = agent.endpoint (preferred) or incident.endpoint (fallback), from HttpClientHelper.loadSettingsFromProperties(props, prefix). In current topology agent.endpoint points at agent-proxy, which forwards to incident's internal fleet API — (agent-proxy controller/internal path unverified, cross-repo). Same transport as every other fleet-task module.
Capture tool selection (in order tried)
- Linux:
tcpdumponly — no fallback; module throws iftcpdumpisn't installed. Output:.pcap. - Windows:
tshark→.pcap(supports-f <BPF filter>) → elsepktmon→.etl(no filter support) → elsenetsh trace→.etl(no filter support,stopcan take up to 90s). - Output file extension is decided by
PacketCaptureTool.detectFormat()before the real capture file is created, so it matches the tool that will actually run.
Concurrency / lifecycle
AtomicBoolean captureInProgress(static inPacketCaptureModule, shared withPacketCaptureHandler) allows only one capture per ATM at a time. A second concurrentPACKET_CAPTUREtask fails immediately: "Another capture is already in progress on this ATM".- Capture file is always deleted locally after upload (success or failure) — never left on ATM disk.
stop()(agent shutdown) callsPacketCaptureHandler.abort()→PacketCaptureTool.abort(), force-killing the running process (and best-effortpktmon stop/netsh trace stopon Windows).
Deployment
- Ships in the
atmmodule set ofdeployment/build-dist.sh(default), NOT thesrv(server-monitor) set. - Delivered as drop-in JAR
modules/hiveops-module-packet-capture.jar— not bundled in the fat JAR. - Retrofit to an ATM missing it:
INSTALL_MODULEfleet task, or a full standard-set agent update.
Gotchas
- Legacy
command-processorexplicitly ignoresPACKET_CAPTURE: when its own unfiltered poll sees aPACKET_CAPTUREtask, it reports it back toPENDING("Released to packet-capture module") and sleeps 35s — it never executes the capture itself. If tasks never leave PENDING, check that thepacket-capturemodule (not justcommand-processor) is actually running, not that command-processor is "stuck." - Requesting
duration> 300 does not error — it silently clamps to 300 with no warning back to Fleet. - Windows without
tsharkinstalled silently degrades to.etlcapture with no BPF filter applied — a requestedfilteris quietly ignored, not rejected. - No
PlatformService/SystemCommandsusage here — OS branching is done locally viaos.name+ rawProcessBuilder, unlike most other modules. - This module has zero config-property surface of its own; don't go looking for
packet-capture.*inhiveops.properties— there isn't any.
Do NOT
- Do NOT treat this as a continuous/passive network monitor — it only runs when a
PACKET_CAPTUREfleet task is queued. - Do NOT expect journal/incident events (
IAT_*or anyEventType) from this module — it reports fleet task status only. - Do NOT assume a BPF
filterworks on Windows unlesstsharkis confirmed installed —pktmon/netshignore it silently. - Do NOT invent a
packet-capture.*properties namespace — none exists; config comes fromagent.endpoint/incident.endpoint/agent.auth.token/modules.disabledonly. - Do NOT expect the captured file to persist on the ATM after task completion — it's deleted immediately after upload, success or failure.
- Do NOT add this module to the
srv(server-monitor) build set without checking with the team — it's ATM-set only today.