When I was trying to display rabbitmq queue details as follows, It display result as follows:
sudo rabbitmqctl list_queues | grep notifications.info
notifications.info 37
Now my question is that how to fetch or view those messages or information contained in notifications.info.
In case you have the admin plugin installed, you can peek inside those messages using the admin UI. Usually available on port 15672 of your rabbitmq host.
You can see if this plugin is installed by running:
rabbitmq-plugins list
Another way to receive messages from the queue is by using one of the many rabbitmq clients. E.g. the RabbitMq java client: https://www.rabbitmq.com/java-client.html. What's your favorite programming language? Chances are that there is a client for you. Here is an overview of available clients: https://www.rabbitmq.com/devtools.html
Related
I came across an interesting subject when reading the book "RabbitMQ in Action" by Manning. Apparently it's possible to set up consumers to be able to receive all RabbitMQ logging in real time in the consumer.
I read that RabbitMQ publishes logging to an exchange of type topic called amq.rabbitmq.log. Consumers can listen to specific severity levels, for example it can be filtered by setting the routing key to error, warning or info.
My question is; I installed a default RabbitMQ server on my PC, but I couldn't find any exchange called amq.rabbitmq.log. Only one which could be related is amq.rabbitmq.trace, but this one is used for events (events like queue.deleted, queue.created, ...), in other words that one is not what I'm looking for.
Can anyone bring clarification to my questions? Why is the amq.rabbitmq.log exchange not available on a clean RabbitMQ server installation?
citation:
Perhaps when you were listing exchanges using rabbitmqctl you spotted
an exchange called amq.rabbitmq.log whose type is topic. RabbitMQ will
publish its logs to that exchange using the severity level as a
routing key - you'll get error, warning and info. Based on what you
learned from the previous chapters you can create a consumer to
listen to those logs and react accordingly.
You have to enable it. Create the /etc/rabbitmq/rabbitmq.conf file and ensure that this line is present in it:
log.exchange = true
I just grepped the source for the rabbitmq.com website and don't see that setting documented anywhere. If you'd like, file a new issue in that repository and I'll fix it, or open your own PR to do so.
NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.
It is a bit late, but hope it help someone. So far it works for me. The exchange "amq.rabbitmq.log" will be created automatically by the rabbitmq broker itself. The RabbitMQ broker version that I am using is: 3.8.1
add
log.exchange = true
into your rabbitmq.conf file and restart your rabbitmq service.
You will need to restart your rabbitmq service everytime you had updated the rabbitmq.conf file.
open cmd and enter the following in windows:
rabbitmq-service stop
rabbitmq-service install
rabbitmq-service start
rabbitmqctl start_app
is there a way to understand who is the master node in the cluster High Availability configuration?
is it possibile to do this using the monitoring tool ?
is there a way to understand who is the master node in the cluster
High Availability configuration?
I assume you mean "queue master", i.e. the node that is running the actual queue. This information can be shown by running rabbitmqctl list_queues name pid which will show the name of the master node in the pid column. Or, you can query the information using the HTTP API
$ curl -4su guest:guest localhost:15672/api/queues/%2F | jq '.[] | "\(.name) \(.node)"'
"amq.gen-S-CMD0E2NPXabpIOGdvDQg rabbit#localhost"
"test rabbit#localhost"
NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.
I'm trying to configure Flower, Celery's monitoring tool. This works ok overall, but I cannot see anything under the broker tab. I can see stuff under "workers", 'tasks' and 'monitor' and the graphs are updating. I'm using the following to start flower:
celery flower --broker=amqp://<username>:<password>#<ipaddress>:5672/vhost_ubuntu --broker_api=http://<username>:<password>#<ipaddress>:15672/api
Relevant error message I'm receiving is: Unable to get broker info: 401 Client Error: Unauthorized
I can login to RabbitMQ management via http://:15672/ with username guest and password guest
Any ideas as to why I can't see the messages under the broker tab?
This reply might be a few years too late, but I finally figured out why I was having the same issue. Once you enable the rabbitmq_management plugin, you need to give the user that you are using to connect to rabbitmq permission to use it. At heart, the rabbitmq-management plugin gives you a user interface to check on your amqp server, if you credentials work to login to the portal they should work with the API once the administrator tag is added.
sudo rabbitmqctl set_user_tags <username> administrator
You need to enable flower to access rabbitmq. For that run these commands in your terminal
sudo rabbitmq-plugins enable rabbitmq_management
sudo service rabbitmq-server restart
Also make sure that current user has relevant permissions on rabbitmq.
Now if you run flower, it should show the broker.
Also there is a bug in older version of tornado. Make sure to upgrage tornado so that flower works properly.
pip install --upgrade tornado
I read in ActiveMQ page, using JMX we can monitor queues in activemq. How can we get notified if a queue has messages (depth high) or service interval is high in ActiveMQ. Without using any shell scripts in unix environment. Is it possible through Java program? If yes, give me some ideas to get this done.
For a JMX-free approach, you can also use the XML feed served by the activemq console page. The XML feed is hosted at http://ip:port/admin/xml/queues.jsp
This will have tags similar to this for each queue:
<queue name="your queue">
<stats size="0" consumerCount="1" enqueueCount="0" dequeueCount="0"/>
....
</queue>
Just parse this XML in your code and you are good to go.
you can use Java via JMX APIs to periodically poll for queue stats (see this guide)
for the notification approach, you'd need to use advisory messages to monitor messages delivered to a queue (see this guide)
Yes it is possible in Java.
Starting from version 5.8 of ActiveMQ jolokia agent comes embedded. So it is possible for you to get all stats that JMX can pull using HTTP request which will retuen you stats as JSON and then you can check current values and raise Email alert using SMTP if values go beyond threshold you have decided.
Lets say you want to pull Broker stats using Jolokia hit below URL in your browser enter AMQ console username and password which is admin by default
http://servername.com:8161/api/jolokia/read/org.apache.activemq:type=Broker,brokerName=localhost
Or if you dont want to go through all this trouble , You can use ready made Python script which I have created to Monitor AMQ Heap, Queue params and Broker availability.You can take a look , it may help you in developing your custiom script or program
AMQMonitor and Alerting script
I'm looking for a client (as in GUI client, not client library) to play with our MQ server and familiarize myself with its semantics. Something that will send and receive messages at the press of a button (or a text command) and maybe even update me about the status of the server queues and messages. Administration would be a bonus. The UI doesn't have to be graphical (i.e. command line clients are fine).
The server will probably run RabbitMQ so anything RabbitMQ-specific is fine, as is ActiveMQ. But I'd rather have a generic AMQP or STOMP tool.
So, does anything of the sort exist?
I know some management and monitoring tools come with both server distributions, but no clients, right?
For Apache ActiveMQ, there is
the web admin console at http://localhost:8161/admin/
the ApacheActiveMQBrowser project on Sourceforge:
An open source project of developing
Message admin gui based tools for
Apache ActiveMQ.
HermesJMS, it does not mention ActiveMQ 5 (only 3 and 4) on the plugin page, but there is an active user forum
The rabbitmq-management plugin that comes with RabbitMQ (and enabled by rabbitmq-plugins enable rabbitmq_management) has a web-based interface that listens on the port 15672 and can do everything you are (I was) asking for.
Check out the BQL RabbitMQ plugin.
It gives you an SQL-style language for AMQP. For instance,
BQL> create exchange myexchange;
ok
BQL> create durable queue 'myqueue'
ok
BQL> select name,messages from queues where 'durable'=true order by name
----------------------
| name | messages |
----------------------
| myqueue | 0 |
Obviously, it's RabbitMQ specific.
If you're willing to do a bit of coding, you could take a look at the examples in the RabbitMQ Java and .NET clients:
Java examples
.NET examples
They're not quite graphical, but trying to understand them forces you to ask the right questions.
It's been a while, but I remember thinking that the best way to familiarize yourself with AMQP is to read the 0-9-1 spec and write some simple programs; in particular, the protocol documentation on that site gives a lot of examples.
Command line tools (written in C) to send and receive AMQP messages: http://github.com/rmt/amqptools