From ca47562f27c4ae43fca573f42f03d831733a0c6d Mon Sep 17 00:00:00 2001 From: Alban Bronisz Date: Thu, 25 Nov 2021 22:41:53 +0100 Subject: [PATCH] Add generation date to html --- README.md | 18 +++++------------- generate_html.py | 7 ++++--- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 913729a..81bc674 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,3 @@ - - -WIP -=== - -- [ ] Date de génération dans la page html - - Ultra-light docker monitor ========================== @@ -62,8 +54,8 @@ It is simple, just run: venv/bin/python generate_html.py ``` -The report is now accessible in `stats.html. -` +The report is now accessible in `stats.html`. + **Note:** if the stats file is in a remote server, one can use `scp` to get it: ```bash scp eunuque.caracals.org:/home/caracals/outils/docker-stats-histo/stats.sqlite . @@ -71,9 +63,9 @@ scp eunuque.caracals.org:/home/caracals/outils/docker-stats-histo/stats.sqlite . Advanced parameters ------------------- -Both python scripts can have a finer configuration. To see all accepted parameters use `-h` flag, like +Both python scripts can have a finer configuration (sqlite and html paths). +To see all accepted parameters use `-h` flag, like ```bash -python save_dcker_stats.py -h +python save_docker_stats.py -h python generate_html.py -h ``` - diff --git a/generate_html.py b/generate_html.py index 1b824f0..fab3f86 100644 --- a/generate_html.py +++ b/generate_html.py @@ -4,6 +4,7 @@ import argparse import logging import os import sqlite3 +from datetime import datetime from pathlib import Path import pandas as pd @@ -62,10 +63,10 @@ def generate_html_report(sqlite_fn: Path, html_fn: Path): fig.for_each_trace(lambda trace: trace.update(fillcolor=trace.line.color)) fig["layout"].pop("updatemenus") # optional, drop animation buttons fig.update_layout(transition={"duration": 1e12}) + now = datetime.now() fig.update_layout( - title="Utilisation de RAM pour les docker-compose de l'eunuque" - " (pour voir une stat, mettre la sourie sur le haut des courbes," - " vers les points)", + title="Utilisation de RAM pour les docker-compose de l'eunuque (pour voir une stat, mettre la sourie sur " + f"le haut des courbes, vers les points), généré le {now.strftime('%d/%m/%Y %H:%M:%S')}", xaxis_title="Temps", yaxis_title="RAM", )