[munin/innd_last] On garde le compte precedent quand news.daily tourne

Pour eviter de tomber a 0 quand news.daily fait sa rotation des logs ...

darcs-hash:20100301091824-ddb99-65bf81d809ed322a5ef719dd357a96afb239914d.gz
This commit is contained in:
Michel Blockelet 2010-03-01 10:18:24 +01:00
parent 5c484241b2
commit 3c09e7ffc2

View file

@ -33,11 +33,17 @@ if [ "$1" = "config" ]; then
exit 0
fi
## Sortie
## Fichier(s) temporaire(s)
TMPFILE="/tmp/munin_innd_last"
## Récupération des logs
# Si news.daily est en cours d'exécution, on réutilise le fichier précédent
if ! ( [ -f /var/run/news/LOCK.news.daily ] && [ -f $TMPFILE ] )
then
zcat -f /var/log/news/OLD/news.notice.3.gz /var/log/news/OLD/news.notice.2.gz /var/log/news/OLD/news.notice.1.gz /var/log/news/news.notice | grep "post ok" > $TMPFILE 2> /dev/null
fi
## Récupération des 24 dernières heures
CURDATE=`date +%s`
DATE=0
while [ $(($CURDATE - $DATE)) -gt 86400 ]
@ -48,7 +54,8 @@ do
DATE=`date -d "$DATESTR" +%s`
done
## Comptage
echo -n "posts.value "
cat $TMPFILE | wc -l
rm -f $TMPFILE ${TMPFILE}2 &> /dev/null
rm -f ${TMPFILE}2 &> /dev/null