[munin/innd_*] Import initial de innd_last, corrections

darcs-hash:20090330124424-ddb99-69b33343e6ce18eda8a89e027b74f3b8a0a984f2.gz
This commit is contained in:
Michel Blockelet 2009-03-30 14:44:24 +02:00
parent de47e037de
commit 3e938bbac8
2 changed files with 37 additions and 4 deletions

30
munin/innd_last Executable file
View file

@ -0,0 +1,30 @@
#!/bin/sh
if [ "$1" = "config" ]; then
echo 'host_name news.crans.org'
echo 'graph_title Posts de moins de 24h'
echo "graph_args --base 1000 --lower-limit 0"
echo "graph_vlabel posts"
echo "graph_category News"
echo "posts.label posts"
exit 0
fi
TMPFILE="/tmp/munin_innd_last"
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
CURDATE=`date +%s`
DATE=0
while [ $(($CURDATE - $DATE)) -gt 86400 ]
do
tail -n +2 $TMPFILE > ${TMPFILE}2
cp ${TMPFILE}2 $TMPFILE
DATESTR=`head -n 1 $TMPFILE | cut -d ' ' -f 1-3`
DATE=`date -d "$DATESTR" +%s`
done
echo -n "posts.value "
cat $TMPFILE | wc -l
rm -f $TMPFILE ${TMPFILE}2 &> /dev/null