This commit is contained in:
Alban Bronisz 2021-12-03 00:06:42 +01:00
parent 7b915ee41d
commit c4114c1c5e

View File

@ -26,26 +26,14 @@ python --version
deactivate deactivate
``` ```
Configure the stats export Export stats
-------------------------- ------------
Open the cron tab in edition mode:
```bash ```bash
crontab -e ./save_docker_stats.sh
or
python save_docker_stats.py
``` ```
Then add a new line (to run the check each 10 minutes)
```bash
*/10 * * * * /path/to/docker-stats-histo/save_docker_stats.sh > /dev/null 2>&1
```
**Note:**
- Normally cron send task outputs (echo) via mail. As the MTA (Mail Transfer Agent),
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.
Display stats Display stats
------------- -------------
This step permits to generate an html interactive render from the sqlite stats file. This step permits to generate an html interactive render from the sqlite stats file.
@ -61,6 +49,28 @@ The report is now accessible in `stats.html`.
scp eunuque.caracals.org:/home/caracals/outils/docker-stats-histo/stats.sqlite . scp eunuque.caracals.org:/home/caracals/outils/docker-stats-histo/stats.sqlite .
``` ```
Automations using cron
----------------------
Open the cron tab in edition mode:
```bash
crontab -e
```
Then add those lines (to run the check each 10 minutes and a html generation each hour)
```bash
*/10 * * * * /path/to/docker-stats-histo/save_docker_stats.sh > /dev/null 2>&1
00 */1 * * * /path/to/docker-stats-histo/generate_html.sh > /dev/null 2>&1
```
**Note:**
- Normally cron send task outputs (echo) via mail. As the MTA (Mail Transfer Agent),
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.
Advanced parameters Advanced parameters
------------------- -------------------
Both python scripts can have a finer configuration (sqlite and html paths). Both python scripts can have a finer configuration (sqlite and html paths).