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
#!/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
# Configuration example
15
#
16
# [php_apc_*]
17
# user root
18
# env.URL http://localhost/php_apc.php # URL to fetch APC status
19
#
20
# (php_apc.php file included in package)
21
#
22
#################################################################
23
#
24
# Changelog:
25
#  - First Release, Enjoy.
26
#
27
#################################################################
28
#################################################################
29
# Settings required for autoconf
30
#%# family=auto
31
#%# capabilities=autoconf suggest
32

    
33
# URL to the script to check APC status (defaults to
34
# 'http://localhost/php_apc.php' if not configured)
35
URL=${URL:-'http://localhost/php_apc.php'}
36

    
37
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
	if [ -z "$URL" ]; then
43
		echo "no (missing URL config in header file)"
44
	else
45
		echo "yes"
46
	fi
47
	exit 0
48
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
graph_category memory
64
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
mem_used.label Memory used
70
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
graph_category memory
84
graph_total Total
85
num_misses.label Misses
86
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
graph_scale no
102
graph_vlabel Cache Percents %
103
graph_category memory
104
hits.label Hits
105
hits.draw AREA
106
hits.min 0
107
misses.label Misses
108
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
# run the script
122

    
123
[ -x $WGET ] &&	$WGET -q $WGET_FLAGS "$URL?act=$act" -O - && exit 0
124

    
125
exit 1