From ef1f44d73e53fb63a1ad7ead3590111cc4aa1a50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=E1s=20Kem=E9ny?= Date: Sun, 13 Feb 2011 22:18:17 +0100 Subject: [PATCH] env.sessiondir, fix find commands to actually use the variableuse --- plugins/other/php_sessions | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/plugins/other/php_sessions b/plugins/other/php_sessions index a8b89402..f7219e09 100755 --- a/plugins/other/php_sessions +++ b/plugins/other/php_sessions @@ -11,13 +11,20 @@ # ~~~~~~~ # Benjamin Schweizer # Ronan Guilloux +# Andras Kemeny # Copy this to your node's config file (default: plugin-conf.d/munin-node): # [php_sessions] # user root +# env.sessiondir /var/lib/php/session +# +# Modify env.sessiondir to match your system's setting. This should be fine +# on most systems. # # Changes # ~~~~~~~ +# 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 @@ -30,12 +37,12 @@ #%# family=auto #%# capabilities=autoconf -SESSION_DIR="/var/lib/php5/" +SESSDIR=${sessiondir:-"/var/lib/php/session"} if [ "$1" = "autoconf" ]; then - test -d "$SESSION_DIR" > /dev/null 2>&1 + test -d "$SESSDIR" > /dev/null 2>&1 if [ $? ]; then - echo yes + echo yes exit 0 else echo "no (session directory not found)" @@ -56,8 +63,8 @@ if [ "$1" = "config" ]; then exit 0 fi -ACTIVE_SESSIONS_NUM=`find /var/lib/php5/ -type f -iname "sess_*" -amin -5 | wc -l` -TOTAL_SESSIONS_NUM=`find /var/lib/php5/ -type f -iname "sess_*" | wc -l` +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}"