1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-23 06:35:42 +00:00

ejabberd_: Fix to recognise ejabberd 2.1.10+

Adjust the $EJVER pattern matching to allow for one or two digits in the
third part of the triplet.
This commit is contained in:
Paul Saunders 2012-01-16 11:31:59 +00:00 committed by Steve Schnepp
parent 6519e1579c
commit 1080cbb75b

View file

@ -39,8 +39,11 @@
#%# family=auto #%# family=auto
#%# capabilities=autoconf suggest #%# capabilities=autoconf suggest
shopt -s extglob
EJCTL=$(which ejabberdctl) EJCTL=$(which ejabberdctl)
EJVER=$($EJCTL status | awk '/^ejabberd / {print $2}') EJVER=$($EJCTL status | awk '/^ejabberd / {print $2}')
MUNIN_DEBUG=${MUNIN_DEBUG:-0}
if [ "$1" == "autoconf" ]; then if [ "$1" == "autoconf" ]; then
if [ -x $EJCTL > /dev/null ]; then if [ -x $EJCTL > /dev/null ]; then
@ -103,7 +106,7 @@ if [ -z "$vhosts" ]; then
fi fi
# get ejabberd PID # get ejabberd PID
if [[ ${EJVER%\.[0-9]} == 2.1 ]]; then if [[ ${EJVER%\.+([0-9]|[0-9][0-9])} == 2.1 ]]; then
EJPID=$(cat /var/run/ejabberd/ejabberd.pid) EJPID=$(cat /var/run/ejabberd/ejabberd.pid)
else else
EJPID=$(ps -ef | awk '/\/bin\/beam.smp/ && !/awk/ {print $2}') EJPID=$(ps -ef | awk '/\/bin\/beam.smp/ && !/awk/ {print $2}')
@ -198,7 +201,7 @@ if [ "$1" = "config" ]; then
exit 0 exit 0
fi fi
if [[ ${EJVER%\.[0-9]} == 2.1 ]]; then if [[ ${EJVER%\.+([0-9]|[0-9][0-9])} == 2.1 ]]; then
if [ "$MODE" == "users" ]; then if [ "$MODE" == "users" ]; then
for host in $vhosts; do for host in $vhosts; do
formathost=$(echo $host | tr '.' '_') formathost=$(echo $host | tr '.' '_')
@ -238,7 +241,7 @@ if [[ ${EJVER%\.[0-9]} == 2.1 ]]; then
echo "s2s_connections_out.value $($EJCTL outgoing_s2s_number)" echo "s2s_connections_out.value $($EJCTL outgoing_s2s_number)"
echo "s2s_connections_in.value $($EJCTL incoming_s2s_number)" echo "s2s_connections_in.value $($EJCTL incoming_s2s_number)"
fi fi
elif [[ ${EJVER%\.[0-9]} == 2.0 ]]; then elif [[ ${EJVER%\.+([0-9]|[0-9][0-9])} == 2.0 ]]; then
if [ "$MODE" == "users" ]; then if [ "$MODE" == "users" ]; then
for host in $vhosts; do for host in $vhosts; do
formathost=$(echo $host | tr '.' '_') formathost=$(echo $host | tr '.' '_')
@ -278,6 +281,8 @@ elif [[ ${EJVER%\.[0-9]} == 2.0 ]]; then
echo "s2s_connections_out.value $($EJCTL outgoing-s2s-number)" echo "s2s_connections_out.value $($EJCTL outgoing-s2s-number)"
echo "s2s_connections_in.value $($EJCTL incoming-s2s-number)" echo "s2s_connections_in.value $($EJCTL incoming-s2s-number)"
fi fi
else
echo "# Unknown Ejabberd Version: $EJVER -> '${EJVER%\.+([0-9]|[0-9][0-9])}'"
fi fi
if [ "$MODE" == "memory" ]; then if [ "$MODE" == "memory" ]; then