mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 14:01:15 +02:00
feat: Enhance information displayed on the system status dashboard
This commit is contained in:
1 parent
f65d9b17c6
commit
a35df76384
4 files changed
+73
-2
No files matched your search
@@ -17,6 +17,8 @@
|
||||
import asyncio
|
||||
import signal
|
||||
import os
|
||||
import time
|
||||
import psutil
|
||||
|
||||
from fastapi import APIRouter, Request, Depends, WebSocket, WebSocketDisconnect, status
|
||||
from fastapi.responses import StreamingResponse
|
||||
@@ -42,6 +44,13 @@ log = logging.getLogger(__name__)
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
def get_server_uptime_seconds() -> int:
|
||||
try:
|
||||
return max(0, int(time.time() - psutil.Process().create_time()))
|
||||
except psutil.Error:
|
||||
return 0
|
||||
|
||||
|
||||
@router.get(
|
||||
"/version",
|
||||
response_model=schemas.Version,
|
||||
@@ -246,6 +255,7 @@ async def statistics() -> dict:
|
||||
webwireshark_stats = await collect_webwireshark_stats(projects)
|
||||
|
||||
return {
|
||||
"uptime_seconds": get_server_uptime_seconds(),
|
||||
"computes": compute_statistics,
|
||||
"projects": project_stats,
|
||||
"nodes": node_stats,
|
||||
|
||||
Reference in new issue
Block a user