#!/bin/sh # # Copyright (C) 2006-2009 Benjamin Schweizer. All rights reserved. # # # Abstract # ~~~~~~~~ # munin plugin that logs active php sessions # # Authors # ~~~~~~~ # Benjamin Schweizer, http://benjamin-schweizer.de/contact # # Changes # ~~~~~~~ # 2009-01-07, benjamin: fixed file name expansion limit # 2008-10-15, benjamin: added active sessions # 2008-10-10, benjamin: forked from munin_squid_efficiency # 2006-10-11, benjamin: initial release. # # Todo # ~~~~ # - we'll see # #%# 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 fi if [ "$1" = "config" ]; then echo 'graph_title PHP Sessions' echo 'graph_info This graph shows active PHP sessions.' echo 'graph_category apache' echo "graph_args --lower-limit 0" echo 'graph_vlabel n' echo 'sessions.label total sessions' echo 'sessions.draw AREA' echo 'asessions.label active sessions' echo 'asessions.draw AREA' exit 0 fi ACTIVE_SESSIONS_NUM=`find $SESSION_DIR -name "sess_*" -amin -5 | wc -l` TOTAL_SESSIONS_NUM=`find $SESSION_DIR -name "sess_*" | wc -l` echo "sessions.value ${TOTAL_SESSIONS_NUM}" echo "asessions.value ${ACTIVE_SESSIONS_NUM}" # eof.