Projet

Général

Profil

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

root / plugins / php / php_opcache @ ec4951b7

Historique | Voir | Annoter | Télécharger (1,53 ko)

1
#!/bin/sh
2
###############################################################################
3
#
4
# Munin plugin to monitor Zend OPCache <http://php.net/manual/en/book.opcache.php>
5
# By Daniel Lo Nigro <http://dan.cx/>
6
#
7
# Installation:
8
#  1. Copy php_opcache.php file onto server and verify you can hit it in a browser
9
#  2. Add to Munin config:
10
# [php_opcache]
11
# env.URL http://example/php_opcache.php
12
###############################################################################
13
# Settigs required for autoconf
14
#%# family=auto
15
#%# capabilities=autoconf suggest
16

    
17
URL=${URL:-'http://localhost/php_opcache.php'}
18

    
19
WGET=`which wget`;
20
WGET_FLAGS="-Yoff"; # refer to wget manual, you may set extra parameters like disable proxy
21
act=memory
22

    
23
if [ "$1" = "autoconf" ]; then
24
        [ -z "$URL" ] && echo "no (edit URL config in header file !)" && exit 1
25
        [ -n "$URL" ] && echo "yes" && exit 0
26
fi
27

    
28
if [ "$1" = "suggest" ]; then
29
        echo "memory"
30
        exit 0
31
fi
32

    
33
if [ "$1" = "config" ] && [ "$act" = "memory" ]; then
34

    
35
cat <<'EOM'
36
graph_title OPCache Memory usage
37
graph_args -l 0 --base 1024
38
graph_vlabel Memory usage
39
graph_category php-opcache
40
graph_order mem_used mem_free mem_wasted
41
graph_total Total
42
mem_free.label Memory Free
43
mem_free.draw STACK
44
mem_free.min 0
45
mem_used.label Memory Used
46
mem_used.draw AREA
47
mem_used.min 0
48
mem_wasted.label Memory Wasted
49
mem_wasted.draw STACK
50
mem_wasted.min 0
51
EOM
52

    
53
exit 0
54
fi
55

    
56
###############################################################################
57

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

    
60
exit 1
61