2020-06-14 18:45:58 +02:00
|
|
|
import psutil
|
2020-06-14 12:08:11 +02:00
|
|
|
from django.views.generic import TemplateView
|
|
|
|
|
|
|
|
from sdbs_infra.dashboard.models import Service
|
|
|
|
|
|
|
|
|
|
|
|
class IndexView(TemplateView):
|
|
|
|
template_name = "index.html"
|
|
|
|
|
|
|
|
def get_context_data(self, **kwargs):
|
2020-06-14 18:45:58 +02:00
|
|
|
vps_stats = f"LOAD AVG: {', '.join(map(str, psutil.getloadavg()))} / " \
|
|
|
|
f"MEM: {psutil.virtual_memory().percent}% USED / " \
|
|
|
|
f"DISK: {psutil.disk_usage('/').percent}% USED"
|
|
|
|
|
2020-06-14 12:08:11 +02:00
|
|
|
return {
|
2020-06-14 18:45:58 +02:00
|
|
|
'services': Service.objects.all(),
|
|
|
|
'vps_stats': vps_stats
|
2020-06-14 12:08:11 +02:00
|
|
|
}
|