root / plugins / rabbitmq / rabbitmq-throughput @ c5ab6538
Historique | Voir | Annoter | Télécharger (2,85 ko)
| 1 |
#!/bin/sh |
|---|---|
| 2 |
# |
| 3 |
# Plugin to monitor the queues of a virtual_host in RabbitMQ |
| 4 |
# |
| 5 |
# Usage: Link or copy into /etc/munin/node.d/ |
| 6 |
# |
| 7 |
# Parameters |
| 8 |
# env.vhost <AMQ virtual host> |
| 9 |
# env.queue_warn <warning queuesize> |
| 10 |
# env.queue_crit <critical queuesize> |
| 11 |
# |
| 12 |
# Magic markers (optional - only used by munin-config and some |
| 13 |
# installation scripts): |
| 14 |
# |
| 15 |
#%# family=auto |
| 16 |
#%# capabilities=autoconf |
| 17 |
|
| 18 |
# If run with the "autoconf"-parameter, give our opinion on wether we |
| 19 |
# should be run on this system or not. This is optinal, and only used by |
| 20 |
# munin-config. In the case of this plugin, we should most probably |
| 21 |
# always be included. |
| 22 |
|
| 23 |
|
| 24 |
########################################################################################################### |
| 25 |
|
| 26 |
#rabbitmq-througput : This plugin captures the througput of the rabbitmq server i.e rate of messages (published,acknoledged,deliver and deliver_get) per second. These values are captured from RabbitMQ management plugin. |
| 27 |
|
| 28 |
#Authour : Juned Memon |
| 29 |
#Website : www.TipsNtrapS.com |
| 30 |
#Email : junedm@tipsntraps.com |
| 31 |
#Version :1.0 |
| 32 |
|
| 33 |
#NOTE : Chnage the URL to access the UI of RabbitMQ management |
| 34 |
|
| 35 |
########################################################################################################### |
| 36 |
|
| 37 |
if [ "$1" = "autoconf" ]; then |
| 38 |
echo yes |
| 39 |
exit 0 |
| 40 |
fi |
| 41 |
|
| 42 |
curl -f -u guest:guest http://localhost:55672/api/overview | awk -F \" '{print $14"_"$16$17"\n"$22"_"$24$25"\n"$30"_"$32$33"\n"$38"_"$40$41}' | awk -F[:,] 'BEGIN {ORS = ""}{print $1} {printf" %2.4f\n",$2}' > /tmp/Throuphput.txt
|
| 43 |
|
| 44 |
|
| 45 |
details=$(cat /tmp/Throuphput.txt |awk '{print $1}')
|
| 46 |
# If run with the "config"-parameter, give out information on how the |
| 47 |
# graphs should look. |
| 48 |
|
| 49 |
if [ "$1" = "config" ]; then |
| 50 |
|
| 51 |
# The title of the graph |
| 52 |
echo "graph_title RabbitMQ Throughput" |
| 53 |
# Arguments to "rrdtool graph". In this case, tell it that the |
| 54 |
# lower limit of the graph is '0', and that 1k=1000 (not 1024) |
| 55 |
echo 'graph_args --base 1000 --vertical-label Bytes -l 0' |
| 56 |
# The Y-axis label |
| 57 |
echo 'graph_vlabel Throuphput' |
| 58 |
# We want Cur/Min/Avg/Max unscaled (i.e. 0.42 load instead of |
| 59 |
# 420 milliload) |
| 60 |
#echo 'graph_scale no' |
| 61 |
echo 'graph_category RabbitMQ' |
| 62 |
|
| 63 |
|
| 64 |
for detail in $details; do |
| 65 |
echo "$detail.label $detail" |
| 66 |
echo "$detail.info rate of $detail" |
| 67 |
done |
| 68 |
|
| 69 |
echo "graph_info Show Throughput for RabbitMQ " |
| 70 |
|
| 71 |
# Last, if run with the "config"-parameter, quit here (don't |
| 72 |
# display any data) |
| 73 |
exit 0 |
| 74 |
fi |
| 75 |
|
| 76 |
# If not run with any parameters at all (or only unknown ones), do the |
| 77 |
# real work - i.e. display the data. Almost always this will be |
| 78 |
# "value" subfield for every data field. |
| 79 |
|
| 80 |
cat /tmp/Throuphput.txt | perl -nle'($q, $s) = split; $q =~ s/[.-=]/_/g; print("$q.value $s")'
|
| 81 |
rm /tmp/Throuphput.txt |
