- Zenoss 2.5 and above ( I have not tested on 3.+ or <2 .4 )
- lxml Python module ”easy_install lxml” as the zenoss user
- “Zenoss_Template_Manager.py” Optional, Only needed if you do not want to add all the datapoints manually… I DON’T!!!!
- RabbitMQ Installed
- RabbitMQ Status Plugin from http://www.lshift.net/blog/2009/11/30/introducing-rabbitmq-status-plugin
Zenoss Template Manager = Download
CheckRabbitMQ.py = Download
Once you have all the above, we are ready to go..
- 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/check_rabbitmq.py -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/Zenoss_Template_Manager.py -o “/Devices/Server/Linux/RabbitMQ” -c ‘/opt/zenoss/libexec/check_rabbitmq.py -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 http://www.linuxdynasty.org/howto-add-multiple-datapoints-to-zenoss-using-the-zenoss-api.html
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/Zenoss_Template_Manager.py -o “/Devices/Server/Linux//RabbitMQ” -c ‘/opt/zenoss/libexec/check_rabbitmq.py -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……