Projet

Général

Profil

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

root / plugins / php / php_apc_ @ 2c912170

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 36748826 Lars Kruse
# Settings required for autoconf
30 f4af59b7 Kenyon Ralph
#%# 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 9cef55a3 Lars Kruse
	if [ -z "$URL" ]; then
43
		echo "no (missing URL config in header file)"
44
	else
45
		echo "yes"
46
	fi
47
	exit 0
48 f4af59b7 Kenyon Ralph
fi
49
50
if [ "$1" = "suggest" ]; then
51
	echo "memory"
52
	echo "hits"
53
	echo "percents"
54
	exit 0
55
fi
56
57
if [ "$1" = "config" ] && [ "$act" = "memory" ]; then
58
59
cat <<'EOM'
60
graph_title APC Memory usage
61
graph_args -l 0 --base 1024
62
graph_vlabel Memory usage
63 b19b3a81 dipohl
graph_category memory
64 f4af59b7 Kenyon Ralph
graph_order mem_used mem_avail
65
graph_total Total
66
mem_avail.label Memory available
67
mem_avail.draw STACK
68
mem_avail.min 0
69 edff2bdc Lee Clemens
mem_used.label Memory used
70 f4af59b7 Kenyon Ralph
mem_used.draw AREA
71
mem_used.min 0
72
EOM
73
74
exit 0
75
fi
76
77
if [ "$1" = "config" ] && [ "$act" = "hits" ]; then
78
79
cat <<'EOM'
80
graph_title APC Hits
81
graph_args -l 0
82
graph_vlabel Cache hits
83 65652aa0 dipohl
graph_category memory
84 f4af59b7 Kenyon Ralph
graph_total Total
85 edff2bdc Lee Clemens
num_misses.label Misses
86 f4af59b7 Kenyon Ralph
num_misses.draw AREA
87
num_misses.min 0
88
num_hits.label Hits
89
num_hits.draw STACK
90
num_hits.min 0
91
EOM
92
93
exit 0
94
fi
95
96
if [ "$1" = "config" ] && [ "$act" = "percents" ]; then
97
98
cat <<'EOM'
99
graph_title APC Percents
100
graph_args -l 0 --upper-limit 100
101 311e2aa0 Lee Clemens
graph_scale no
102 f4af59b7 Kenyon Ralph
graph_vlabel Cache Percents %
103 65652aa0 dipohl
graph_category memory
104 edff2bdc Lee Clemens
hits.label Hits
105 f4af59b7 Kenyon Ralph
hits.draw AREA
106
hits.min 0
107 edff2bdc Lee Clemens
misses.label Misses
108 f4af59b7 Kenyon Ralph
misses.draw STACK
109
misses.min 0
110
misses.warning 50
111
memory.label Memory
112
memory.draw LINE
113
memory.warning 95
114
memory.critical 98
115
EOM
116
117
exit 0
118
fi
119
120
#################################################################
121 2c912170 Lars Kruse
# run the script
122 f4af59b7 Kenyon Ralph
123
[ -x $WGET ] &&	$WGET -q $WGET_FLAGS "$URL?act=$act" -O - && exit 0
124
125
exit 1