Updates
CI / test (push) Successful in 1m3s
Release rolling / release (push) Has been cancelled

This commit is contained in:
Raven Scott
2026-07-18 23:47:54 -04:00
parent e503e92dd4
commit 3fc0245b32
34 changed files with 834 additions and 197 deletions
+30 -8
View File
@@ -2,7 +2,7 @@
PearMonitor agents expose an optional HTTP API for local tooling (`/api/v1`, `/api/v2`, `/api/v3`).
Default bind: `http://127.0.0.1:19999`.
Default bind: `http://127.0.0.1:18888`.
Disable: `PEARDATA_REST=0`.
Bind all interfaces (careful): `PEARDATA_REST_HOST=0.0.0.0`.
@@ -14,22 +14,22 @@ Compatibility matrix vs upstream agent OpenAPI: [SWAGGER_PLAN.md](./SWAGGER_PLAN
```bash
# Agent info
curl -s http://127.0.0.1:19999/api/v3/info | jq
curl -s http://127.0.0.1:18888/api/v3/info | jq
# Chart catalog (v1 style)
curl -s http://127.0.0.1:19999/api/v1/charts | jq '.charts | keys'
curl -s http://127.0.0.1:18888/api/v1/charts | jq '.charts | keys'
# Last 60s of CPU (v3)
curl -s 'http://127.0.0.1:19999/api/v3/data?chart=system.cpu&after=-60&points=60' | jq
curl -s 'http://127.0.0.1:18888/api/v3/data?chart=system.cpu&after=-60&points=60' | jq
# Contexts
curl -s http://127.0.0.1:19999/api/v3/contexts | jq
curl -s http://127.0.0.1:18888/api/v3/contexts | jq
# Prometheus export
curl -s 'http://127.0.0.1:19999/api/v3/allmetrics?format=prometheus'
curl -s 'http://127.0.0.1:18888/api/v3/allmetrics?format=prometheus'
# Health
curl -s http://127.0.0.1:19999/api/v3/health | jq
curl -s http://127.0.0.1:18888/api/v3/health | jq
```
## Endpoint matrix
@@ -160,6 +160,27 @@ Response includes `method`, `view.highlight` / `view.baseline`, and `results[{ i
Engine: `server/services/weights.js`. Unit tests: `test/weights.test.js`.
## Logs
`GET /api/v1/logs` · `/api/v2/logs` · `/api/v3/logs` (same engine; also RPC `queryLogs`)
Desktop walkthrough: [user-guide/logs.md](../user-guide/logs.md)
| Param | Notes |
|-------|--------|
| `source` | `anomaly` (API default) \| `audit` \| `journal` — desktop UI defaults to **journal** for admins |
| `q` | Case-insensitive substring over message / unit / severity |
| `since` / `until` | Absolute ms/sec, ISO, or relative (`-1h`) |
| `priority` | Journal max priority (`journalctl -p`) |
| `unit` | Journal unit (e.g. `peardata.service`) |
| `limit` / `cursor` | Cap (default 200, max 2000) + pagination offset |
**Auth:** REST is localhost-open (like other GETs). Over P2P, `audit` and `journal` require **admin**; `anomaly` allows viewer.
**Journal:** enabled by default (`PEARDATA_JOURNAL=0` to disable). Linux only; installer adds `peardata` to `systemd-journal`.
Engine: `server/services/logs.js`. Unit tests: `test/logs.test.js`.
## CORS
`Access-Control-Allow-Origin` defaults to `*` (override with `PEARDATA_REST_CORS`).
@@ -168,7 +189,8 @@ Engine: `server/services/weights.js`. Unit tests: `test/weights.test.js`.
| Area | PearData |
|------|----------|
| Weights / Metric Correlations | `GET /api/v*/weights` — highlight-vs-baseline scoring (`method=volume\|ks2\|anomaly-rate\|value`) or alert weights when no window; see below |
| Weights / Metric Correlations | `GET /api/v*/weights` — highlight-vs-baseline scoring (`method=volume\|ks2\|anomaly-rate\|value`) or alert weights when no window; see above |
| Logs | `GET /api/v*/logs` — anomaly / audit / journal; journal on by default; see above |
| Multi-node parent streaming | Single node; parent planned |
| Cloud POST spaces APIs | Not implemented (agent GET style only) |
| App/plugin charts (nginx, DB, …) | System/OS charts; plugins later |