Added script to process mirrorlist logs
Signed-off-by: Adrian Reber <adrian@lisas.de>
This commit is contained in:
parent
1392043bbd
commit
975bdd5ce0
2 changed files with 45 additions and 0 deletions
|
@ -56,6 +56,7 @@
|
|||
- sync_pkl_to_mirrorlists.sh
|
||||
- handle_propagation.sh
|
||||
- create_maps.sh
|
||||
- create_statistics.sh
|
||||
|
||||
- name: handle propagation cronjob
|
||||
cron: name="handle-propagation" minute="45" hour="*/2" user="mirrormanager"
|
||||
|
@ -67,6 +68,16 @@
|
|||
job="/usr/local/bin/create_maps.sh"
|
||||
cron_file=create-worldmap
|
||||
|
||||
- name: create mirrorlist statistics cronjob
|
||||
cron: name="create-statistics" minute="4" hour="*/2" user="mirrormanager"
|
||||
job="/usr/local/bin/create_statistics.sh"
|
||||
cron_file=create-statistics
|
||||
|
||||
- name: create yesterdays mirrorlist statistics cronjob
|
||||
cron: name="yesterdays-statistics" minute="15" hour="0" user="mirrormanager"
|
||||
job="/usr/local/bin/create_statistics.sh yesterday"
|
||||
cron_file=yesterdays-statistics
|
||||
|
||||
- name: setup /var/lib/mirrormanager/.ssh directory
|
||||
copy: >
|
||||
src="{{ private }}/files/mirrormanager/"
|
||||
|
|
34
roles/mirrormanager/backend/templates/create_statistics.sh
Normal file
34
roles/mirrormanager/backend/templates/create_statistics.sh
Normal file
|
@ -0,0 +1,34 @@
|
|||
#!/bin/sh
|
||||
|
||||
MIRRORLIST_SERVERS="{% for host in groups['mirrorlist2'] %} {{ host }} {% endfor %}"
|
||||
FRONTENDS="{% for host in groups['mm-frontend'] %} {{ host }} {% endfor %}"
|
||||
|
||||
INPUT="/var/log/mirrormanager/mirrorlist.log"
|
||||
|
||||
if [ "$1" == "yesterday" ]; then
|
||||
DATE=`date +%Y-%m-%d --date='yesterday'`
|
||||
STATISTICS="/usr/bin/mirrorlist_statistics -o 1"
|
||||
DEST="/var/www/mirrormanager-statistics/data/`date +%Y/%m --date='yesterday'`"
|
||||
else
|
||||
DATE=`date +%Y-%m-%d`
|
||||
STATISTICS="/usr/bin/mirrorlist_statistics"
|
||||
DEST="/var/www/mirrormanager-statistics/data/`date +%Y/%m`"
|
||||
fi
|
||||
|
||||
INFILE=${INPUT}.${DATE}
|
||||
|
||||
OUTPUT=`mktemp -d`
|
||||
|
||||
#trap "rm -f ${OUTPUT}/*; rmdir ${OUTPUT}" QUIT TERM INT HUP EXIT
|
||||
|
||||
# Fetch compressed log files
|
||||
for s in ${MIRRORLIST_SERVERS}; do
|
||||
ssh $s "( cat $INFILE | gzip -4 )" >> ${OUTPUT}/mirrorlist.log.gz
|
||||
done
|
||||
|
||||
${STATISTICS} -l ${OUTPUT}/mirrorlist.log.gz -d ${OUTPUT}/
|
||||
|
||||
for f in ${FRONTENDS}; do
|
||||
ssh ${f} mkdir -p ${DEST}
|
||||
rsync -aq ${OUTPUT}/{*.png,*.txt} ${f}:${DEST}
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue