Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.

Setup instructions

Jason edited this page Oct 14, 2016 · 1 revision

I solved the issue by adding the Global Regular Expression ^.*queue$ and correcting some mistakes I had in the zabbix_agentd.conf For example, in hostname I used to have Zabbix hostname server which is incorrect. After I corrected the zabbix configuration file, placed the scripts files in the correct route including the Auth file, restarted the Zabbix agent, removed the template for the RabbitMQ host and added it back, finally, I got it working. 👍

I think you should review the documentation of the installation for make the installation easier for newbies like me, the way it is got me stuck for a long time, but at the end, it was worth it to have this working, your project is a huge life saver so receive a sincere thanks. 💯

I created a list of things to remember in case I need to recreated everything again, what I did was to put your documentation along with other's people notes and my own notes. The instructions are below in case you want to take some notes too. I hope it can be some help to others like me.

First and this is very important, the installation has to be done on the RabbitMQ Client Server, the one with RabbitMQ properly installed and working. Make sure also that zabbix_sender is installed. The template only works in Zabbix Server version 3.0 or higher you must have it before the installation

  • Install the files into /etc/zabbix/ folder and change permissions to Zabbix

      # git clone https://github.com/jasonmcintosh/rabbitmq-zabbix.git
    
  • Create a folder for RabbitMQ logs:

      # mkdir /var/log/zabbix
      # chmod a+rw /var/log/zabbix
    
  • Add a new Global Regular Expression in Zabbix Server Web Interface:

    Administration -> General -> Regular Expressions -> New Regular Expression

    name: rabbitmq vhosts for discovery Expression Type: Result is FALSE Expression: ^.*queue$

Note: (I'm not sure if this step is needed, but it's working the way it is)

  • Make sure to include the Auth File in the following route where all the scripts are:

      # /etc/zabbix/scripts/rabbitmq/.rab.auth
    

Make sure the information inside of this file is accurate with your environment, take some time to verify the route of Zabbix Configuration file and RabbitMQ Web Interface credentials.

USERNAME=guest PASSWORD=guest CONF=/etc/zabbix/zabbix_agentd.conf

Note: Remember to give Zabbix permissions to read the file.

  • Modify /etc/zabbix/zabbix_agentd.conf:

      UnsafeUserParameters=1
      Include=/etc/zabbix/zabbix_agentd.conf.d/zabbix-rabbitmq.conf 
    

Note: Make sure that Parameters like Server, ServerActive and Hostname are correct, this is very important for zabbix_sender and discovery to work. Remember that Hostname has to match with the one in Zabbix Server Web Interface.

  • Make sure the RabbitMQ configuration file has the data as follows:

       # /etc/zabbix/zabbix_agentd.conf.d/zabbix-rabbitmq.conf
    

UserParameter=rabbitmq.discovery_queue,/etc/zabbix/scripts/rabbitmq/list_rabbit_queues.sh UserParameter=rabbitmq.discovery_nodes,/etc/zabbix/scripts/rabbitmq/list_rabbit_nodes.sh UserParameter=rabbitmq[*],/etc/zabbix/scripts/rabbitmq/rabbitmq-status.sh $1 $2 $3

Note: Make sure the scripts are in the correct path.

  • Restart zabbix-agent Service

      # /etc/init.d/zabbix-agent restart
    
  • Import template into Zabbix Server and use it on the RabbitMQ host.

What to do in case the installation fails?!

For start, you can check out the Zabbix logs generated by the API script.

    # tail -f /var/log/zabbix/rabbitmq_zabbix.log

You can change the level of information of the API script in order to get more relative information regarding zabbix_sender:

    # /etc/zabbix/scripts/rabbitmq.api.py

level=logging.INFO (partial information about what zabbix sender is sending) level=logging.WARNING (some information about what zabbix sender is sending) level=logging.DEBUG (detail information about what zabbix sender is sending)

So make the changes you need and keep and eye on the Zabbix logs mentioned before.

Additional Information. Queues to be Monitored.

You can also add a filter in this file to restrict which queues are monitored. This item is a JSON-encoded string. The format provides some flexibility for its use. You can either provide a single object or a list of objects to filter. The available keys are: status, node, name, consumers, vhost, durable, exclusive_consumer_tag, auto_delete, memory, policy

For example, the following filter could find all the durable queues: FILTER='{"durable": true}'

To only use the durable queues for a given vhost, the filter would be: FILTER='{"durable": true, "vhost": "mine"}'

To supply a list of queue names, the filter would be: FILTER='[{"name": "mytestqueuename"}, {"name": "queue2"}]'

Clone this wiki locally