Curl to get Rabbitmq queue size
Finally I did the trick with the following:
curl -s -i -u guest:guest http://host:port/api/queues/vhost/queue_name | sed 's/,/\n/g' | grep '"messages"' | sed 's/"messages"://g'
As much as I love hacky sed one-liners this is probably the cleanest solution:
curl -s -u <user>:<password> http://<host>:<port>/api/queues/<virtual-host>/<queue> | jq .messages
Use HTTP API from Management Plugin.
It looks you may benefit from /api/queues/(vhost)/(name)
one. The output is in plain json, so you won't miss messages
field (and related).