Initial commit: FastAPI JBOD monitor backend

This commit is contained in:
2026-03-07 02:14:17 +00:00
commit 9f918a3308
26 changed files with 651 additions and 0 deletions

45
README.md Normal file
View File

@@ -0,0 +1,45 @@
# JBOD Monitor
REST API for monitoring drive health in JBOD enclosures on Linux.
Auto-discovers SES enclosures via sysfs, maps drives to physical slots, and exposes SMART health data.
## Prerequisites
- Linux with SAS/SATA JBODs connected via HBA
- `smartmontools` — for `smartctl` (SMART data)
- `sg3-utils` — for `sg_ses` (SES enclosure data)
- Python 3.11+
```bash
# Debian/Ubuntu
apt install smartmontools sg3-utils
# RHEL/Fedora
dnf install smartmontools sg3_utils
```
## Install
```bash
pip install -r requirements.txt
```
## Run
The API needs root access for `smartctl` to query drives:
```bash
sudo uvicorn main:app --host 0.0.0.0 --port 8000
```
## API Endpoints
| Endpoint | Description |
|---|---|
| `GET /api/health` | Service health + tool availability |
| `GET /api/enclosures` | List all discovered SES enclosures |
| `GET /api/enclosures/{id}/drives` | List drive slots for an enclosure |
| `GET /api/drives/{device}` | SMART detail for a block device |
| `GET /api/overview` | Aggregate enclosure + drive health |
| `GET /docs` | Interactive API docs (Swagger UI) |