agent
This commit is contained in:
38
agent/app/api/health.py
Normal file
38
agent/app/api/health.py
Normal file
@@ -0,0 +1,38 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import platform
|
||||
import shutil
|
||||
import socket
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
from app.config import settings
|
||||
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/health")
|
||||
def health() -> dict[str, str]:
|
||||
return {
|
||||
"status": "online",
|
||||
"agentVersion": settings.agent_version,
|
||||
"hostname": socket.gethostname(),
|
||||
"os": platform.platform(),
|
||||
"architecture": platform.machine(),
|
||||
}
|
||||
|
||||
|
||||
@router.get("/system-info")
|
||||
def system_info() -> dict[str, str]:
|
||||
disk = shutil.disk_usage("/")
|
||||
memory_total = "unknown"
|
||||
return {
|
||||
"hostname": socket.gethostname(),
|
||||
"os": platform.platform(),
|
||||
"kernel": platform.release(),
|
||||
"architecture": platform.machine(),
|
||||
"diskFree": f"{disk.free // (1024 ** 3)}GB",
|
||||
"memoryTotal": memory_total,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user