Projet

Général

Profil

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

root / plugins / php / php_apc_ @ c6bc5c7c

Historique | Voir | Annoter | Télécharger (2,5 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
# Settigs 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
	[ -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
graph_category apache
60
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
mem_used.label Memory Used
66
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
graph_category apache
80
graph_total Total
81
num_misses.label Missed
82
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
graph_vlabel Cache Percents %
98
graph_category apache
99
hits.label hits
100
hits.draw AREA
101
hits.min 0
102
misses.label misses
103
misses.draw STACK
104
misses.min 0
105
misses.warning 50
106
memory.label Memory
107
memory.draw LINE
108
memory.warning 95
109
memory.critical 98
110
EOM
111

    
112
exit 0
113
fi
114

    
115
#################################################################
116
# run the sript
117

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

    
120
exit 1