add system stats display; distribute elements evenly
This commit is contained in:
parent
aad93e30e7
commit
ffb07c2b7e
5 changed files with 42 additions and 7 deletions
26
poetry.lock
generated
26
poetry.lock
generated
|
@ -57,6 +57,17 @@ optional = false
|
|||
python-versions = ">=3.5"
|
||||
version = "7.1.2"
|
||||
|
||||
[[package]]
|
||||
category = "main"
|
||||
description = "Cross-platform lib for process and system monitoring in Python."
|
||||
name = "psutil"
|
||||
optional = false
|
||||
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
version = "5.7.0"
|
||||
|
||||
[package.extras]
|
||||
enum = ["enum34"]
|
||||
|
||||
[[package]]
|
||||
category = "main"
|
||||
description = "World timezone definitions, modern and historical"
|
||||
|
@ -82,7 +93,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
|||
version = "0.3.1"
|
||||
|
||||
[metadata]
|
||||
content-hash = "e59cbc9240f4a13c17bade71c39a64fe70c17eaf4746afc82fc9a36b5fa4ae10"
|
||||
content-hash = "f75bdf08cdd88dbaee13ad801096db3236efb2858c38232f9be05973f3e72cd7"
|
||||
python-versions = "^3.7"
|
||||
|
||||
[metadata.files]
|
||||
|
@ -128,6 +139,19 @@ pillow = [
|
|||
{file = "Pillow-7.1.2-py3.8-macosx-10.9-x86_64.egg", hash = "sha256:70e3e0d99a0dcda66283a185f80697a9b08806963c6149c8e6c5f452b2aa59c0"},
|
||||
{file = "Pillow-7.1.2.tar.gz", hash = "sha256:a0b49960110bc6ff5fead46013bcb8825d101026d466f3a4de3476defe0fb0dd"},
|
||||
]
|
||||
psutil = [
|
||||
{file = "psutil-5.7.0-cp27-none-win32.whl", hash = "sha256:298af2f14b635c3c7118fd9183843f4e73e681bb6f01e12284d4d70d48a60953"},
|
||||
{file = "psutil-5.7.0-cp27-none-win_amd64.whl", hash = "sha256:75e22717d4dbc7ca529ec5063000b2b294fc9a367f9c9ede1f65846c7955fd38"},
|
||||
{file = "psutil-5.7.0-cp35-cp35m-win32.whl", hash = "sha256:f344ca230dd8e8d5eee16827596f1c22ec0876127c28e800d7ae20ed44c4b310"},
|
||||
{file = "psutil-5.7.0-cp35-cp35m-win_amd64.whl", hash = "sha256:e2d0c5b07c6fe5a87fa27b7855017edb0d52ee73b71e6ee368fae268605cc3f5"},
|
||||
{file = "psutil-5.7.0-cp36-cp36m-win32.whl", hash = "sha256:a02f4ac50d4a23253b68233b07e7cdb567bd025b982d5cf0ee78296990c22d9e"},
|
||||
{file = "psutil-5.7.0-cp36-cp36m-win_amd64.whl", hash = "sha256:1413f4158eb50e110777c4f15d7c759521703bd6beb58926f1d562da40180058"},
|
||||
{file = "psutil-5.7.0-cp37-cp37m-win32.whl", hash = "sha256:d008ddc00c6906ec80040d26dc2d3e3962109e40ad07fd8a12d0284ce5e0e4f8"},
|
||||
{file = "psutil-5.7.0-cp37-cp37m-win_amd64.whl", hash = "sha256:73f35ab66c6c7a9ce82ba44b1e9b1050be2a80cd4dcc3352cc108656b115c74f"},
|
||||
{file = "psutil-5.7.0-cp38-cp38-win32.whl", hash = "sha256:60b86f327c198561f101a92be1995f9ae0399736b6eced8f24af41ec64fb88d4"},
|
||||
{file = "psutil-5.7.0-cp38-cp38-win_amd64.whl", hash = "sha256:d84029b190c8a66a946e28b4d3934d2ca1528ec94764b180f7d6ea57b0e75e26"},
|
||||
{file = "psutil-5.7.0.tar.gz", hash = "sha256:685ec16ca14d079455892f25bd124df26ff9137664af445563c1bd36629b5e0e"},
|
||||
]
|
||||
pytz = [
|
||||
{file = "pytz-2020.1-py2.py3-none-any.whl", hash = "sha256:a494d53b6d39c3c6e44c3bec237336e14305e4f29bbf800b599253057fbb79ed"},
|
||||
{file = "pytz-2020.1.tar.gz", hash = "sha256:c35965d010ce31b23eeb663ed3cc8c906275d6be1a34393a1d73a41febf4a048"},
|
||||
|
|
|
@ -10,6 +10,7 @@ django = "^3.0.7"
|
|||
django-ordered-model = "^3.4.1"
|
||||
Pillow = "^7.1.2"
|
||||
beautifulsoup4 = "^4.9.1"
|
||||
psutil = "^5.7.0"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
html, body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
background: black;
|
||||
color: white;
|
||||
|
@ -8,6 +13,7 @@ body {
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
|
||||
|
||||
|
@ -21,10 +27,6 @@ h1, h2 {
|
|||
margin: 1rem 0;
|
||||
}
|
||||
|
||||
header {
|
||||
margin: 1rem 0;
|
||||
}
|
||||
|
||||
main {
|
||||
width: 100vw;
|
||||
display: flex;
|
||||
|
|
|
@ -32,5 +32,8 @@
|
|||
</a>
|
||||
{% endfor %}
|
||||
</main>
|
||||
<footer>
|
||||
VPS STATS — {{ vps_stats }}
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
|
@ -1,4 +1,4 @@
|
|||
from django.views.decorators.cache import cache_page
|
||||
import psutil
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
from sdbs_infra.dashboard.models import Service
|
||||
|
@ -8,6 +8,11 @@ class IndexView(TemplateView):
|
|||
template_name = "index.html"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
vps_stats = f"LOAD AVG: {', '.join(map(str, psutil.getloadavg()))} / " \
|
||||
f"MEM: {psutil.virtual_memory().percent}% USED / " \
|
||||
f"DISK: {psutil.disk_usage('/').percent}% USED"
|
||||
|
||||
return {
|
||||
'services': Service.objects.all()
|
||||
'services': Service.objects.all(),
|
||||
'vps_stats': vps_stats
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue