diff --git a/plugins/rabbitmq/rabbitmq-connections b/plugins/rabbitmq/rabbitmq-connections deleted file mode 100755 index ee2467f2..00000000 --- a/plugins/rabbitmq/rabbitmq-connections +++ /dev/null @@ -1,51 +0,0 @@ -#!/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. - -if [ "$1" = "config" ]; then - - - # The title of the graph - echo 'graph_title RabbitMQ connections' - # 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 1000 -l 0' - # The Y-axis label - echo 'graph_vlabel connections' - # 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 "connections.label Connections" - echo "connections.warning 500" - echo "connections.critical 1000" - echo "connections.info Number of active connections" - - echo 'graph_info Shows the number of connections to RabbitMQ' - # 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. - -echo "connections.value $(rabbitmqctl list_connections -q | wc -l)" diff --git a/plugins/rabbitmq/rabbitmq-consumers b/plugins/rabbitmq/rabbitmq-consumers deleted file mode 100755 index 11570264..00000000 --- a/plugins/rabbitmq/rabbitmq-consumers +++ /dev/null @@ -1,51 +0,0 @@ -#!/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 consumers" - # 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 1000 -l 0' - # The Y-axis label - echo 'graph_vlabel consumers' - # 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 $QUEUE_WARN" - echo "$QUEUE.critical $QUEUE_CRIT" - echo "$QUEUE.info Active consumers for $QUEUE" - - echo 'graph_info Lists active consumers for a 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 consumers -q | grep $QUEUE |perl -nle'($q, $s) = split; $q =~ s/[.-=]/_/g; print("$q.value $s")' diff --git a/plugins/rabbitmq/rabbitmq-messages b/plugins/rabbitmq/rabbitmq-messages deleted file mode 100755 index 70258f52..00000000 --- a/plugins/rabbitmq/rabbitmq-messages +++ /dev/null @@ -1,52 +0,0 @@ -#!/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 Number of Messages in queue $QUEUE" - # 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 1000 -l 0' - # The Y-axis label - echo 'graph_vlabel queue_size' - # 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 10" - echo "$QUEUE.critical 20" - echo "$QUEUE.info Queue size for $QUEUE" - - echo "graph_info Lists how many messages are in 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 -q | grep $QUEUE |perl -nle'($q, $s) = split; $q =~ s/[.-=]/_/g; print("$q.value $s")' diff --git a/plugins/rabbitmq/rabbitmq-messages_unacknowledged b/plugins/rabbitmq/rabbitmq-messages_unacknowledged deleted file mode 100755 index 28f7dfe7..00000000 --- a/plugins/rabbitmq/rabbitmq-messages_unacknowledged +++ /dev/null @@ -1,51 +0,0 @@ -#!/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 Unacknowledged Messages" - # 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 1000 -l 0' - # The Y-axis label - echo 'graph_vlabel unacknowledged' - # 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 10000" - echo "$QUEUE.critical 20000" - echo "$QUEUE.info Unacknowledged messages for $QUEUE" - - echo "graph_info Lists how many Unacknowledged messages in 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 messages_unacknowledged -q | grep $QUEUE |perl -nle'($q, $s) = split; $q =~ s/[.-=]/_/g; print("$q.value $s")' diff --git a/plugins/rabbitmq/rabbitmq-queue_memory b/plugins/rabbitmq/rabbitmq-queue_memory deleted file mode 100755 index 3ef42197..00000000 --- a/plugins/rabbitmq/rabbitmq-queue_memory +++ /dev/null @@ -1,54 +0,0 @@ -#!/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")' diff --git a/plugins/rabbitmq/rabbitmq-throughput b/plugins/rabbitmq/rabbitmq-throughput deleted file mode 100755 index 65cb7524..00000000 --- a/plugins/rabbitmq/rabbitmq-throughput +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/sh -# -# Plugin to monitor the queues of a virtual_host in RabbitMQ -# -# Usage: Link or copy into /etc/munin/node.d/ -# -# Parameters -# env.vhost -# env.queue_warn -# env.queue_crit -# -# Magic markers (optional - only used by munin-config and some -# installation scripts): -# -#%# family=auto -#%# capabilities=autoconf - -# 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. - - -########################################################################################################### - -#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. - -#Authour : Juned Memon -#Website : www.TipsNtrapS.com -#Email : junedm@tipsntraps.com -#Version :1.0 - -#NOTE : Chnage the URL to access the UI of RabbitMQ management - -########################################################################################################### - -if [ "$1" = "autoconf" ]; then - echo yes - exit 0 -fi - -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 - - -details=$(cat /tmp/Throuphput.txt |awk '{print $1}') -# If run with the "config"-parameter, give out information on how the -# graphs should look. - -if [ "$1" = "config" ]; then - - # The title of the graph - echo "graph_title RabbitMQ Throughput" - # 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 1000 --vertical-label Bytes -l 0' - # The Y-axis label - echo 'graph_vlabel Throuphput' - # We want Cur/Min/Avg/Max unscaled (i.e. 0.42 load instead of - # 420 milliload) - #echo 'graph_scale no' - echo 'graph_category RabbitMQ' - - -for detail in $details; do - echo "$detail.label $detail" - echo "$detail.info rate of $detail" - done - - echo "graph_info Show Throughput for RabbitMQ " - - # 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. - -cat /tmp/Throuphput.txt | perl -nle'($q, $s) = split; $q =~ s/[.-=]/_/g; print("$q.value $s")' -rm /tmp/Throuphput.txt diff --git a/plugins/rabbitmq/rabbitmq_connections b/plugins/rabbitmq/rabbitmq_connections new file mode 100755 index 00000000..fb254604 --- /dev/null +++ b/plugins/rabbitmq/rabbitmq_connections @@ -0,0 +1,66 @@ +#!/bin/sh +# +# Plugin to monitor the number of connections to RabbitMQ +# +# Usage: Link or copy into /etc/munin/node.d/ +# +# Parameters +# env.conn_warn +# env.conn_crit +# +# Magic markers (optional - only used by munin-config and some +# installation scripts): +# +#%# family=auto +#%# capabilities=autoconf + +# 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 + +HOME=/tmp/ + +# If run with the "config"-parameter, give out information on how the +# graphs should look. + +if [ "$1" = "config" ]; then + CONN_WARN=${queue_warn:-500} + CONN_CRIT=${queue_crit:-1000} + + # The host name this plugin is for. (Can be overridden to have + # one machine answer for several) + + # The title of the graph + echo 'graph_title RabbitMQ connections' + # 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 1000 -l 0' + # The Y-axis label + echo 'graph_vlabel connections' + # 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 "connections.label Connections" + echo "connections.warning $CONN_WARN" + echo "connections.critical $CONN_CRIT" + echo "connections.info Number of active connections" + + echo 'graph_info Shows the number of connections to RabbitMQ' + # 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. + +echo "connections.value $(HOME=$HOME rabbitmqctl list_connections | grep -v "^Listing" | grep -v "done.$" | wc -l)" diff --git a/plugins/rabbitmq/rabbitmq_consumers b/plugins/rabbitmq/rabbitmq_consumers new file mode 100755 index 00000000..3b603d09 --- /dev/null +++ b/plugins/rabbitmq/rabbitmq_consumers @@ -0,0 +1,75 @@ +#!/bin/sh +# +# Plugin to monitor the queues of a virtual_host in RabbitMQ +# +# Usage: Link or copy into /etc/munin/node.d/ +# +# Parameters +# env.vhost +# env.queue_warn +# env.queue_crit +# +# Magic markers (optional - only used by munin-config and some +# installation scripts): +# +#%# family=auto +#%# capabilities=autoconf + +# 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. + +HOME=/tmp/ +VHOST=${vhost:-"/"} +QUEUES=$(HOME=$HOME rabbitmqctl list_queues -p $VHOST name | \ + grep -v '^Listing' | \ + grep -v 'done\.$' | sed -e 's/[.=-]/_/g' ) + +if [ "$1" = "config" ]; then + QUEUE_WARN=${queue_warn:-100} + QUEUE_CRIT=${queue_crit:-500} + + # The host name this plugin is for. (Can be overridden to have + # one machine answer for several) + + # The title of the graph + echo "graph_title RabbitMQ $VHOST consumers" + # 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 1000 -l 0' + # The Y-axis label + echo 'graph_vlabel consumers' + # We want Cur/Min/Avg/Max unscaled (i.e. 0.42 load instead of + # 420 milliload) + #echo 'graph_scale no' + echo 'graph_category RabbitMQ' + + for queue in $QUEUES; do + echo "$queue.label $queue" + echo "$queue.warning $QUEUE_WARN" + echo "$queue.critical $QUEUE_CRIT" + echo "$queue.info Active consumers for $queue" + done + + echo 'graph_info Lists active consumers for a 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. + +HOME=$HOME rabbitmqctl list_queues -p $VHOST name consumers| \ + grep -v "^Listing" | grep -v "done.$" | \ + perl -nle'($q, $s) = split; $q =~ s/[.=-]/_/g; print("$q.value $s")' diff --git a/plugins/rabbitmq/rabbitmq_list_queues b/plugins/rabbitmq/rabbitmq_list_queues deleted file mode 100755 index d290e070..00000000 --- a/plugins/rabbitmq/rabbitmq_list_queues +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/tclsh - -proc clean_fieldname arg { - return [regsub -all {[^A-Za-z]} $arg "_"] -} - -proc main {argc argv} { - set queues [exec /usr/sbin/rabbitmqctl list_queues -q] - if {$argc > 0} { - switch [lindex $argv 0] { - "config" { - puts "graph_title Number of messages in RabbitMQ queues" - puts "graph_vlabel messages" - puts "graph_category RabbitMQ" - foreach {q m} $queues { - set clean [clean_fieldname $q] - puts "$clean.label $q" - puts "$clean.draw LINE3" - puts "$clean.warning 300000" - puts "$clean.critical 700000" - } - } - "autoconf" { - puts "yes" - } - } - } else { - foreach {q m} $queues { - set clean [clean_fieldname $q] - puts "$clean.value $m" - } - } -} - -main $argc $argv - diff --git a/plugins/rabbitmq/rabbitmq_messages b/plugins/rabbitmq/rabbitmq_messages new file mode 100755 index 00000000..68a37da9 --- /dev/null +++ b/plugins/rabbitmq/rabbitmq_messages @@ -0,0 +1,75 @@ +#!/bin/sh +# +# Plugin to monitor the queues of a virtual_host in RabbitMQ +# +# Usage: Link or copy into /etc/munin/node.d/ +# +# Parameters +# env.vhost +# env.queue_warn +# env.queue_crit +# +# Magic markers (optional - only used by munin-config and some +# installation scripts): +# +#%# family=auto +#%# capabilities=autoconf + +# 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. + +HOME=/tmp/ +VHOST=${vhost:-"/"} +QUEUES=$(HOME=$HOME rabbitmqctl list_queues -p $VHOST name | \ + grep -v '^Listing' | \ + grep -v 'done\.$' | sed -e 's/[.=-]/_/g' ) + +if [ "$1" = "config" ]; then + QUEUE_WARN=${queue_warn:-10000} + QUEUE_CRIT=${queue_crit:-20000} + + # The host name this plugin is for. (Can be overridden to have + # one machine answer for several) + + # The title of the graph + echo "graph_title RabbitMQ $VHOST list_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 1000 -l 0' + # The Y-axis label + echo 'graph_vlabel queue_size' + # We want Cur/Min/Avg/Max unscaled (i.e. 0.42 load instead of + # 420 milliload) + #echo 'graph_scale no' + echo 'graph_category RabbitMQ' + + for queue in $QUEUES; do + echo "$queue.label $queue" + echo "$queue.warning $QUEUE_WARN" + echo "$queue.critical $QUEUE_CRIT" + echo "$queue.info Queue size for $queue" + done + + echo 'graph_info Lists how many messages are in each 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. + +HOME=$HOME rabbitmqctl list_queues -p $VHOST | \ + grep -v "^Listing" | grep -v "done.$" | \ + perl -nle'($q, $s) = split; $q =~ s/[.=-]/_/g; print("$q.value $s")' diff --git a/plugins/rabbitmq/rabbitmq_messages_unacknowledged b/plugins/rabbitmq/rabbitmq_messages_unacknowledged new file mode 100755 index 00000000..62bbcc75 --- /dev/null +++ b/plugins/rabbitmq/rabbitmq_messages_unacknowledged @@ -0,0 +1,75 @@ +#!/bin/sh +# +# Plugin to monitor the queues of a virtual_host in RabbitMQ +# +# Usage: Link or copy into /etc/munin/node.d/ +# +# Parameters +# env.vhost +# env.queue_warn +# env.queue_crit +# +# Magic markers (optional - only used by munin-config and some +# installation scripts): +# +#%# family=auto +#%# capabilities=autoconf + +# 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. + +HOME=/tmp/ +VHOST=${vhost:-"/"} +QUEUES=$(HOME=$HOME rabbitmqctl list_queues -p $VHOST name | \ + grep -v '^Listing' | \ + grep -v 'done\.$' | sed -e 's/[.=-]/_/g' ) + +if [ "$1" = "config" ]; then + QUEUE_WARN=${queue_warn:-10000} + QUEUE_CRIT=${queue_crit:-20000} + + # The host name this plugin is for. (Can be overridden to have + # one machine answer for several) + + # The title of the graph + echo "graph_title RabbitMQ $VHOST Unacknowledged Messages" + # 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 1000 -l 0' + # The Y-axis label + echo 'graph_vlabel unacknowledged' + # We want Cur/Min/Avg/Max unscaled (i.e. 0.42 load instead of + # 420 milliload) + #echo 'graph_scale no' + echo 'graph_category RabbitMQ' + + for queue in $QUEUES; do + echo "$queue.label $queue" + echo "$queue.warning $QUEUE_WARN" + echo "$queue.critical $QUEUE_CRIT" + echo "$queue.info Unacknowledged messages for $queue" + done + + echo 'graph_info Lists how many messages are in each 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. + +HOME=$HOME rabbitmqctl list_queues -p $VHOST name messages_unacknowledged | \ + grep -v "^Listing" | grep -v "done.$" | \ + perl -nle'($q, $s) = split; $q =~ s/[.=-]/_/g; print("$q.value $s")' diff --git a/plugins/rabbitmq/rabbitmq_messages_uncommitted b/plugins/rabbitmq/rabbitmq_messages_uncommitted new file mode 100755 index 00000000..5081bc02 --- /dev/null +++ b/plugins/rabbitmq/rabbitmq_messages_uncommitted @@ -0,0 +1,75 @@ +#!/bin/sh +# +# Plugin to monitor the queues of a virtual_host in RabbitMQ +# +# Usage: Link or copy into /etc/munin/node.d/ +# +# Parameters +# env.vhost +# env.queue_warn +# env.queue_crit +# +# Magic markers (optional - only used by munin-config and some +# installation scripts): +# +#%# family=auto +#%# capabilities=autoconf + +# 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. + +HOME=/tmp/ +VHOST=${vhost:-"/"} +QUEUES=$(HOME=$HOME rabbitmqctl list_queues -p $VHOST name | \ + grep -v '^Listing' | \ + grep -v 'done\.$' | sed -e 's/[.=-]/_/g' ) + +if [ "$1" = "config" ]; then + QUEUE_WARN=${queue_warn:-10000} + QUEUE_CRIT=${queue_crit:-20000} + + # The host name this plugin is for. (Can be overridden to have + # one machine answer for several) + + # The title of the graph + echo "graph_title RabbitMQ $VHOST Uncommitted Messages" + # 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 1000 -l 0' + # The Y-axis label + echo 'graph_vlabel uncommitted' + # We want Cur/Min/Avg/Max unscaled (i.e. 0.42 load instead of + # 420 milliload) + #echo 'graph_scale no' + echo 'graph_category RabbitMQ' + + for queue in $QUEUES; do + echo "$queue.label $queue" + echo "$queue.warning $QUEUE_WARN" + echo "$queue.critical $QUEUE_CRIT" + echo "$queue.info Uncommitted messages for $queue" + done + + echo 'graph_info Lists how many messages are in each 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. + +HOME=$HOME rabbitmqctl list_channels -p $VHOST name messages_uncommitted | \ + grep -v "^Listing" | grep -v "done.$" | \ + perl -nle'($q, $s) = split; $q =~ s/[.=-]/_/g; print("$q.value $s")' diff --git a/plugins/rabbitmq/rabbitmq_queue_memory b/plugins/rabbitmq/rabbitmq_queue_memory new file mode 100755 index 00000000..554e098e --- /dev/null +++ b/plugins/rabbitmq/rabbitmq_queue_memory @@ -0,0 +1,75 @@ +#!/bin/sh +# +# Plugin to monitor the queues of a virtual_host in RabbitMQ +# +# Usage: Link or copy into /etc/munin/node.d/ +# +# Parameters +# env.vhost +# env.queue_warn +# env.queue_crit +# +# Magic markers (optional - only used by munin-config and some +# installation scripts): +# +#%# family=auto +#%# capabilities=autoconf + +# 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. + +HOME=/tmp/ +VHOST=${vhost:-"/"} +QUEUES=$(rabbitmqctl list_queues -p $VHOST name | \ + grep -v '^Listing' | \ + grep -v 'done\.$' | sed -e 's/[.=-]/_/g' ) + +if [ "$1" = "config" ]; then + QUEUE_WARN=${queue_warn:-10000} + QUEUE_CRIT=${queue_crit:-20000} + + # The host name this plugin is for. (Can be overridden to have + # one machine answer for several) + + # The title of the graph + echo "graph_title RabbitMQ $VHOST Memory used by queue" + # 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' + + for queue in $QUEUES; do + echo "$queue.label $queue" + echo "$queue.warning $QUEUE_WARN" + echo "$queue.critical $QUEUE_CRIT" + echo "$queue.info Memory used by $queue" + done + + echo 'graph_info Show memory usage by 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. + +HOME=$HOME rabbitmqctl list_queues -p $VHOST name memory | \ + grep -v "^Listing" | grep -v "done.$" | \ + perl -nle'($q, $s) = split; $q =~ s/[.=-]/_/g; print("$q.value $s")'