add uptime to vps stats

This commit is contained in:
Tomáš Mládek 2020-06-15 12:01:11 +02:00
parent 979bbe97e1
commit c4c38324e9

View file

@ -1,6 +1,8 @@
import time
import psutil
from django.views.generic import TemplateView
from humanize import naturalsize
from humanize import naturalsize, naturaldelta
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)"
)
stats.append(
f"<em>UPTIME:</em> {naturaldelta(time.time() - psutil.boot_time())}"
)
return " / ".join(stats)