learner
learner

Reputation: 1982

Get Number of connection from all host to my activemq broker

ActiveMQ broker setup:

Broker is running on machine: hostA

Clients from different host can connect to my broker instance running on hostA, there can be any number of client from any host.

Is there a way to find out how many clients are connected to broker and also list which tell me how many connection from each host is there to my broker.

I want to do this without making assumption about number of hosts.

I can do this by using lsof command and some parsing over output, but I am in situation where I can not use this.

Is there any feature provided by ActiveMQ command line utility activemq-admin.

Upvotes: 1

Views: 3763

Answers (1)

Erik Williams
Erik Williams

Reputation: 933

You can get to pretty much any Mbean attribute ActiveMQ exposes via the activemq-admin. There are no attributes or operations that give you a quick count of connections from specific clients. You will have to do some work on your end to get all the details you want, but all the raw data is there.

Examples:

Broker Stats:

activemq-admin query --objname type=Broker,brokerName=localhost  

Connection Stats

activemq-admin query --objname type=Broker,brokerName=localhost,connector=clientConnectors,connectorName=<transport connector name>,connectionViewType=clientId,connectionName=* 

See full doc here.
NOTE: Documentation as of this writting has not be updated to take into account the Mbean changes made in AMQ. References to Object names in examples are not correct.

You can get the object name (or example sytax) from JMX (using jconsole or visual vm for example) from the MBeanInfo. Each object name wills stat something like org.apache.activemq:type. For the script, remove the "org.apache.activemq:" and you should be in business for any thing you need from JMX via the script.

I think you may also look into using Jolokia with your broker. Although not compatible with the activemq-admin script, you can reach everything you can from the activemq-admin script, but also have access to all of the operations. In the past I've heavily used the activemq-admin script for local monitoring/command line administration of the broker, but have started converting everything to hit the Jolokia service. But again, activemq-admin will give you a way to access what you are looking for here.

Upvotes: 2

Related Questions