mirror of
https://github.com/cmur2/munin-rabbitmq.git
synced 2025-06-15 16:30:24 +02:00
Fix compatibility for RabbitMQ 3.7
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
#!/bin/bash
|
||||
#
|
||||
# Plugin to monitor the queues of a virtual_host in RabbitMQ
|
||||
#
|
||||
# Usage: Link or copy into /etc/munin/node.d/
|
||||
@ -26,17 +26,15 @@ if [ "$1" = "autoconf" ]; then
|
||||
fi
|
||||
|
||||
# If run with the "config"-parameter, give out information on how the
|
||||
# graphs should look.
|
||||
# graphs should look.
|
||||
|
||||
HOME=/tmp/
|
||||
VHOST=${vhost:-"/"}
|
||||
QUEUES=$(rabbitmqctl list_queues -p $VHOST name | \
|
||||
grep -v '^Listing' | \
|
||||
grep -v 'done\.$' | sed -e 's/[.=-]/_/g' )
|
||||
|
||||
QUEUES=$(HOME=$HOME rabbitmqctl list_queues -p $VHOST name | grep -v '^Listing' | grep -v 'done\.$' | grep -v "\.\.\." | sed 's/[^a-z0-9]\+/_/g')
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
QUEUE_WARN=${queue_warn:-10000}
|
||||
QUEUE_CRIT=${queue_crit:-20000}
|
||||
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)
|
||||
@ -70,4 +68,11 @@ fi
|
||||
# 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.$" | sed "s/[\t]/.value /g"
|
||||
IFS=$'\n'
|
||||
for line in $(HOME=$HOME rabbitmqctl list_queues -p $VHOST name memory | grep -v "^Listing" | grep -v "done.$" | grep -v "\.\.\."); do
|
||||
echo -n "$line" | cut -f1 | tr -d '\n' | sed 's/[^a-z0-9]\+/_/g'
|
||||
echo -n ".used.value "
|
||||
echo -n "$line" | cut -f2 | tr -d '\n'
|
||||
echo ""
|
||||
done
|
||||
IFS=$' \t\n'
|
||||
|
Reference in New Issue
Block a user