root / plugins / apache_cpu_per_domain @ 8f2bcef9
Historique | Voir | Annoter | Télécharger (1,12 ko)
| 1 |
#!/bin/sh |
|---|---|
| 2 |
# |
| 3 |
# Plugin to monitor the CPU usage per virtual domains |
| 4 |
# |
| 5 |
# Parameters: |
| 6 |
# |
| 7 |
# config |
| 8 |
# autoconf |
| 9 |
# |
| 10 |
# |
| 11 |
#%# family=contrib |
| 12 |
#%# capabilities=autoconf |
| 13 |
|
| 14 |
#if [ "$1" = "autoconf" ]; then |
| 15 |
# if [ -f $CACHEFILE ]; then |
| 16 |
# echo yes |
| 17 |
# exit 0 |
| 18 |
# else |
| 19 |
# echo "no (could not find cache file)" |
| 20 |
# fi |
| 21 |
# exit 1 |
| 22 |
#fi |
| 23 |
|
| 24 |
|
| 25 |
LOGFILE=${logfile:-/var/log/apache2/access.log}
|
| 26 |
OFFSET_FILE=/var/lib/munin/plugin-state/apache_cputime_per_domain_${SERVICE}.offset
|
| 27 |
LOGTAIL=${logtail:-/usr/sbin/logtail}
|
| 28 |
|
| 29 |
# [ML] 2009-03-31 : Filtering out 209.44.112.65, the load balancer (does regular pings) |
| 30 |
IGNORE_IP="209.44.112.65" |
| 31 |
|
| 32 |
if [ "$1" = "config" ]; then |
| 33 |
echo 'graph_title Most active sites CPU time' |
| 34 |
echo 'graph_vlabel quantity' |
| 35 |
echo 'graph_category Apache' |
| 36 |
|
| 37 |
# i'm not using logtail here to avoid screwing up the results below |
| 38 |
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}'
|
| 39 |
exit 0 |
| 40 |
fi |
| 41 |
|
| 42 |
${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}'
|
