Something went wrong. Try again.
A Prometheus exporter for the goCoax MA2500D
Something went wrong. Try again.
gocoax-exporter scripts
1 folder · 2 files
README.md
# Capturing device traffic
`capture.py` replays the exact request sequence the exporter performs against a
live goCoax MA2500D and writes the result under `testdata/` so the test mocks
can replay real device traffic instead of hand-written fixtures.
## Run
```sh
python3 scripts/capture.py \
--config .private/gocoax-exporter.cfg \
--out testdata
```
The config file has one `name;url` line per device (the same format the
exporter consumes). Credentials come from the URL userinfo and are used for HTTP
Basic auth; they are never written to disk. Re-running against a live device
should produce the same *shape* of data, not the same values (counters and
PHY-rate fields change between reads).
## Output layout
```
testdata/<name>/
capture.json # manifest pairing each request with its response
bodies/00-session.html # raw /phyRates.html used to obtain the CSRF cookie
bodies/01-local-info.json
bodies/02-node-0.json
...
```
## `capture.json` schema
```json
{
"device": "ten",
"captured_at": "2026-11-02T14:45:00+00:00",
"note": "One-shot capture of MA2500D management endpoints for test mocking...",
"requests": [
{
"name": "local-info",
"method": "POST",
"path": "/ms/0/0x15",
"body": "{\"data\":[]}",
"response": {"status": 200, "file": "bodies/01-local-info.json"}
}
]
}
```
- `name` is a human label for the request (matching the exporter's read).
- `method`, `path`, and `body` are exactly what was sent; the body is the POST
payload (`""` for the empty-body reads).
- `response.file` points at the raw response body relative to `capture.json`.
The HTTP Basic auth header and the rotating `csrf_token` cookie/`X-CSRF-TOKEN`
header are intentionally not recorded, so the committed tree contains no
credentials or session tokens.
## What not to capture
Do not add `/security.html` — or any page that renders the MoCA preshared keys
or other on-the-wire secrets — to the capture. Only the exporter's read
endpoints (the session page plus the `/ms/...` rea…