diff --git a/README.md b/README.md index 13d3179..30a9fd5 100644 --- a/README.md +++ b/README.md @@ -196,6 +196,8 @@ v2: v2.1 On going : - [x] Add Network usage +- [x] Add boot time +- [x] Update dynamically Progress Bar Next: diff --git a/app.py b/app.py index 254f2a6..817e841 100755 --- a/app.py +++ b/app.py @@ -23,6 +23,10 @@ def get_remote(hostname, port, username, password, local_script_path, remote_scr finally: ssh.close() +def get_boot_time(psboot): + boot_time = datetime.fromtimestamp(psboot - 60) + return str(boot_time) + def get_full(node): remote_info = get_remote(node, ssh_conf.port, ssh_conf.username, ssh_conf.password, paths.agent_path, paths.remote_path) full = eval(remote_info) @@ -32,12 +36,14 @@ def get_full(node): def get_info(): node = 'localhost' 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/", methods = ['POST', 'GET']) def get_node_info(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): while True: