X-Git-Url: http://git.onelab.eu/?p=myops.git;a=blobdiff_plain;f=web%2Fcollect%2Fserver%2Fcron.hourly%2Fload_all_couchdb.sh;fp=web%2Fcollect%2Fserver%2Fcron.hourly%2Fload_all_couchdb.sh;h=40d76dd42eaab3248514a7cf82bfecaaa96d4d4b;hp=0000000000000000000000000000000000000000;hb=85070b3d456667f238051af1a2f1f2a0c12300ab;hpb=607f0e13927eb18075c375fa9ba5527da4fcbb44 diff --git a/web/collect/server/cron.hourly/load_all_couchdb.sh b/web/collect/server/cron.hourly/load_all_couchdb.sh new file mode 100755 index 0000000..40d76dd --- /dev/null +++ b/web/collect/server/cron.hourly/load_all_couchdb.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +PREFIX=/var/www/html/uploadlogs/raw +EXEC_PREFIX=/usr/share/myops/web/collect/server + +lasthour=`date +%Y-%m-%dT%H -d "1 hour ago"` +mkdir -p $PREFIX/old/$lasthour +for file in `ls $PREFIX/$lasthour*--upload`; do + $EXEC_PREFIX/load_couch.py $file && mv $file $PREFIX/old/$lasthour +done + +#NOTE: temporary; catch any stragglers still being sent to monitor and copied here +for file in `ls /root/$lasthour*--upload`; do + $EXEC_PREFIX/load_couch.py $file && mv $file $PREFIX/old/$lasthour +done + +$EXEC_PREFIX/summarize_logs.sh || : +$EXEC_PREFIX/summarize_rpms.sh || : +$EXEC_PREFIX/summarize_stats.sh || : + +thishour=`date +%Y-%m-%dT%H` +mkdir -p $PREFIX/old/$thishour +# NOTE: do it twice for all the files that were uploaded while the above was running. +for file in `ls $PREFIX/$thishour*--upload`; do + $EXEC_PREFIX/load_couch.py $file && mv $file $PREFIX/old/$thishour +done + +curl -s 'http://HOSTNAME:5984/myops/_design/myops/_list/nodelist/node-status?fields=hostname&skip_header' | wc -l &> /dev/null