Monitoring RabbitMQ with Zenoss

RabbitMQ was recently deployed in the company I currently work for. At the last minute ( as always ) they came to me and ask me to please add RabbitMQ monitoring to Zenoss. They said here is the url and now please monitor for a few stats ( using the RabbitMQ Status Plugin ). So I said to myself, I could easily just write a quick shell script to get the 3 stats that they needed and add them into Zenoss. After thinking about it…. In the near future they might ask for more than those 3 stats. So I decided to write a quick python script ( Zenoss Compatible ) to get all the stats from that status page and input them into Zenoss…


  1. Zenoss 2.5 and above ( I have not tested on 3.+ or <2 .4 )
  2. lxml Python module    “easy_install lxml” as the zenoss user
  3.” Optional, Only needed if you do not want to add all the datapoints manually… I DON’T!!!!
  4. RabbitMQ Installed
  5. RabbitMQ Status Plugin from

Zenoss Template Manager = Download = Download

Once you have all the above, we are ready to go..

  1. copy both Python Scripts above into the /opt/zenoss/libexec/ folder  ( If you are using RedHat/CentOS ) and make sure they are executable.

As the Zenoss user run the script ….
/opt/zenoss/libexec/ -u ‘http://rabbitmq-server:55672′ -a ‘mon-user mon-passwd’ |sed -re “s/^OK|/ /g” |sed -re “s/([A-Za-z0-9_.]+*)?=[0-9]+/-p “1,G”/g” |xargs /opt/zenoss/libexec/ -o “/Devices/Server/Linux/RabbitMQ” -c ‘/opt/zenoss/libexec/ -u “http://rabbitmq-server:55672″ -a “mon-user mon-passwd”‘ –template=RabbitMQ –dsource=RabbitMQStats -V $1

If you need to know how to use the Zenoss_Template_Manager.y script, check here

So let me explain what the sed statements above are doing…

  • “sed -re “s/^OK|/ /g”” This sed statement is removing the OK| from the beginning of the line
  • “sed -re “s/([A-Za-z0-9_.]+*)?=[0-9]+/-p “1,G”/g”
    This 1st part of the sed statement is matching any letter,number,underscore, and period, any number of times until it reaches the equal “=”  “[A-Za-z0-9_.]+*)?=
    The  2nd part of this statement is going to match the “=” and any number of integers after it. “[0-9]+
    Now we need to make the substitution…. So we are going to substitute, every match with a -p,  then a space and then the 1st group match in escaped quotes, then a comma and G for GAUGE.

The 2 sed statements above will do that for every match it finds. If you were to add each datapoint by hand, it would look like this….
/opt/zenoss/libexec/ -o “/Devices/Server/Linux//RabbitMQ” -c ‘/opt/zenoss/libexec/ -u “http://rabbitmq-server:55672″ -a “mon-user mon-passwd”‘ –template=RabbitMQ –dsource=RabbitMQStats -V -p “queue.conversion.event.tracking_msg_unack,G” -p “connections,G” -p “erlang_processes_used,G” -p “erlang_processes_avail,G” -p “file_descriptors_used,G” -p “file_descriptors_avai,G” -p “binary_memory,G” -p “memory_used,G” -p “memory_avail,G”

I hope the above scripts will save someone time and frustration……

connections=26 erlang_processes_used=252 erlang_processes_avail=1048576 file_descriptors_used=1 file_descriptors_avail=1024 pid=3167  binary_memory=0 ets_memory=0  memory_used=27 memory_avail=99


This entry was posted in Zenoss and tagged , . Bookmark the permalink.

Leave a Reply