add uptime to vps stats
This commit is contained in:
parent
979bbe97e1
commit
c4c38324e9
1 changed files with 7 additions and 1 deletions
|
@ -1,6 +1,8 @@
|
||||||
|
import time
|
||||||
|
|
||||||
import psutil
|
import psutil
|
||||||
from django.views.generic import TemplateView
|
from django.views.generic import TemplateView
|
||||||
from humanize import naturalsize
|
from humanize import naturalsize, naturaldelta
|
||||||
|
|
||||||
from sdbs_infra.dashboard.models import Service
|
from sdbs_infra.dashboard.models import Service
|
||||||
|
|
||||||
|
@ -31,4 +33,8 @@ class IndexView(TemplateView):
|
||||||
f"<em>DISK:</em> {naturalsize(disk.used)}/{naturalsize(disk.total)} ({disk.percent}% USED)"
|
f"<em>DISK:</em> {naturalsize(disk.used)}/{naturalsize(disk.total)} ({disk.percent}% USED)"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
stats.append(
|
||||||
|
f"<em>UPTIME:</em> {naturaldelta(time.time() - psutil.boot_time())}"
|
||||||
|
)
|
||||||
|
|
||||||
return " / ".join(stats)
|
return " / ".join(stats)
|
||||||
|
|
Loading…
Reference in a new issue