root / plugins / php / php_sessions @ b0b39b01
Historique | Voir | Annoter | Télécharger (1,85 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 |
else |
| 47 |
echo "no (session directory not found)" |
| 48 |
fi |
| 49 |
exit 0 |
| 50 |
fi |
| 51 |
|
| 52 |
if [ "$1" = "config" ]; then |
| 53 |
echo 'graph_title Apache/PHP Sessions' |
| 54 |
echo 'graph_info This graph shows active Apache/PHP sessions.' |
| 55 |
echo 'graph_category webserver' |
| 56 |
echo "graph_args --lower-limit 0" |
| 57 |
echo 'graph_vlabel n' |
| 58 |
|
| 59 |
echo 'sessions.label total sessions' |
| 60 |
echo 'asessions.label active sessions' |
| 61 |
|
| 62 |
exit 0 |
| 63 |
fi |
| 64 |
|
| 65 |
ACTIVE_SESSIONS_NUM=`find $SESSDIR/ -type f -iname "sess_*" -amin -5 | wc -l` |
| 66 |
TOTAL_SESSIONS_NUM=`find $SESSDIR/ -type f -iname "sess_*" | wc -l` |
| 67 |
|
| 68 |
echo "sessions.value ${TOTAL_SESSIONS_NUM}"
|
| 69 |
echo "asessions.value ${ACTIVE_SESSIONS_NUM}"
|
| 70 |
|
| 71 |
# eof. |
