I am using Python to monitor the status of our Azure Service Bus implementation, and currently using the code below to identify the message count. I use this message count to ensure that the queue is not building up, which could help identify whether the worker role (which consumes from the queue) is not functioning properly.
QueueList = bus_service.list_queues()
for queue in QueueList:
queueDetails = bus_service.get_queue(queue.name)
api.Metric.send(metric="ServiceBus.%s.MessageCount" % (bus_service.service_namespace), points=queueDetails.message_count, host=queue.name)
This code works great using the "queueDetails.message_count", and we feed to results to a monitoring tool, provided the messages are active messages and go out immediately. The problem arises when something is scheduled to go out at a later time, and set as a scheduled message not an active message. This throws off our monitoring since it looks like there are messages that were no sent, when in reality they are just delayed.
I have played around with this in powershell, and see that powershell, using the Microsoft.ServiceBus.dll can return a generic "message count", but also, has the ability to break that down into active, scheduled, dead letter, etc.
I know that the python SDK is just a wrapper around the API, but I am wondering if anyone has any ideas, other than "use powershell". Although I am keeping powerhsell in mind as a last resort, I would like to continue using python if possible.
Thanks for your help everyone. Hope this post has enough details. Long time StackOverflow user, first time poster.
