2008-10-15 09:49:08 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (C) 2006-2008 Benjamin Schweizer. All rights reserved.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Abstract
|
|
|
|
# ~~~~~~~~
|
|
|
|
# munin plugin that logs active apache sessions
|
|
|
|
#
|
|
|
|
# Authors
|
|
|
|
# ~~~~~~~
|
|
|
|
# Benjamin Schweizer <code at benjamin-schweizer dot de>
|
2011-01-01 11:13:54 +01:00
|
|
|
# Ronan Guilloux <ronan at coolforest dot net>
|
2011-02-13 22:18:17 +01:00
|
|
|
# Andras Kemeny <subpardaemon at gmail dot com>
|
2011-01-01 11:13:54 +01:00
|
|
|
|
|
|
|
# Copy this to your node's config file (default: plugin-conf.d/munin-node):
|
|
|
|
# [php_sessions]
|
|
|
|
# user root
|
2011-02-13 22:18:17 +01:00
|
|
|
# env.sessiondir /var/lib/php/session
|
|
|
|
#
|
|
|
|
# Modify env.sessiondir to match your system's setting. This should be fine
|
|
|
|
# on most systems.
|
2008-10-15 09:49:08 +02:00
|
|
|
#
|
|
|
|
# Changes
|
|
|
|
# ~~~~~~~
|
2011-02-13 22:18:17 +01:00
|
|
|
# 2011-02-13, subpardaemon: add env.sessiondir, make sure find uses
|
|
|
|
# the given path (it hadn't before)
|
2011-01-01 11:13:54 +01:00
|
|
|
# 2011-01-01, guilloux : find commands & plugin conf improvements
|
2008-10-15 09:49:08 +02:00
|
|
|
# 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
|
|
|
|
|
2011-02-13 22:18:17 +01:00
|
|
|
SESSDIR=${sessiondir:-"/var/lib/php/session"}
|
2008-10-15 09:49:08 +02:00
|
|
|
|
|
|
|
if [ "$1" = "autoconf" ]; then
|
2011-02-13 22:18:17 +01:00
|
|
|
test -d "$SESSDIR" > /dev/null 2>&1
|
2011-01-01 11:13:54 +01:00
|
|
|
if [ $? ]; then
|
2011-02-13 22:18:17 +01:00
|
|
|
echo yes
|
2011-01-01 11:13:54 +01:00
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
echo "no (session directory not found)"
|
|
|
|
exit 1
|
|
|
|
fi
|
2008-10-15 09:49:08 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = "config" ]; then
|
2011-01-01 11:13:54 +01:00
|
|
|
echo 'graph_title Apache/PHP Sessions'
|
|
|
|
echo 'graph_info This graph shows active Apache/PHP sessions.'
|
2015-03-25 15:13:27 +01:00
|
|
|
echo 'graph_category php-sessions'
|
2011-01-01 11:13:54 +01:00
|
|
|
echo "graph_args --lower-limit 0"
|
|
|
|
echo 'graph_vlabel n'
|
2008-10-15 09:49:08 +02:00
|
|
|
|
2011-01-01 11:13:54 +01:00
|
|
|
echo 'sessions.label total sessions'
|
|
|
|
echo 'asessions.label active sessions'
|
2008-10-15 09:49:08 +02:00
|
|
|
|
2011-01-01 11:13:54 +01:00
|
|
|
exit 0
|
2008-10-15 09:49:08 +02:00
|
|
|
fi
|
|
|
|
|
2011-02-13 22:18:17 +01:00
|
|
|
ACTIVE_SESSIONS_NUM=`find $SESSDIR/ -type f -iname "sess_*" -amin -5 | wc -l`
|
|
|
|
TOTAL_SESSIONS_NUM=`find $SESSDIR/ -type f -iname "sess_*" | wc -l`
|
2008-10-15 09:49:08 +02:00
|
|
|
|
|
|
|
echo "sessions.value ${TOTAL_SESSIONS_NUM}"
|
|
|
|
echo "asessions.value ${ACTIVE_SESSIONS_NUM}"
|
|
|
|
|
|
|
|
# eof.
|