Skip to main content

RabbitMQ Monitor

Project description

jetblack-rabbitmqmon

This is an asyncio RabbitMQ monitor API.

It wraps the RabbitMQ management plugin REST api. This allows retrieving metrics and peeking into the queues.

Status

This is work in progress, but is functional.

Installation

This can be installed with pip.

Multiple clients a supported and one must be selected. Choose one of:

pip install jetblack-rabbitmqmon[bareclient]

Or alternatively:

pip install jetblack-rabbitmqmon[aiohttp]

Usage

The following gets an overview using the bareclient.

import asyncio
from jetblack_rabbitmqmon.monitor import Monitor
from jetblack_rabbitmqmon.clients.bareclient_requester import BareRequester

async def main_async():
    mon = Monitor(
        BareRequester(
            'http://mq.example.com:15672',
            'admin',
            'admins password'
        )
    )

    overview = await mon.overview()
    print(overview)

if __name__ == '__main__':
    asyncio.run(main_async())

The follow explores a vhost.

import asyncio
from jetblack_rabbitmqmon.monitor import Monitor
from jetblack_rabbitmqmon.clients.aiohttp_requester import AioHttpRequester

async def main_async():
    mon = Monitor(
        AioHttpRequester(
            'http://mq.example.com:15672',
            'admin',
            'admins password'
        )
    )

    vhosts = await mon.vhosts()
    for vhost in vhosts.values(): # vhost is a dict
      exchanges = await vhost.exchanges()
      for exchange in exchanges.values(): # exchanges is a dict
          print(exchange)
          # Objects can be refreshed to gather new metrics.
          await exchange.refresh()
          print(exchange)
          bindings = await exchange.bindings()
          for binding in bindings:
              print(binding)

if __name__ == '__main__':
    asyncio.run(main_async())

The following gets some messages from an exchange:

import asyncio
from jetblack_rabbitmqmon.monitor import Monitor
from jetblack_rabbitmqmon.clients.bareclient_requester import BareRequester

async def main_async():
    mon = Monitor(
        BareRequester(
            'http://mq.example.com:15672',
            'admin',
            'admins password'
        )
    )

    vhosts = await mon.vhosts()
    vhost = vhosts['/some-vhost']
    queues = await vhost.queues()
    queue = queues['some.queue']
    messages = await queue.get_messages()
    print(messages)

if __name__ == '__main__':
    asyncio.run(main_async())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jetblack-rabbitmqmon-2.0.0.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jetblack_rabbitmqmon-2.0.0-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file jetblack-rabbitmqmon-2.0.0.tar.gz.

File metadata

  • Download URL: jetblack-rabbitmqmon-2.0.0.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.2 CPython/3.7.5 Linux/4.15.0-96-generic

File hashes

Hashes for jetblack-rabbitmqmon-2.0.0.tar.gz
Algorithm Hash digest
SHA256 b8f585866ca15f051a3f0e80cffdc0f8d346e847a3c7ce23db739902a4694277
MD5 2a99705100373849c92658e8e2f5913a
BLAKE2b-256 510e99ad5577cfc49a5a879ddbf0a2d90a244efa914246081e2649f640660aee

See more details on using hashes here.

File details

Details for the file jetblack_rabbitmqmon-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: jetblack_rabbitmqmon-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.2 CPython/3.7.5 Linux/4.15.0-96-generic

File hashes

Hashes for jetblack_rabbitmqmon-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d13cc4dd5e399a230eb767cef781fcf40bf44d003c19ffa8f1093446318183d
MD5 223cfc2925f15b07d5697e5d6d857e42
BLAKE2b-256 196cc62dccd38fc92948aa53aa2caae8bb62499d679c84b0fdf58a8151da1a11

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page