Révision c75a2f9d
Initial version
| plugins/other/rabbitmq-queue_memory | ||
|---|---|---|
| 1 |
#!/bin/sh |
|
| 2 |
# |
|
| 3 |
|
|
| 4 |
#Author: Juned Memon |
|
| 5 |
#www.TipsNtrapS.com |
|
| 6 |
#mail:juned.memon@tipsntraps.com |
|
| 7 |
|
|
| 8 |
|
|
| 9 |
# If run with the "autoconf"-parameter, give our opinion on wether we |
|
| 10 |
# should be run on this system or not. This is optinal, and only used by |
|
| 11 |
# munin-config. In the case of this plugin, we should most probably |
|
| 12 |
# always be included. |
|
| 13 |
|
|
| 14 |
if [ "$1" = "autoconf" ]; then |
|
| 15 |
echo yes |
|
| 16 |
exit 0 |
|
| 17 |
fi |
|
| 18 |
|
|
| 19 |
# If run with the "config"-parameter, give out information on how the |
|
| 20 |
# graphs should look. |
|
| 21 |
|
|
| 22 |
VHOST="/" |
|
| 23 |
QUEUE="ViApiQueue" |
|
| 24 |
|
|
| 25 |
if [ "$1" = "config" ]; then |
|
| 26 |
|
|
| 27 |
# The title of the graph |
|
| 28 |
echo "graph_title RabbitMQ $VHOST Memory used by $QUEUES" |
|
| 29 |
# Arguments to "rrdtool graph". In this case, tell it that the |
|
| 30 |
# lower limit of the graph is '0', and that 1k=1000 (not 1024) |
|
| 31 |
echo 'graph_args --base 1024 --vertical-label Bytes -l 0' |
|
| 32 |
# The Y-axis label |
|
| 33 |
echo 'graph_vlabel memory' |
|
| 34 |
# We want Cur/Min/Avg/Max unscaled (i.e. 0.42 load instead of |
|
| 35 |
# 420 milliload) |
|
| 36 |
#echo 'graph_scale no' |
|
| 37 |
echo 'graph_category RabbitMQ' |
|
| 38 |
|
|
| 39 |
echo "$QUEUE.label $QUEUE" |
|
| 40 |
echo "$QUEUE.warning 80000" |
|
| 41 |
echo "$QUEUE.critical 90000" |
|
| 42 |
echo "$QUEUE.info Memory used by $QUEUE" |
|
| 43 |
|
|
| 44 |
echo "graph_info Show memory usage by queue $QUEUE" |
|
| 45 |
|
|
| 46 |
# Last, if run with the "config"-parameter, quit here (don't |
|
| 47 |
# display any data) |
|
| 48 |
exit 0 |
|
| 49 |
fi |
|
| 50 |
|
|
| 51 |
# If not run with any parameters at all (or only unknown ones), do the |
|
| 52 |
# real work - i.e. display the data. Almost always this will be |
|
| 53 |
# "value" subfield for every data field. |
|
| 54 |
rabbitmqctl list_queues -p $VHOST name memory -q | grep $QUEUE |perl -nle'($q, $s) = split; $q =~ s/[.-=]/_/g; print("$q.value $s")'
|
|
Formats disponibles : Unified diff