No "messages" entry in http://localhost:15672/api/queues results

619 views
Skip to first unread message

Remi Cote

unread,
Feb 6, 2018, 11:45:25 AM2/6/18
to rabbitmq-users
Hi.

I want to use the management HTTP API to get the number of messages and consumers on all queues in my system. In fact, I would like to find the HTTP API URI to use to get the same results as if I type the following command at the command line:

>>> rabbitmqctl.bat list_queues name messages consumers

Reading the documentation and several postings, I believe I should get some good results using the following uri:


Results show the name of all the queues I have in the system. However, I do not see either messages or consumers entries in the output. If I omit the parameters and only issue the uri "http://localhost:15672/api/queues", I get several entries, but still no messages or consumers or nothing that would relate to that.

I am sure this is a simple matter, but I guess I am missing something. Help would be greatly appreciated.

Thanks!

Michael Klishin

unread,
Feb 6, 2018, 3:10:18 PM2/6/18
to rabbitm...@googlegroups.com
Your easiest option is to use rabbitmqadmin ().

Message stats definitely are returned in the individual queue results as well as listings,
see https://rawcdn.githack.com/rabbitmq/rabbitmq-management/v3.7.3/priv/www/doc/stats.html.

I just tried it with a development node and here's one queue object that's returned:

curl -u guest:guest -H "Accept: application/json" -X GET "http://localhost:15672/api/queues" | python -m json.tool
https://gist.github.com/michaelklishin/4afe9507b3cd34cedba0c8556f73a065


--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
MK

Staff Software Engineer, Pivotal/RabbitMQ

Michael Klishin

unread,
Feb 6, 2018, 3:10:50 PM2/6/18
to rabbitm...@googlegroups.com
There was a link missing in the previous response, rabbitmqadmin docs are at http://www.rabbitmq.com/management-cli.html.

To post to this group, send email to rabbitm...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--
MK

Staff Software Engineer, Pivotal/RabbitMQ

Remi Cote

unread,
Feb 6, 2018, 4:15:35 PM2/6/18
to rabbitmq-users
Thanks Michael for the quick response.

I looked at your curl example and saw that "messages" and "consumers" are listed in your output. However, when I do the same on my system, I do not see those items in the resulting output. Do you know if there are some management plugin configuration parameters that I need to set to see those items?

Also, I want to monitor the queue size and number of consumers from within a C# solution, so using rabbitmqadmin cli tool is not really an option. 

(Note that I tried to use IModel.MessageCount(queue) to get the message count on a queue, but the result is not the same as when I use "rabbitmqctl list_queues name messages" from the command line. I do not get consistent results (big number with rabbitmqctl and 0 with IModel.MessageCount(queue)). Note that IModel.ConsumerCount(queue) seems to be accurate, though. IModel.QueueDeclarePassive gives me the same results as MessageCount() and ConsumerCount().)

Remi

On Tuesday, 6 February 2018 15:10:50 UTC-5, Michael Klishin wrote:
There was a link missing in the previous response, rabbitmqadmin docs are at http://www.rabbitmq.com/management-cli.html.
On Tue, Feb 6, 2018 at 9:10 PM, Michael Klishin <mkli...@pivotal.io> wrote:
Your easiest option is to use rabbitmqadmin ().

Message stats definitely are returned in the individual queue results as well as listings,
see https://rawcdn.githack.com/rabbitmq/rabbitmq-management/v3.7.3/priv/www/doc/stats.html.

I just tried it with a development node and here's one queue object that's returned:

curl -u guest:guest -H "Accept: application/json" -X GET "http://localhost:15672/api/queues" | python -m json.tool
https://gist.github.com/michaelklishin/4afe9507b3cd34cedba0c8556f73a065

On Tue, Feb 6, 2018 at 5:45 PM, Remi Cote <remi....@gmail.com> wrote:
Hi.

I want to use the management HTTP API to get the number of messages and consumers on all queues in my system. In fact, I would like to find the HTTP API URI to use to get the same results as if I type the following command at the command line:

>>> rabbitmqctl.bat list_queues name messages consumers

Reading the documentation and several postings, I believe I should get some good results using the following uri:


Results show the name of all the queues I have in the system. However, I do not see either messages or consumers entries in the output. If I omit the parameters and only issue the uri "http://localhost:15672/api/queues", I get several entries, but still no messages or consumers or nothing that would relate to that.

I am sure this is a simple matter, but I guess I am missing something. Help would be greatly appreciated.

Thanks!

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.

To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
MK

Staff Software Engineer, Pivotal/RabbitMQ

Michael Klishin

unread,
Feb 6, 2018, 5:27:25 PM2/6/18
to rabbitm...@googlegroups.com
There is no management plugin configuration involved.

`rabbitmqctl list_queues` can report different metrics: messages in ready state, unacknowledged, total, message held in RAM and so on.
queue.declare-ok results only report the first one. They use the same data source for the lack of a better word.

Provided that there is a message flow, those metrics are volatile, unlike the number of consumers (in practice).

Make sure that your client is connected to the default vhost or you pass the vhost you want
to rabbitmqctl since it DOES NOT list totals across all vhosts.

To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Remi Cote

unread,
Feb 7, 2018, 8:36:09 AM2/7/18
to rabbitmq-users
Thanks again Michael.

I'll play more with IModel.MessageCount() and report back.

Remi

Remi Cote

unread,
Feb 9, 2018, 11:03:45 AM2/9/18
to rabbitmq-users
I found my issue. Wanted to report it here to maybe help others in the future...

I installed the management plugin and everything seemed OK. I was able to communicate with the HTTP API, etc. My only problem was that I didn't see any messages or consumers stats when fetching queue stats using http://localhost:15672/api/queues. Well, the problem was that I overlooked to restart the RabbitMQ service after installing the management plugin. Messages and consumers stats started to appear after I restarted the broker. Yes, silly mistake...

I am sorry I bothered you for so little, Michael. And thanks for your help!

Remi

Michael Klishin

unread,
Feb 9, 2018, 11:43:39 AM2/9/18
to rabbitm...@googlegroups.com
Plugin activation does not require node restart as of 3.4.0. So there was something else
that a restart addressed.

To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages