This script is sending RabbitMQ queue sizes (sum of all ready and unacknowledged messages in all queues) to CopperEgg.
-
Make sure that you have
rabbitmqctl
installed. -
Run
bundle install
-
Run the script manually to see if it works:
$ ruby rabbitmq-copperegg-metrics.rb YOUR_API_KEY YOUR_RABBITMQ_NODE_NAME YOUR_DIRECTORY_PATH_TO RABBITMQ_SBIN
-
Add the script to your Crontab to let it report metrics every minute:
-
-
-
-
- /usr/bin/ruby /opt/copperegg/rabbitmq-copperegg-metrics/rabbitmq-copperegg-metrics.rb YOUR_API_KEY YOUR_RABBITMQ_NODE_NAME YOUR_DIRECTORY_PATH_TO_RABBITMQ_SBIN
-
-
-
-
It might be that you have to append a :U
to the end of your API KEY. The CopperEgg documentation shows that for all examples except Ruby and it is not working without the :U
for me. Support request is sent so this might be clarified soon.
Support for passing the parameter named YOUR_RABBITMQ_NODE_NAME allows for the scenario of running multiple RabbitMQ server instances on a single machine.
Support for passing the parameter named YOUR_DIRECTORY_PATH_TO_RABBITMQ_SBIN allows for installing RabbitMQ into different directory structures - and not having to edit the ruby script.
The data will show in CopperEgg as Custom Objects.
- If waiting_messages > 0 then there are messages needing processed.
- If waiting_messages = 0 then there are no messages to be processed.
- If waiting_messages < 0 then there are either no queues or there was a communications problem getting the queue statistics.