On Tue, Nov 7, 2017 at 10:20 PM, Shobhana <shobh...@quickride.in> wrote:
> I want to monitor my broker using JMX MBeans; useJmx is set to true. I use > AMQ v 5.14.5. I have a few questions: > > a) How can I get current connections count? I see TotalConnectionsCount > but I think this gives a count of all connections since the broker was > started even if the connection is no longer active. > Looking through the code (AbstractRegion.removeConsumer() and BaseDestination.removeSubscription(), for example), it looks to me like this counter gets decremented when connections are removed, which would indicate that it's the count of currently-active connections rather than the total number that had ever been made. But that's purely from code inspection, so you'd probably want to double-check that you're seeing the behavior you expect before you go relying on it in production. > b) Why is TotalDequeueCount higher than TotalEnqueueCount? > For topics with more than one consumer, each message is enqueued only once but dequeued once per consumer. There might be other situations that could also cause this, but the topics explanation is probably the most likely to be the reason you're seeing that behavior. > c) Why is TotalMessageCount always 0? MemoryPercentUsage and > StorePercentUsage are also 0 always > Do you have unconsumed messages in your broker at the time you're looking at those values? If not, that would explain the behavior you're seeing. > d) Can I use wild card entry for destinationName to get statistics for all > destinations that I am interested in? We have tens of thousands of > destinations and hence querying by each destination is unreasonable. > If your question is whether your JMX query can return multiple MBeans by specifying a wildcard in the object name, then yes it can. However, be aware that using JMX to interact with MBeans in another process involves RPC calls that are expensive, so iterating over tens of thousands of MBeans will be unreasonable from a performance standpoint even if you could get them all via a single query. You may want to look at the Jolokia JMX-HTTP bridge (which gathers the statistics within the broker's own JVM and then simply transfers the results via HTTP) to get better performance. There's some basic information at the bottom of http://activemq.apache.org/rest.html, but you'll need to Google if you need further information about how to use it. Tim