Commit f9c41455 authored by Marc Duez's avatar Marc Duez

server : admin page display some basic info (no more rabbit)

parent 98fce2bf
......@@ -1344,3 +1344,14 @@ table.log textarea {
margin-top: 200px;
background: #FFF;
}
.console-div {
display: flex;
padding: 5px 0px;
background: grey;
color: white;
font-family: monospace;
white-space: pre-line;
}
.console-flex {
flex-grow: 1;
}
......@@ -1344,3 +1344,14 @@ table.log textarea {
margin-top: 200px;
background: #FFF;
}
.console-div {
display: flex;
padding: 5px 0px;
background: grey;
color: white;
font-family: monospace;
white-space: pre-line;
}
.console-flex {
flex-grow: 1;
}
......@@ -1526,4 +1526,17 @@ text-align: center;
font-size: 200%;
margin-top: 200px;
background: #FFF;
}
.console-div{
display:flex;
padding:5px 0px;
background:grey;
color:white;
font-family:monospace;
white-space: pre-line;
}
.console-flex{
flex-grow : 1;
}
\ No newline at end of file
# coding: utf8
import gluon.contrib.simplejson, re
import os.path
import os.path, subprocess
import vidjil_utils
if request.env.http_origin:
......@@ -12,7 +12,19 @@ if request.env.http_origin:
## return admin_panel
def index():
if auth.has_membership("admin"):
return dict(message=T(''))
p = subprocess.Popen(["uptime"], stdout=subprocess.PIPE)
uptime, err = p.communicate()
p = subprocess.Popen(["df", "-h"], stdout=subprocess.PIPE)
disk_use, err = p.communicate()
return dict(worker = len(db().select(db.scheduler_worker.ALL)),
in_queue = len(db(db.scheduler_task.status=='QUEUED').select()),
running = len(db(db.scheduler_task.status=='RUNNING').select()),
uptime=uptime,
disk_use=disk_use
)
def worker():
if auth.has_membership("admin"):
......
{{extend 'db_layout.html'}}
Bientot vous trouverez içi un magnifique panneau d'administration, en attendant voila un lapin.</br>
<img src="http://upload.wikimedia.org/wikipedia/commons/3/3b/Rabbit_in_montana.jpg" style="width:200px; height:200px;">
</br>
<a class="button" onclick="db.call('results_file/index');">liste des fichiers result (data)</a>
......@@ -17,3 +14,28 @@ Bientot vous trouverez içi un magnifique panneau d'administration, en attendant
</br>
<a class="button" onclick="db.call('default/user/register');">register user</a>
</br>
<div>
Worker status
<div class="console-div">
<div class="console-flex">active worker : {{=worker}}</div>
<div class="console-flex">run in process : {{=running}}</div>
<div class="console-flex">run in queue : {{=in_queue}}</div>
</div>
</div>
<div>
Server status
<div class="console-div">
<div class="console-flex">{{=uptime}}</div>
</div>
</div>
<div>
Server disk usage
<div class="console-div">
<div class="console-flex">{{=disk_use}}</div>
</div>
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment