Wednesday, 13 July 2016

Monitoring ActiveMQ with RHQ / JBossON - Part One

Connecting RHQ/JBossON is both easy and frustrating. RHQ has support for JMX connections allowing you to open ports specifically for managing your middle ware via JMX. Our Stack uses JBoss which has a wonderful full featured plugin available from the RHQ team. Were we using HornetQ or whatever JMS infrastructure is provided by the container my issue would be moot.

But! We're using a separate JVM to host ActiveMQ for all JBoss instances on the host machine. WHY? Because REASONS.

Configuring ActiveMQ

This part is super duper simple, 

Part the first.

AUTHENTICATION. 
Don't be a dummy, setup a proper read only account for your monitoring activities in the ActiveMQ jmx password and user file (Yes its a flat file, but its better than nothing, and java keystores are the worst).

Add a line to $ACTIVEMQ_HOME/conf/jmx.access eg:

rhq readonly

this creates a user called rhq, with read only access to jmx functions

Add a line to $ACTIVEMQ_HOME/conf/jmx.password eg:

rhq 2AZE8Dz+DttM<fL?

YOU ALWAYS USE SECURE PASSWORDS RIGHT?

TELLING THE CONTAINER TO ENABLE JMX

Edit the $ACTIVEMQ_HOME/conf/activemq.xml file

Find the <broker> element, and add useJmx="true"> Eg:

<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" useJmx="true">

Next, find the <managementContext> stanza. enable the create connector attrib, and define a connector port. eg:

<managementContext createConnector="true" connectorPort="1099" />

If you're using RMI through a firewall, you should also add a rmiServerPort="something" attrib on a port which your ActiveMQ instance can communicate back to your JMX client. (Eg, when using jconsole or something to debug a remote activemq)

Thats.. it! Restart your ActiveMQ instance bin/activemq restart

Documentation here


Part The Second.

Connecting your RHQ agent to your JMX endpoint.

  1. Open your RHQ web console, and browse to the platform which is hosting your ActiveMQ instance.
  2. Select the inventory tab for the platform (not the inventory tab for the whole RHQ system)
  3. On the child resources sub tab, click the Import fly away (fly up in this case?) and select JMX Server
  4. Select JDK 5 from the connection settings template dropdown.
  5. on the deployment options page, set the Connector Address field to: service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
  6. in the principal field, enter rhq (this is the read only activemq user defined in the first part)
  7. in the credentials field, enter your super secure password
  8. Click finish.
Wait as your RHQ agent now evaluates the available mbeans and makes them available for viewing in RHQ. You now can monitor the JVM health of your ActiveMQ instance.

Coming up in Part2, how to actually monitor the specific ActiveMQ Beans


No comments:

Post a Comment