-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphp_sessions
executable file
·75 lines (66 loc) · 2.03 KB
/
php_sessions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/sh
#
# Copyright (C) 2006-2008 Benjamin Schweizer. All rights reserved.
#
#
# Abstract
# ~~~~~~~~
# munin plugin that logs active PHP sessions
#
# Authors
# ~~~~~~~
# Benjamin Schweizer <code at benjamin-schweizer dot de>
# Ronan Guilloux <ronan at coolforest dot net>
# Andras Kemeny <subpardaemon at gmail dot com>
# Copy this to your node's config file (default: plugin-conf.d/munin-node):
# [php_sessions]
# user root
# env.sessiondir /var/lib/php5
#
# Modify env.sessiondir to match your system's setting. This should be fine
# on most systems.
#
# Changes
# ~~~~~~~
# 2014-09-16, leander: modified sessiondir to match latest Ubuntu and
# changed group to PHP.
# 2012-07-31, leander: modified sessiondir to match Debian standards
# 2011-02-13, subpardaemon: add env.sessiondir, make sure find uses
# the given path (it hadn't before)
# 2011-01-01, guilloux : find commands & plugin conf improvements
# 2008-10-15, schweizer: added active sessions
# 2008-10-10, schweizer: forked from munin_squid_efficiency
# 2006-10-11, schweizer: initial release.
#
# Todo
# ~~~~
# - we'll see
#
#%# family=auto
#%# capabilities=autoconf
SESSDIR=${sessiondir:-"/var/lib/php5"}
if [ "$1" = "autoconf" ]; then
test -d "$SESSDIR" > /dev/null 2>&1
if [ $? ]; then
echo yes
exit 0
else
echo "no (session directory not found)"
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title PHP Sessions'
echo 'graph_info This graph shows active PHP sessions.'
echo 'graph_category PHP'
echo "graph_args --lower-limit 0"
echo 'graph_vlabel n'
echo 'sessions.label total sessions'
echo 'asessions.label active sessions'
exit 0
fi
ACTIVE_SESSIONS_NUM=`find $SESSDIR/ -type f -iname "sess_*" -amin -5 | wc -l`
TOTAL_SESSIONS_NUM=`find $SESSDIR/ -type f -iname "sess_*" | wc -l`
echo "sessions.value ${TOTAL_SESSIONS_NUM}"
echo "asessions.value ${ACTIVE_SESSIONS_NUM}"
# eof.