Linux
/procfilesystem 기반 시스템 메트릭 수집 백엔드 프로젝트
Linux 시스템의 CPU, memory, network, disk 메트릭을 /proc 파일시스템에서 직접 파싱하여 수집하고, 이를 FastAPI 기반 REST API로 제공하는 백엔드 프로젝트입니다.
이 프로젝트는 Linux 내부 동작, /proc 기반 메트릭 수집 방식, FastAPI API 설계, 그리고 Linux 실행 환경(Ubuntu VM)에서의 개발 흐름을 학습하기 위해 시작했습니다.
- Linux 시스템이 메트릭 정보를 어떻게 제공하는지 이해
/proc파일을 직접 파싱하는 방식 학습- FastAPI 기반 REST API 설계 및 구현
- Docker / systemd 같은 Linux 실행 환경 학습
- 문서화와 기록을 통한 학습 과정 정리
- Python 3.x
- FastAPI
- Pydantic
- Linux
/procfilesystem - Uvicorn
- Ubuntu 24.04 VM
- VSCode Remote SSH
-
GET /health -
GET /metrics/cpu -
GET /metrics/memory -
GET /metrics/network -
GET /metrics/disk
GET /healthGET /metrics/cpuGET /metrics/memoryGET /metrics/networkGET /metrics/disk
The backend is organized with a layered structure:
- Parser Layer
- Reads and parses raw data from
/proc
- Reads and parses raw data from
- Service Layer
- Calculates metrics and prepares response data
- API Layer
- Exposes FastAPI endpoints
- Schema Layer
- Defines response models with Pydantic
- CPU:
/proc/stat - Memory:
/proc/meminfo - Network:
/proc/net/dev - Disk:
/proc/diskstats
- Windows host
- Ubuntu 24.04 VM
- VSCode Remote SSH
- Python virtual environment created inside Ubuntu VM
docs/architecture.mddocs/api-spec.mddocs/dev-log.mddocs/decision-log.mddocs/troubleshooting.md
cd backendpython3 -m venv .venv
source .venv/bin/activatepip install fastapi "uvicorn[standard]"uvicorn app.main:app --reloadcurl http://127.0.0.1:8000/health
curl http://127.0.0.1:8000/metrics/memory
curl http://127.0.0.1:8000/metrics/network
curl http://127.0.0.1:8000/metrics/cpu
curl http://127.0.0.1:8000/metrics/disk- Core REST API endpoints implemented
- Memory, network, CPU, and disk metric parsing completed
- Documentation for architecture and API specification completed
- Initial validation against
/procfiles completed
- Dockerize the backend
- Learn and apply systemd service setup
- Add CLI dashboard with
rich - Consider simple frontend or visualization layer later
- Add optional alerting / filtering / rate-based metrics in future versions