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.

Status

This is work in progress, but is functional.

Installation

This can be installed with pip.

pip install jetblack-rabbitmqmon

Usage

The following gets an overview.

import asyncio
from jetblack_rabbitmqmon.monitor import Monitor

async def main_async():
    mon = Monitor(
        '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

async def main_async():
    mon = Monitor(
        '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

async def main_async():
    mon = Monitor(
        '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-1.0.0.tar.gz (14.0 kB view hashes)

Uploaded Source

Built Distribution

jetblack_rabbitmqmon-1.0.0-py3-none-any.whl (18.6 kB view hashes)

Uploaded Python 3

Supported by

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