root / plugins / php / php_apc_ @ f4af59b7
Historique | Voir | Annoter | Télécharger (2,31 ko)
| 1 |
#!/bin/sh |
|---|---|
| 2 |
################################################################# |
| 3 |
# |
| 4 |
# Script to monitor apc usage |
| 5 |
# |
| 6 |
################################################################# |
| 7 |
# |
| 8 |
# Parameters understood: config, autoconf and suggest |
| 9 |
# |
| 10 |
################################################################# |
| 11 |
# |
| 12 |
# Configuration section |
| 13 |
# |
| 14 |
# URL to the script to check apc status |
| 15 |
URL="" |
| 16 |
#URL="http://localhost/php_apc.php"; |
| 17 |
# |
| 18 |
# php file included in package |
| 19 |
# |
| 20 |
################################################################# |
| 21 |
# |
| 22 |
# Changelog: |
| 23 |
# - First Release, Enjoy. |
| 24 |
# |
| 25 |
################################################################# |
| 26 |
################################################################# |
| 27 |
# Settigs required for autoconf |
| 28 |
#%# family=auto |
| 29 |
#%# capabilities=autoconf suggest |
| 30 |
|
| 31 |
WGET=`which wget`; |
| 32 |
WGET_FLAGS="-Yoff"; # refer to wget manual, you may set extra parameters like disable proxy |
| 33 |
act=`basename $0 | sed 's/^php_apc_//g'` |
| 34 |
|
| 35 |
if [ "$1" = "autoconf" ]; then |
| 36 |
[ -z "$URL" ] && echo "no (edit URL config in header file !)" && exit 1 |
| 37 |
[ -n "$URL" ] && echo "yes" && exit 0 |
| 38 |
fi |
| 39 |
|
| 40 |
if [ "$1" = "suggest" ]; then |
| 41 |
echo "memory" |
| 42 |
echo "hits" |
| 43 |
echo "percents" |
| 44 |
exit 0 |
| 45 |
fi |
| 46 |
|
| 47 |
if [ "$1" = "config" ] && [ "$act" = "memory" ]; then |
| 48 |
|
| 49 |
cat <<'EOM' |
| 50 |
graph_title APC Memory usage |
| 51 |
graph_args -l 0 --base 1024 |
| 52 |
graph_vlabel Memory usage |
| 53 |
graph_category apache |
| 54 |
graph_order mem_used mem_avail |
| 55 |
graph_total Total |
| 56 |
mem_avail.label Memory available |
| 57 |
mem_avail.draw STACK |
| 58 |
mem_avail.min 0 |
| 59 |
mem_used.label Memory Used |
| 60 |
mem_used.draw AREA |
| 61 |
mem_used.min 0 |
| 62 |
EOM |
| 63 |
|
| 64 |
exit 0 |
| 65 |
fi |
| 66 |
|
| 67 |
if [ "$1" = "config" ] && [ "$act" = "hits" ]; then |
| 68 |
|
| 69 |
cat <<'EOM' |
| 70 |
graph_title APC Hits |
| 71 |
graph_args -l 0 |
| 72 |
graph_vlabel Cache hits |
| 73 |
graph_category apache |
| 74 |
graph_total Total |
| 75 |
num_misses.label Missed |
| 76 |
num_misses.draw AREA |
| 77 |
num_misses.min 0 |
| 78 |
num_hits.label Hits |
| 79 |
num_hits.draw STACK |
| 80 |
num_hits.min 0 |
| 81 |
EOM |
| 82 |
|
| 83 |
exit 0 |
| 84 |
fi |
| 85 |
|
| 86 |
if [ "$1" = "config" ] && [ "$act" = "percents" ]; then |
| 87 |
|
| 88 |
cat <<'EOM' |
| 89 |
graph_title APC Percents |
| 90 |
graph_args -l 0 --upper-limit 100 |
| 91 |
graph_vlabel Cache Percents % |
| 92 |
graph_category apache |
| 93 |
hits.label hits |
| 94 |
hits.draw AREA |
| 95 |
hits.min 0 |
| 96 |
misses.label misses |
| 97 |
misses.draw STACK |
| 98 |
misses.min 0 |
| 99 |
misses.warning 50 |
| 100 |
memory.label Memory |
| 101 |
memory.draw LINE |
| 102 |
memory.warning 95 |
| 103 |
memory.critical 98 |
| 104 |
EOM |
| 105 |
|
| 106 |
exit 0 |
| 107 |
fi |
| 108 |
|
| 109 |
################################################################# |
| 110 |
# run the sript |
| 111 |
|
| 112 |
[ -x $WGET ] && $WGET -q $WGET_FLAGS "$URL?act=$act" -O - && exit 0 |
| 113 |
|
| 114 |
exit 1 |
