#!/bin/sh # # Plugin to monitor the hits per virtual domains # # Parameters: # # config # autoconf # # #%# family=contrib #%# capabilities=autoconf #if [ "$1" = "autoconf" ]; then # if [ -f $CACHEFILE ]; then # echo yes # exit 0 # else # echo "no (could not find cache file)" # fi # exit 1 #fi LOGFILE=${logfile:-/var/log/apache2/access.log} OFFSET_FILE=/var/lib/munin/plugin-state/apache_hits_per_domain_${SERVICE}.offset LOGTAIL=${logtail:-/usr/sbin/logtail} # [ML] 2009-03-31 : Filtering out 209.44.112.65, the load balancer (does regular pings) IGNORE_IP="209.44.112.65" if [ "$1" = "config" ]; then echo 'graph_title Most active sites' echo 'graph_vlabel quantity' echo 'graph_category Apache' # echo 'graph_scale no' # echo 'graph_args --base 1024 -l 0' # i'm not using logtail here to avoid screwing up the results below tail -10000 /var/log/apache2/access.log | grep -v $IGNORE_IP | /root/bin/hits_per_domain | tail -10 | awk '{gsub(/[-\.]/,"_",$2); print $2".label "$2}' exit 0 fi ${LOGTAIL} ${LOGFILE} ${OFFSET_FILE} | grep -v $IGNORE_IP | awk '{print $NF}' | sort | uniq -c | sort -n | tail -10 | sed 's/[-\.]/_/g' | awk '{print $2".value " $1}'