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
#!/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 memory
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 memory
80
graph_total Total
81
num_misses.label Misses
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_scale no
98
graph_vlabel Cache Percents %
99
graph_category memory
100
hits.label Hits
101
hits.draw AREA
102
hits.min 0
103
misses.label Misses
104
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