I was going to upload this as a template, but - after looking through the template - it made 0 sense to do as a template. I will, however, give a script for monitoring how many ready messages are currently in your RabbitMQ queues:
sudo rabbitmqctl list_queues | grep -v 'dev\|amq\.gen' | tr "\t" "," | sed "s/\./_/g" | sed '1d;$d' | awk -F, '{printf "Statistic.%s: %s\n", $1, $2 }'
In order to get this working, here are the steps you need to do:
- Use sudoers to allow your SAM user to run rabbitmqctl without entering a password.
- Create a new application template. Give it a useful name.
- Create a new script monitor. Give it a useful name.
- Set the command line to ${SCRIPT}
- In my script above, look at "| grep -v 'dev\|amq\.gen' |". This excludes dev and amq.gen (dynamically created) queues. Ask yourself the following:
- What queues do I need to monitor? Is it easier to grep just those or exclude some?
- Do I have more than 10 queues I need to monitor? If so, use grep to get up to 10 queues at a time. Create multiple script monitors. Rinse, wash, repeat.
- Do I have dynamically created queues that I need to monitor? If so, I can't help you there, sorry.
- In the new script monitor, click Edit Script.
- Past in your script.
- Click "Get Script Output" and save.
- Go through your script output and, if you're OCD, replace underscores with periods.
- More importantly, SET THRESHOLDS FOR EACH QUEUE. I assume you have need of that and found this script to help with that.
- Set up an alert for the application.
Good luck!