Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / php / php_apc_ @ 17f78427

Historique | Voir | Annoter | Télécharger (2,51 ko)

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