This commit is contained in:
Alban Bronisz 2021-02-13 20:23:19 +01:00
parent ff76f43e14
commit e460e8f49d

View File

@ -13,43 +13,45 @@ The export and the display are two different parts. This allow to run the displa
Setup the stats export Setup the stats export
---------------------- ----------------------
To add it to the cron tab: Open the cron tab in edition mode:
crontab -e crontab -e
The add new line (to run the check once per hour) Then add a new line (to run the check each ten minutes)
*/10 * * * * /path.io/docker-stats-histo/save_docker_stats.sh >>/dev/null 2>&1 */10 * * * * /path.io/docker-stats-histo/save_docker_stats.sh >>/dev/null 2>&1
**Note:** **Note:**
- Normaly cron send task outputs (echo) via mail. As the MTA (Mail Transfert Agent), may not be set up, - Normaly cron send task outputs (echo) via mail. As the MTA (Mail Transfert Agent),
the crontab line redirect the outputs into `/dev/null`. Can also be a path to a log file. may not be set up, the crontab line redirect the outputs into `/dev/null`.
It can also be a path to a log file.
- No sudo is needed, crontab is called with current user. - No sudo is needed, crontab is called with current user.
Display stats Display stats
------------- -------------
This steps permit to generate a render from a stats file (generated by the script This step permits to generate a render from a stats file (generated by the script
called by the crontab, see stats export section). called by the crontab, see stats export section).
### Install ### Install
Need python3 with venv module Need python3 with `venv` module
sudo apt install python3 python3-venv sudo apt install python3 python3-venv
### Run ### Run
Go in [display](display) folder Go in [display](display) folder
cd display cd display
Then to generate a png, just run (install is automatically done if needed) Then to generate a png, just run (install is automatically done if needed)
./render_stats.sh stats.json ./render_stats.sh stats.json
It is also possible to see a web version fo the render : It is also possible to see a web version fo the render :
./render_stats.sh stats.json -w ./render_stats.sh stats.json -w
**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: