How to setup RabbitMQ Queues monitoring using Nagios

Installing the Nagios RabbitMQ plugin.


The RabbitMQ plugin here we are going to use is validated listed under monitoring section by

The installation is done as follows:


The Perl library can be downloaded and installed as follows:

cd /tmp/


tar xvf Nagios-Plugin-0.36.tar.gz

cd Nagios-Plugin-0.36

perl Makefile.PL


make test

make install


In case you do not have the make, Please install it using following command to complete the make install of Nagios Plugin:

ap install make

Ofcourse the primary requirement is to have the nrpe setup installed

This can be done as follows in a ubuntu system:

# apt install nagios-nrpe-server nagios-plugins


Now we can go ahead and start the setup of rabbitMQ plugin.


cd /usr/local/nagios/libexec/

clone the repository.

git clone

The repository already contains the executables in script directory which we will use for monitoring after completion.

We now have to provide the required perl libraries to support the rabbitmq-nagios plugins and execute them.

Lets us now proceed and organize the directory structure and move directory nagios-plugins-rabbitmq to /usr/local/nagios/libexec/

# mv nagios-plugins-rabbitmq /usr/local/nagios/libexec/

Change the ownership to nagios user, This step is important and must to done as a prerequisite,

ensure that you have the desired nagios user already present by running the below command

# id nagios

Change the ownership to nagios user and group.

# sudo chown nagios:nagios nagios-plugins-rabbitmq -R

The files and directories now should be owned by the nagios user and group

Now we can go ahead and install the required modules from cpan.

Run the cpan command to fetch and install perl dependencies


On some systems you might face some problems while trying to install ” install Monitoring::Plugin ”

cpan[1]> install Monitoring::Plugin

You may try this

cpan[1]> install Nagios::Monitoring::Plugin

After installing it, Next install LWP

cpan[2]> install LWP

After installing it, Next install JSON

cpan[3]> install JSON

Type exit to exit out of the cpan prompt.

cpan[4]> exit

Terminal does not support GetHistory.
Lockfile removed.


Alternatively you may also run the cpanm and avoid entering into the cpan subshell and issue the perl install commands

# apt install cpanminus

You may also use this to install Nagios::Plugin

After the installation is completed without any errors you would have successfully installed the RabbitMQ nagios plugins.

Now check the installation by going to scripts directory

# /usr/local/nagios/libexec/nagios-plugins-rabbitmq/scripts

Lets look at what plugins are provided for rabbitmq

/usr/local/nagios/libexec/nagios-plugins-rabbitmq/scripts# ls
check_rabbitmq_aliveness check_rabbitmq_connections check_rabbitmq_objects check_rabbitmq_partition check_rabbitmq_server check_rabbitmq_watermark check_rabbitmq_cluster check_rabbitmq_exchange check_rabbitmq_overview check_rabbitmq_queue check_rabbitmq_shovels

As most of them are set with executable bit, run any check by giving absolute path or relative prefixing ./check_rabbitmq_aliveness

You can pass -h to print the help menu

The commands shall take the mandatory option of Hostname Port followed by the login credentials -u username and -p password

[email protected]:/usr/local/nagios/libexec/nagios-plugins-rabbitmq/scripts# sudo ./check_rabbitmq_server -H “” -u “guest” -p “guest”


RABBITMQ_SERVER OK – Memory OK (2.63%) Process OK (0.08%) FD OK (0.27%) Sockets OK (0.10%) | Memory=2.63%;80;90 Process=0.08%;80;90 FD=0.27%;80;90 Sockets=0.10%;80;90


Similarly the other important plugin is to get the queue status.

This plugin provides various checks on the RabbitMQ

The most useful checks are monitoring and alerting the queue names on features such as the Messages in Queue, Messages in Ready State, Un-Acknowledged messages and the number of Consumers.

The order for the Warning and Critical are

messages ,messages_ready ,messages_unacknowledged ,consumers

Here we are monitoring the RabbitMQ queue download_queue, for the messages_ready if exceeding 0 then, warning notification will be sent.

[email protected]:/usr/local/nagios/libexec/nagios-plugins-rabbitmq/scripts# ./check_rabbitmq_queue -H “” -u “guest” -p “guest” –queue “download_queue” -w -1,0,-1,-1


RABBITMQ_QUEUE CRITICAL – messages_ready CRITICAL (4219), messages OK (4269) messages_unacknowledged OK (50) consumers OK (2) | messages=4269;; messages_ready=4219;;0 messages_unacknowledged=50;; consumers=2;;


Leave a Comment