From 9ccd59986371a0aaac1de03532a05e50bf59df28 Mon Sep 17 00:00:00 2001 From: Pablo Figue Date: Wed, 12 Sep 2012 15:17:39 +0200 Subject: [PATCH] Adds a HOME env. variable when calling to rabbitmqctl --- rabbitmq-connections | 4 +++- rabbitmq-consumers | 5 +++-- rabbitmq-messages | 5 +++-- rabbitmq-messages_unacknowledged | 5 +++-- rabbitmq-messages_uncommitted | 5 +++-- rabbitmq-queue_memory | 3 ++- 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/rabbitmq-connections b/rabbitmq-connections index a38c083..fb25460 100755 --- a/rabbitmq-connections +++ b/rabbitmq-connections @@ -24,6 +24,8 @@ if [ "$1" = "autoconf" ]; then exit 0 fi +HOME=/tmp/ + # If run with the "config"-parameter, give out information on how the # graphs should look. @@ -61,4 +63,4 @@ fi # real work - i.e. display the data. Almost always this will be # "value" subfield for every data field. -echo "connections.value $(rabbitmqctl list_connections | grep -v "^Listing" | grep -v "done.$" | wc -l)" +echo "connections.value $(HOME=$HOME rabbitmqctl list_connections | grep -v "^Listing" | grep -v "done.$" | wc -l)" diff --git a/rabbitmq-consumers b/rabbitmq-consumers index b500007..8a884d4 100755 --- a/rabbitmq-consumers +++ b/rabbitmq-consumers @@ -28,8 +28,9 @@ 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 | \ +QUEUES=$(HOME=$HOME rabbitmqctl list_queues -p $VHOST name | \ grep -v '^Listing' | \ grep -v 'done\.$' | sed -e 's/[.-=]/_/g' ) @@ -69,6 +70,6 @@ fi # 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| \ +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/rabbitmq-messages b/rabbitmq-messages index 8c9d30d..61d66d8 100755 --- a/rabbitmq-messages +++ b/rabbitmq-messages @@ -28,8 +28,9 @@ 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 | \ +QUEUES=$(HOME=$HOME rabbitmqctl list_queues -p $VHOST name | \ grep -v '^Listing' | \ grep -v 'done\.$' | sed -e 's/[.-=]/_/g' ) @@ -69,6 +70,6 @@ fi # real work - i.e. display the data. Almost always this will be # "value" subfield for every data field. -rabbitmqctl list_queues -p $VHOST | \ +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/rabbitmq-messages_unacknowledged b/rabbitmq-messages_unacknowledged index d982e95..d0e8e49 100755 --- a/rabbitmq-messages_unacknowledged +++ b/rabbitmq-messages_unacknowledged @@ -28,8 +28,9 @@ 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 | \ +QUEUES=$(HOME=$HOME rabbitmqctl list_queues -p $VHOST name | \ grep -v '^Listing' | \ grep -v 'done\.$' | sed -e 's/[.-=]/_/g' ) @@ -69,6 +70,6 @@ fi # 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 | \ +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/rabbitmq-messages_uncommitted b/rabbitmq-messages_uncommitted index deb6c1c..5d6e398 100755 --- a/rabbitmq-messages_uncommitted +++ b/rabbitmq-messages_uncommitted @@ -28,8 +28,9 @@ 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 | \ +QUEUES=$(HOME=$HOME rabbitmqctl list_queues -p $VHOST name | \ grep -v '^Listing' | \ grep -v 'done\.$' | sed -e 's/[.-=]/_/g' ) @@ -69,6 +70,6 @@ fi # 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_uncommitted | \ +HOME=$HOME rabbitmqctl list_queues -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/rabbitmq-queue_memory b/rabbitmq-queue_memory index 1c6f620..e19438f 100755 --- a/rabbitmq-queue_memory +++ b/rabbitmq-queue_memory @@ -28,6 +28,7 @@ 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' | \ @@ -69,6 +70,6 @@ fi # 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 | \ +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")'