49 lines
1.4 KiB
Markdown
49 lines
1.4 KiB
Markdown
# Argus Master Module
|
|
|
|
A lightweight Flask + SQLite service that manages Argus agent nodes. It exposes node registration, status updates, configuration management, statistics, and generates `nodes.json` for the metric module.
|
|
|
|
## Build & Run
|
|
|
|
```bash
|
|
cd src/master
|
|
./scripts/build_images.sh # builds argus-master:dev
|
|
```
|
|
|
|
Local run via Docker compose (test stack):
|
|
|
|
```bash
|
|
cd src/master/tests
|
|
./scripts/01_up_master.sh
|
|
```
|
|
|
|
Service listens on port `3000` (`31300` when using the provided test compose). Key environment variables:
|
|
|
|
- `DB_PATH` (default `/private/argus/master/db.sqlite3`)
|
|
- `METRIC_NODES_JSON_PATH` (default `/private/argus/metric/prometheus/nodes.json`)
|
|
- `OFFLINE_THRESHOLD_SECONDS`, `ONLINE_THRESHOLD_SECONDS`, `SCHEDULER_INTERVAL_SECONDS`
|
|
|
|
## REST API Summary
|
|
|
|
Base path: `/api/v1/master`
|
|
|
|
- `GET /nodes` — list node summaries
|
|
- `GET /nodes/{id}` — node detail
|
|
- `POST /nodes` — register/re-register
|
|
- `PUT /nodes/{id}/status` — status report (timestamp + health map)
|
|
- `PUT /nodes/{id}/config` — update config/labels (partial)
|
|
- `GET /nodes/statistics` — totals + grouped counts
|
|
- `GET /healthz`, `GET /readyz` — health checks
|
|
|
|
`nodes.json` only contains nodes whose status is `online`.
|
|
|
|
## Tests
|
|
|
|
End-to-end tests are Docker based:
|
|
|
|
```bash
|
|
cd src/master/tests
|
|
./scripts/00_e2e_test.sh
|
|
```
|
|
|
|
Scripts create temporary `private/` and `tmp/` directories under `tests/`; they are cleaned automatically by `06_down.sh`.
|