mirror of
https://github.com/cmur2/munin-rabbitmq.git
synced 2025-06-15 16:30:24 +02:00
Use HTTP API of management plugin to lower CPU load
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
# Usage: Link or copy into /etc/munin/node.d/
|
||||
#
|
||||
# Parameters
|
||||
# env.vhost <AMQ virtual host>
|
||||
# env.url <url of management plugin>
|
||||
# env.queue_warn <warning queuesize>
|
||||
# env.queue_crit <critical queuesize>
|
||||
#
|
||||
@ -28,11 +28,9 @@ 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\.$' | grep -v "\.\.\." | sed 's/[^a-z0-9]\+/_/g')
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
QUEUES=$(curl -sS $url/api/queues | jq -r '.[] | .name' | sed 's/[^a-z0-9]\+/_/g')
|
||||
|
||||
QUEUE_WARN=${queue_warn:-10000}
|
||||
QUEUE_CRIT=${queue_crit:-20000}
|
||||
|
||||
@ -69,10 +67,10 @@ fi
|
||||
# "value" subfield for every data field.
|
||||
|
||||
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'
|
||||
for line in $(curl -sS $url/api/queues | jq -c -r '.[] | {name: .name, memory: .memory}'); do
|
||||
echo -n "$line" | jq -j '.name' | sed 's/[^a-z0-9]\+/_/g'
|
||||
echo -n ".used.value "
|
||||
echo -n "$line" | cut -f2 | tr -d '\n'
|
||||
echo -n "$line" | jq -j '.memory'
|
||||
echo ""
|
||||
done
|
||||
IFS=$' \t\n'
|
||||
|
Reference in New Issue
Block a user