Projet

Général

Profil

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

root / plugins / php / php_opcache @ 09b88141

Historique | Voir | Annoter | Télécharger (1,56 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
# Settings 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
        if [ -z "$URL" ]; then
25
                echo "no (missing URL config in header file)"
26
        else
27
                echo "yes"
28
        fi
29
        exit 0
30
fi
31

    
32
if [ "$1" = "suggest" ]; then
33
        echo "memory"
34
        exit 0
35
fi
36

    
37
if [ "$1" = "config" ] && [ "$act" = "memory" ]; then
38

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

    
57
exit 0
58
fi
59

    
60
###############################################################################
61

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

    
64
exit 1
65