Skip to content

Local Development — Ingestor

  • Go (matching version in ingestor/go.mod)
  • SQL Server accessible locally (same instance as Cloud Backend, different schema)
  • Cloud Backend running locally to register a test device and get a device_key
Terminal window
cd ingestor
cp .env.example .env
# Edit .env
go mod download
go run .
VariableExampleNotes
DATABASE_URLsqlserver://sa:Pass@localhost:1433?database=monozu&encrypt=disableSame DB as Cloud or separate
PORT8081Ingestor listen port (avoid conflict with Cloud:8000 and Management:8080)
HOST_AGENT_BLOB_LOCAL_ROOT./.data/host-agent-blobsLocal-disk host_inventory blob store for dev; skips needing AZURE_STORAGE_ACCOUNT
AZURE_STORAGE_ACCOUNT / AZURE_STORAGE_KEYAzure Blob Storage for host_inventory snapshots in non-local envs

Use the claim-code flow or seed a test device via Backend test helpers / repository InsertTestDevice. Registration keys and POST /devices/register are removed.

For integration tests, see Backend/internal/domain/devices/handlers_test.go (TestCommandsFlow seeds devices directly).

Example after you have a device_key from claim-complete or test seed:

Terminal window
curl -X POST http://localhost:8081/v1/ingest \
-H "X-Device-Key: <device_key>" \
-H "Content-Type: application/json" \
-d '{
"device_id": "<device-uuid>",
"items": [
{
"id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"kind": "telemetry",
"payload": { "cpu_percent": 12.5, "ts": "2026-06-06T10:00:00Z" }
}
]
}'
# Expected: 200 OK

Send a test host_inventory snapshot (Bearer auth)

Section titled “Send a test host_inventory snapshot (Bearer auth)”

Requires an approved Host Agent — approve one via Cloud UI/API to get a host_token, then:

Terminal window
curl -X POST http://localhost:8081/v1/ingest \
-H "Authorization: Bearer hta_<token>" \
-H "Content-Type: application/json" \
-d '{
"items": [
{
"id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"kind": "host_inventory",
"payload": { "host_id": "<host-uuid>", "agent_version": "0.1.0", "os": {"family": "linux"}, "network_interfaces": [] }
}
]
}'
# Expected: 200 OK, snapshot written to HOST_AGENT_BLOB_LOCAL_ROOT / host_inventory_snapshots

To verify that a security_alert event triggers the WebSocket broadcast:

  1. Open the Cloud SPA Security module in the browser (connects to /api/ws/security)
  2. Send a security_alert ingest event (as above)
  3. The alert should appear in the SOC alert inbox within seconds