README upgrade

main
pporcheret 2023-07-04 17:54:21 +02:00
parent 538319ac71
commit b5f33685aa
2 changed files with 10 additions and 2 deletions

View File

@ -196,6 +196,8 @@ v2:
v2.1 On going : v2.1 On going :
- [x] Add Network usage - [x] Add Network usage
- [x] Add boot time
- [x] Update dynamically Progress Bar
Next: Next:

10
app.py
View File

@ -23,6 +23,10 @@ def get_remote(hostname, port, username, password, local_script_path, remote_scr
finally: finally:
ssh.close() ssh.close()
def get_boot_time(psboot):
boot_time = datetime.fromtimestamp(psboot - 60)
return str(boot_time)
def get_full(node): def get_full(node):
remote_info = get_remote(node, ssh_conf.port, ssh_conf.username, ssh_conf.password, paths.agent_path, paths.remote_path) remote_info = get_remote(node, ssh_conf.port, ssh_conf.username, ssh_conf.password, paths.agent_path, paths.remote_path)
full = eval(remote_info) full = eval(remote_info)
@ -32,12 +36,14 @@ def get_full(node):
def get_info(): def get_info():
node = 'localhost' node = 'localhost'
full = get_full(node) full = get_full(node)
return render_template('index.html', full = full, client = client, titre = flask_conf.title, node = node) boottime = get_boot_time(full['boot_time'])
return render_template('index.html', full = full, client = client, titre = flask_conf.title, node = node, boottime = boottime)
@app.route("/n/<node>", methods = ['POST', 'GET']) @app.route("/n/<node>", methods = ['POST', 'GET'])
def get_node_info(node): def get_node_info(node):
full = get_full(node) full = get_full(node)
return render_template('index.html', full = full, client = client, titre = flask_conf.title, node = node) boottime = get_boot_time(full['boot_time'])
return render_template('index.html', full = full, client = client, titre = flask_conf.title, node = node, boottime = boottime)
def get_ressources(nodename): def get_ressources(nodename):
while True: while True: