OL: graphs statistics
OL statistics are present in two different graphics:
They are generated through two scripts:
:: /opt/openlibrary/openlibrary/scripts/ipstats.py
runs on ol-www1
that create the graph:
:: /opt/openlibrary/openlibrary/scripts/store_counts.py
runs on ol-home
To generate the count stats of the past n days, execute the command:
giovanni@ol-home:~$ sudo -s root@ol-home:/home/giovanni# su openlibrary openlibrary@ol-home:/home/giovanni$ source /opt/openlibrary/venv/bin/activate (venv)openlibrary@ol-home:/home/giovanni$ cd /opt/openlibrary/openlibrary/scripts/ (venv)openlibrary@ol-home:/opt/openlibrary/openlibrary/scripts$ |
and run the command:
$ python store_counts.py /opt/openlibrary/olsystem/etc/infobase.yml /opt/openlibrary/olsystem/etc/openlibrary.yml /opt/openlibrary/olsystem/etc/coverstore.yml n
The scripts run as scheduled in the /etc/cron.d/openlibrary
0 * * * * openlibrary /olsystem/bin/verify-node.sh ol-home && /olsystem/bin/olenv $SCRIPTS/store_counts.py /opt/openlibrary/olsystem/etc/infobase.yml /opt/openlibrary/olsystem/etc/openlibrary.yml /opt/openlibrary/olsystem/etc/coverstore.yml 1 0 * * * * www-data /olsystem/bin/verify-node.sh ol-www1 && /olsystem/bin/olenv $SCRIPTS/ipstats.py /opt/openlibrary/olsystem/etc/openlibrary.yml 59 23 * * * openlibrary /olsystem/bin/verify-node.sh ol-home && /olsystem/bin/olenv $SCRIPTS/store_counts.py /opt/openlibrary/olsystem/etc/infobase.yml /opt/openlibrary/olsystem/etc/openlibrary.yml /opt/openlibrary/olsystem/etc/coverstore.yml 1 59 23 * * * www-data /olsystem/bin/verify-node.sh ol-www1 && /olsystem/bin/olenv $SCRIPTS/ipstats.py /opt/openlibrary/olsystem/etc/openlibrary.yml |
When, for some reason, the graphs are broken you have to run the scripts manually.
Be careful running them within the right days window.
See the code for the details:
https://github.com/internetarchive/openlibrary/blob/master/scripts/ipstats.py
https://github.com/internetarchive/openlibrary/blob/master/scripts/store_counts.py