-
Notifications
You must be signed in to change notification settings - Fork 2
System Resources Monitor
Yousef Ghadiri edited this page May 28, 2026
·
2 revisions
When enabled with --system-resources, Knightwatch polls hardware metrics every second and exposes them via the /system family of endpoints. It also emits threshold-based events to the Telegram bot and webhook dispatcher.
knightwatch --pid <PID> --system-resources| Metric | Warning Threshold |
|---|---|
| CPU usage | ≥ 90% |
| Memory usage | ≥ 90% |
| Disk usage (per mount) | ≥ 90% |
| Battery charge | ≤ 15% (discharging only) |
| Endpoint | Description |
|---|---|
GET /system |
Full snapshot — CPU, memory, disks, networks, GPUs, battery, thermals, health |
GET /cpu |
Current CPU snapshot only |
GET /memory |
Current memory snapshot only |
GET /disks |
Per-disk snapshots |
GET /networks |
Per-network-interface snapshots |
GET /gpus |
GPU snapshots (empty if no supported GPU detected) |
GET /battery |
Battery snapshot, or 404 if no battery present |
GET /host-info |
Static host information (hostname, OS, kernel, arch, uptime) |
GET /temperatures |
Thermal sensor readings |
Note: On Windows,
/temperaturesrequires running the app as administrator.
The health field on /system can be healthy, warning, or critical.
| Event | Description | Key data fields |
|---|---|---|
resources.initial_snapshot |
First hardware snapshot after startup | snapshot |
resources.tick |
Periodic hardware snapshot | snapshot |
resources.cpu_threshold_exceeded |
CPU crossed warning threshold |
usage_percent, threshold
|
resources.memory_threshold_exceeded |
Memory crossed warning threshold |
usage_percent, threshold
|
resources.disk_threshold_exceeded |
Disk crossed warning threshold |
mount_point, usage_percent, threshold
|
resources.battery_low |
Battery charge below threshold |
charge_percent, threshold
|
resources.battery_state_changed |
Battery state changed | state |
When both --system-resources and --telegram are enabled, the bot sends alerts for:
⚠️ CPU threshold exceeded — aggregate CPU usage above 90%⚠️ Memory threshold exceeded — memory usage above 90%⚠️ Disk threshold exceeded — a mount point usage above 90%- 🔋 Battery low — charge below 15% while discharging
- 🔌 Battery state changed — plugged in, unplugged, or full