Connectors: pull reports from other tools, starting with Beszel #39

Merged
Gilles merged 1 commit from feat/37-connectors into master 2026-10-29 10:39:11 +00:00
Owner

Closes #37

Monitoring plan, phases 4.1 and 4.2.

Changes

  • New app apps.connectors:
    • Connector: project, kind (beszel), name, internal base URL (bare container names accepted, e.g. http://beszel:8090 — Django's URLValidator refuses them), username, secret (EncryptedTextField, write-only in the API, excluded from the admin), interval (≥ 60 s), enabled, last_run_at / last_status / last_error.
    • Celery beat apps.connectors.tasks.run_due_connectors every minute (seeded on post_migrate), one run_connector task per due connector. Any tool error is recorded on the connector, nothing is filed.
    • Beszel (apps/connectors/beszel.py, PocketBase API with a Beszel user): one report per system, ref_kind=source, ref_value=<system name>, custom_type_name=beszel, metrics system_status (up ok / down fail / other warn), alerts_triggered (warn if any) and the list of triggered alerts; expect_every = 3 × interval. Detailed stats stay in Beszel (graphs).
    • API (project admin): GET/POST /api/projects/<o>/<r>/connectors/, PATCH/DELETE …/<id>/ (empty secret keeps the stored one), POST …/<id>/run/ (runs inside the request and returns the outcome and reports_filed).
  • apps.reports.ingest.store_custom_report(): raw file + Report + process_report, now also used by the self-reports (same storage keys as before).
  • deploy/docker-compose.yml: argus and argus-worker join the external monitoring network. The CI deploy uses the server's own compose file: I'll create the network (vps-garion beszel/) and update /srv/docker/argus/docker-compose.yml when this is merged, before the deploy.
  • README, feature catalog; tests in apps/connectors/tests.py.

Checks

pytest (232 passed), pylint 10/10, autopep8, bandit clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_014BSmBtGWeFBD9z4mYm9SjA

Closes #37 Monitoring plan, phases 4.1 and 4.2. ## Changes - New app `apps.connectors`: - `Connector`: project, kind (`beszel`), name, **internal** base URL (bare container names accepted, e.g. `http://beszel:8090` — Django's URLValidator refuses them), username, secret (`EncryptedTextField`, write-only in the API, excluded from the admin), interval (≥ 60 s), enabled, `last_run_at` / `last_status` / `last_error`. - Celery beat `apps.connectors.tasks.run_due_connectors` every minute (seeded on `post_migrate`), one `run_connector` task per due connector. Any tool error is recorded on the connector, nothing is filed. - Beszel (`apps/connectors/beszel.py`, PocketBase API with a Beszel user): one report per system, `ref_kind=source`, `ref_value=<system name>`, `custom_type_name=beszel`, metrics `system_status` (up ok / down fail / other warn), `alerts_triggered` (warn if any) and the list of triggered alerts; `expect_every` = 3 × interval. Detailed stats stay in Beszel (graphs). - API (project **admin**): `GET/POST /api/projects/<o>/<r>/connectors/`, `PATCH/DELETE …/<id>/` (empty secret keeps the stored one), `POST …/<id>/run/` (runs inside the request and returns the outcome and `reports_filed`). - `apps.reports.ingest.store_custom_report()`: raw file + `Report` + `process_report`, now also used by the self-reports (same storage keys as before). - `deploy/docker-compose.yml`: `argus` and `argus-worker` join the external `monitoring` network. **The CI deploy uses the server's own compose file**: I'll create the network (vps-garion `beszel/`) and update `/srv/docker/argus/docker-compose.yml` when this is merged, before the deploy. - README, feature catalog; tests in `apps/connectors/tests.py`. ## Checks pytest (232 passed), pylint 10/10, autopep8, bandit clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_014BSmBtGWeFBD9z4mYm9SjA
feature: connectors, pulling reports from other tools (Beszel first)
All checks were successful
ci / test (pull_request) Successful in 3m32s
ci / e2e (pull_request) Has been skipped
ci / docker (pull_request) Has been skipped
ci / deploy (pull_request) Has been skipped
d34bf23a6f
- apps.connectors.Connector: kind, name, internal base URL, username,
  secret encrypted at rest (write-only in the API), interval >= 60 s,
  enabled, outcome of the last run.
- Celery beat task run_due_connectors every minute, one task per due
  connector; failures land on the connector, never in the worker.
- Beszel: one report per system (ref source=<system name>, custom type
  beszel) with its state and the alerts Beszel considers triggered;
  expect_every = 3 intervals, so a broken connector ends up silent.
- apps.reports.ingest.store_custom_report, shared with the self-reports.
- API (project admin): list/create/update/delete, run now.
- Deploy: argus and argus-worker join the external "monitoring" network.

Closes #37

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014BSmBtGWeFBD9z4mYm9SjA
Author
Owner
<!-- argus-link-bot:argus/backend --> 📊 [Rapports Argus pour cette PR](https://reports.stationmyr.net/argus/backend/pr/39)
Gilles merged commit 081dee7b92 into master 2026-10-29 10:39:11 +00:00
Gilles deleted branch feat/37-connectors 2026-10-29 10:39:11 +00:00
Sign in to join this conversation.
No description provided.