#!/bin/sh # # Plugin to monitor the CPU usage 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_cputime_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 CPU time' echo 'graph_vlabel quantity' echo 'graph_category Apache' # i'm not using logtail here to avoid screwing up the results below tail -10000 /var/log/apache2/access.log | grep -v $IGNORE_IP | /usr/local/sbin/alternc_time_per_domain | tail -15 | sed 's/[-\.]/_/g' | awk '{print $2".label " $2}' exit 0 fi ${LOGTAIL} ${LOGFILE} ${OFFSET_FILE} | grep -v $IGNORE_IP | /usr/local/sbin/alternc_time_per_domain | tail -15 | sed 's/[-\.]/_/g' | awk '{print $2".value " $1}'