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())
Metadata
Release files for jetblack-rabbitmqmon 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jetblack-rabbitmqmon-2.0.0.tar.gz | 15.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jetblack_rabbitmqmon-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 35.6 kB
Release files / jetblack-rabbitmqmon-2.0.0.tar.gz
| Download URL | jetblack-rabbitmqmon-2.0.0.tar.gz |
|---|---|
| Size | 15.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b8f585866ca15f051a3f0e80cffdc0f8d346e847a3c7ce23db739902a4694277
|
|
BLAKE2b-256 checksum How to use checksums |
510e99ad5577cfc49a5a879ddbf0a2d90a244efa914246081e2649f640660aee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.2 CPython/3.7.5 Linux/4.15.0-96-generic
|
Release files / jetblack_rabbitmqmon-2.0.0-py3-none-any.whl
| Download URL | jetblack_rabbitmqmon-2.0.0-py3-none-any.whl |
|---|---|
| Size | 20.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9d13cc4dd5e399a230eb767cef781fcf40bf44d003c19ffa8f1093446318183d
|
|
BLAKE2b-256 checksum How to use checksums |
196cc62dccd38fc92948aa53aa2caae8bb62499d679c84b0fdf58a8151da1a11
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.2 CPython/3.7.5 Linux/4.15.0-96-generic
|