Projet

Général

Profil

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

root / plugins / php / php_opcache @ 36748826

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

1 cde616b8 Daniel Lo Nigro
#!/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 36748826 Lars Kruse
# Settings required for autoconf
14 cde616b8 Daniel Lo Nigro
#%# 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 9cef55a3 Lars Kruse
        if [ -z "$URL" ]; then
25
                echo "no (missing URL config in header file)"
26
        else
27
                echo "yes"
28
        fi
29
        exit 0
30 cde616b8 Daniel Lo Nigro
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 b19b3a81 dipohl
graph_category memory
44 ec4951b7 Mikel Olasagasti Uranga
graph_order mem_used mem_free mem_wasted
45 cde616b8 Daniel Lo Nigro
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 ec4951b7 Mikel Olasagasti Uranga
mem_wasted.label Memory Wasted
53
mem_wasted.draw STACK
54
mem_wasted.min 0
55 cde616b8 Daniel Lo Nigro
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