O'Reilly logo

RabbitMQ Cookbook by Sigismondo Boschi, Gabriele Santomaggio

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Developing Python applications to monitor RabbitMQ

In this example we're going to create a Python script to monitor RabbitMQ using the JSON API that you can access from the URL http://localhost:15672/api/.

The scope of this example is to create a custom Python script, which performs some checks and sends an e-mail if it detects some errors. You can find the source code at Chapter03/Recipe07.

Getting ready

You need Python 2.7+ and the management plugin enabled (as we have seen in the Managing RabbitMQ from a browser recipe).

How to do it…

Perform the following steps to create a Python script to monitor RabbitMQ using the JSON API:

  1. Import the following libraries:
    import sys
    import urllib2,base64
    import json
    import logging
  2. Get the required RabbitMQ information ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required