From 67ff8900dde46099f919c5d7e0d78add143d1c2f Mon Sep 17 00:00:00 2001 From: Ronan Date: Sat, 1 Jan 2011 11:13:54 +0100 Subject: [PATCH] 2011-01-01, guilloux : find commands & plugin conf improvements. Tested on an Ubuntu 10.10 server --- plugins/other/php_sessions | 41 +++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/plugins/other/php_sessions b/plugins/other/php_sessions index d5fc4b32..a8b89402 100755 --- a/plugins/other/php_sessions +++ b/plugins/other/php_sessions @@ -10,9 +10,15 @@ # Authors # ~~~~~~~ # Benjamin Schweizer +# Ronan Guilloux + +# Copy this to your node's config file (default: plugin-conf.d/munin-node): +# [php_sessions] +# user root # # Changes # ~~~~~~~ +# 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. @@ -24,35 +30,34 @@ #%# family=auto #%# capabilities=autoconf - SESSION_DIR="/var/lib/php5/" if [ "$1" = "autoconf" ]; then test -d "$SESSION_DIR" > /dev/null 2>&1 - if [ $? ]; then - echo yes - exit 0 - else - echo "no (session directory not found)" - exit 1 - fi + if [ $? ]; then + echo yes + exit 0 + else + echo "no (session directory not found)" + exit 1 + fi fi if [ "$1" = "config" ]; then - echo 'graph_title Apache/PHP Sessions' - echo 'graph_info This graph shows active Apache/PHP sessions.' - echo 'graph_category apache' - echo "graph_args --lower-limit 0" - echo 'graph_vlabel n' + echo 'graph_title Apache/PHP Sessions' + echo 'graph_info This graph shows active Apache/PHP sessions.' + echo 'graph_category apache' + echo "graph_args --lower-limit 0" + echo 'graph_vlabel n' - echo 'sessions.label total sessions' - echo 'asessions.label active sessions' + echo 'sessions.label total sessions' + echo 'asessions.label active sessions' - exit 0 + exit 0 fi -ACTIVE_SESSIONS_NUM=`find /var/lib/php5/sess_* -amin -5 | wc -l` -TOTAL_SESSIONS_NUM=`find /var/lib/php5/sess_* | wc -l` +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` echo "sessions.value ${TOTAL_SESSIONS_NUM}" echo "asessions.value ${ACTIVE_SESSIONS_NUM}"