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
Release history Release notifications | RSS feed
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 hashes)
Built Distribution
Close
Hashes for jetblack-rabbitmqmon-2.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8f585866ca15f051a3f0e80cffdc0f8d346e847a3c7ce23db739902a4694277 |
|
MD5 | 2a99705100373849c92658e8e2f5913a |
|
BLAKE2b-256 | 510e99ad5577cfc49a5a879ddbf0a2d90a244efa914246081e2649f640660aee |
Close
Hashes for jetblack_rabbitmqmon-2.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d13cc4dd5e399a230eb767cef781fcf40bf44d003c19ffa8f1093446318183d |
|
MD5 | 223cfc2925f15b07d5697e5d6d857e42 |
|
BLAKE2b-256 | 196cc62dccd38fc92948aa53aa2caae8bb62499d679c84b0fdf58a8151da1a11 |