Projet

Général

Profil

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

root / plugins / php / php_sessions @ c3cf6b45

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

1
#!/bin/sh
2
#
3
# Copyright (C) 2006-2008 Benjamin Schweizer. All rights reserved.
4
#
5
#
6
# Abstract
7
# ~~~~~~~~
8
# munin plugin that logs active apache sessions
9
#
10
# Authors
11
# ~~~~~~~
12
# Benjamin Schweizer <code at benjamin-schweizer dot de>
13
# Ronan Guilloux <ronan at coolforest dot net>
14
# Andras Kemeny <subpardaemon at gmail dot com>
15

    
16
# Copy this to your node's config file (default: plugin-conf.d/munin-node):
17
#  [php_sessions]
18
#  user root
19
#  env.sessiondir /var/lib/php/session
20
#
21
# Modify env.sessiondir to match your system's setting. This should be fine
22
# on most systems.
23
#
24
# Changes
25
# ~~~~~~~
26
# 2011-02-13, subpardaemon: add env.sessiondir, make sure find uses
27
#                           the given path (it hadn't before)
28
# 2011-01-01, guilloux : find commands & plugin conf improvements
29
# 2008-10-15, schweizer: added active sessions
30
# 2008-10-10, schweizer: forked from munin_squid_efficiency
31
# 2006-10-11, schweizer: initial release.
32
#
33
# Todo
34
# ~~~~
35
# - we'll see
36
#
37
#%# family=auto
38
#%# capabilities=autoconf
39

    
40
SESSDIR=${sessiondir:-"/var/lib/php/session"}
41

    
42
if [ "$1" = "autoconf" ]; then
43
    test -d "$SESSDIR" > /dev/null 2>&1
44
        if [ $? ]; then
45
                echo yes
46
                exit 0
47
        else
48
                echo "no (session directory not found)"
49
                exit 1
50
        fi
51
fi
52

    
53
if [ "$1" = "config" ]; then
54
        echo 'graph_title Apache/PHP Sessions'
55
        echo 'graph_info This graph shows active Apache/PHP sessions.'
56
        echo 'graph_category php-sessions'
57
        echo "graph_args --lower-limit 0"
58
        echo 'graph_vlabel n'
59

    
60
        echo 'sessions.label total sessions'
61
        echo 'asessions.label active sessions'
62

    
63
        exit 0
64
fi
65

    
66
ACTIVE_SESSIONS_NUM=`find $SESSDIR/ -type f -iname "sess_*" -amin -5 | wc -l`
67
TOTAL_SESSIONS_NUM=`find $SESSDIR/ -type f -iname "sess_*" | wc -l`
68

    
69
echo "sessions.value ${TOTAL_SESSIONS_NUM}"
70
echo "asessions.value ${ACTIVE_SESSIONS_NUM}"
71

    
72
# eof.