add web template
parent
4aee62f1e3
commit
21088b390f
|
@ -19,9 +19,9 @@ for n in parameter:
|
|||
|
||||
|
||||
cpu_meas=meas_data(var_name="temperature",ring_length=parameter['ring_length'],device=parameter['device'],sensor="CPU",store_file="/home/pi/log/data_cpu",digits=4,check_last=parameter['check_last'])
|
||||
#cpu_meas.set_sql(host="localhost",port=24048,min_wait=60)
|
||||
#cpu_meas.set_rsa('key.der')
|
||||
#requests.post("http://localhost:8080/data/"+str(cpu_meas.json_out['hash']),json=cpu_meas.json_out)
|
||||
cpu_meas.set_sql(host="localhost",port=24048,min_wait=60)
|
||||
cpu_meas.set_rsa('@radew')
|
||||
requests.post("http://localhost:8080/data/"+str(cpu_meas.json_out['hash']),json=cpu_meas.json_out)
|
||||
|
||||
if "sqlserver" in log_conf:
|
||||
hostname="banana"
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Übersicht {{server}}</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Auslastung: {{cpupercent}}</p>
|
||||
<p>Aktuelle Variablen:
|
||||
<ul>
|
||||
%for item in measdata:
|
||||
%measlen=len(measdata[item]['measures'])
|
||||
<li>{{measdata[item]['varname']}}: {{measlen}}</li>
|
||||
%end
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
10
pyweb.py
10
pyweb.py
|
@ -1,5 +1,5 @@
|
|||
from bottle import get,post,request,Bottle,run
|
||||
import threading,time,json,zlib,gnupg
|
||||
from bottle import get,post,request,Bottle,run,template
|
||||
import threading,time,json,zlib,gnupg,socket,psutil
|
||||
from queue import Queue
|
||||
|
||||
|
||||
|
@ -17,6 +17,7 @@ def sql_insert(q):
|
|||
while True:
|
||||
if q.empty():
|
||||
time.sleep(0.1)
|
||||
print("ping"+str(time.time()))
|
||||
else:
|
||||
try:
|
||||
indata=q.get()
|
||||
|
@ -40,10 +41,7 @@ app=Bottle()
|
|||
|
||||
@app.get('/')
|
||||
def approot():
|
||||
return '''
|
||||
<a href="/haus">Dateneingabe Haus</a></br>
|
||||
<a href="/kfz">Dateneingabe KFZ</a></br>
|
||||
'''
|
||||
return template('main.tpl',server=socket.gethostname(),cpupercent=psutil.cpu_percent(),measdata=measdata)
|
||||
|
||||
@app.post('/data/<hash_id:int>')
|
||||
def dataimport(hash_id):
|
||||
|
|
Loading…
Reference in New Issue