2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00
contrib-munin/plugins/other/rabbitmq-queue_memory
2011-12-18 15:10:31 +01:00

55 lines
1.8 KiB
Bash
Executable File

#!/bin/sh
#
#Author: Juned Memon
#www.TipsNtrapS.com
#mail:juned.memon@tipsntraps.com
# If run with the "autoconf"-parameter, give our opinion on wether we
# should be run on this system or not. This is optinal, and only used by
# munin-config. In the case of this plugin, we should most probably
# always be included.
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
# If run with the "config"-parameter, give out information on how the
# graphs should look.
VHOST="/"
QUEUE="ViApiQueue"
if [ "$1" = "config" ]; then
# The title of the graph
echo "graph_title RabbitMQ $VHOST Memory used by $QUEUES"
# Arguments to "rrdtool graph". In this case, tell it that the
# lower limit of the graph is '0', and that 1k=1000 (not 1024)
echo 'graph_args --base 1024 --vertical-label Bytes -l 0'
# The Y-axis label
echo 'graph_vlabel memory'
# We want Cur/Min/Avg/Max unscaled (i.e. 0.42 load instead of
# 420 milliload)
#echo 'graph_scale no'
echo 'graph_category RabbitMQ'
echo "$QUEUE.label $QUEUE"
echo "$QUEUE.warning 80000"
echo "$QUEUE.critical 90000"
echo "$QUEUE.info Memory used by $QUEUE"
echo "graph_info Show memory usage by queue $QUEUE"
# Last, if run with the "config"-parameter, quit here (don't
# display any data)
exit 0
fi
# If not run with any parameters at all (or only unknown ones), do the
# real work - i.e. display the data. Almost always this will be
# "value" subfield for every data field.
rabbitmqctl list_queues -p $VHOST name memory -q | grep $QUEUE |perl -nle'($q, $s) = split; $q =~ s/[.-=]/_/g; print("$q.value $s")'