Add generation date to html

This commit is contained in:
Alban Bronisz 2021-11-25 22:41:53 +01:00
parent 591de32e85
commit ca47562f27
2 changed files with 9 additions and 16 deletions

View File

@ -1,11 +1,3 @@
WIP
===
- [ ] Date de génération dans la page html
Ultra-light docker monitor Ultra-light docker monitor
========================== ==========================
@ -62,8 +54,8 @@ It is simple, just run:
venv/bin/python generate_html.py 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: **Note:** if the stats file is in a remote server, one can use `scp` to get it:
```bash ```bash
scp eunuque.caracals.org:/home/caracals/outils/docker-stats-histo/stats.sqlite . 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 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 ```bash
python save_dcker_stats.py -h python save_docker_stats.py -h
python generate_html.py -h python generate_html.py -h
``` ```

View File

@ -4,6 +4,7 @@ import argparse
import logging import logging
import os import os
import sqlite3 import sqlite3
from datetime import datetime
from pathlib import Path from pathlib import Path
import pandas as pd 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.for_each_trace(lambda trace: trace.update(fillcolor=trace.line.color))
fig["layout"].pop("updatemenus") # optional, drop animation buttons fig["layout"].pop("updatemenus") # optional, drop animation buttons
fig.update_layout(transition={"duration": 1e12}) fig.update_layout(transition={"duration": 1e12})
now = datetime.now()
fig.update_layout( fig.update_layout(
title="Utilisation de RAM pour les docker-compose de l'eunuque" title="Utilisation de RAM pour les docker-compose de l'eunuque (pour voir une stat, mettre la sourie sur "
" (pour voir une stat, mettre la sourie sur le haut des courbes," f"le haut des courbes, vers les points), généré le {now.strftime('%d/%m/%Y %H:%M:%S')}",
" vers les points)",
xaxis_title="Temps", xaxis_title="Temps",
yaxis_title="RAM", yaxis_title="RAM",
) )