Skip to main content
AI
  • Get started with AI

    • Red Hat AI

      Accelerate the development and deployment of enterprise AI solutions.

    • AI learning hub

      Explore learning materials and tools, organized by task.

    • AI interactive demos

      Click through scenarios with Red Hat AI, including training LLMs and more.

    • AI/ML learning paths

      Expand your Red Hat OpenShift AI knowledge using these learning resources.

    • AI quickstarts

      Focused AI use cases designed for fast deployment on Red Hat AI platforms.

    • No-cost AI training

      Foundational Red Hat AI training.

  • Featured resources

    • Red Hat OpenShift AI
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

Red Hat AI Factory with NVIDIA

Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.

Learn
  • Self-guided

    • Documentation

      Find answers, get step-by-step guidance, and learn how to use Red Hat products.

    • Learning paths

      Explore curated walkthroughs for common development tasks.

    • Guided learning

      Receive custom learning paths powered by our AI assistant.

    • See all learning
  • Hands-on

    • Developer Sandbox

      Spin up Red Hat's products and technologies without setup or configuration.

    • Interactive labs

      Learn by doing in these hands-on, browser-based experiences.

    • Interactive demos

      Click through product features in these guided tours.

  • Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics
  • Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
Build
  • Get started

    • Red Hat build of Podman Desktop

      A downloadable, local development hub to experiment with our products and builds.

    • Developer Sandbox

      Spin up Red Hat's products and technologies without setup or configuration.

  • Download products

    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products
  • Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset
  • References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
Community
  • Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions
  • Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github
  • Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

Join the Red Hat Developer program

Download Red Hat products and project builds, access support documentation, learning content, and more.

ConsoleDocsSupport Search
New For you

Recommended

We'll recommend resources you may like as you browse. Try these suggestions for now.

  • Product downloads
  • Cheat sheets
  • Red Hat Developer learning portal
  • Developer blog
  • E-books
  • Developer Sandbox
Log in

Get more with a Red Hat Developer account

  • Product downloads
  • Console access
  • Event registration
  • Training & trials
Explore more account benefitsLog in or register

A subscription may be required for some services.

Contact us

Monitoring Red Hat AMQ 7 with the jmxtrans Agent

June 6, 2018
Roman Martin Gil
Related topics:
Containers
Related products:
AMQ BrokerStreams for Apache Kafka

    Monitoring Red Hat AMQ 7

    Red Hat AMQ 7 includes some tools for monitoring the Red Hat AMQ broker. These tools allow you to get metrics about the performance and behavior of the broker and its resources. Metrics are very important for measuring performance and for identifying issues that are causing poor performance.

    The following components are included for monitoring the Red Hat AMQ 7 broker:

    • Management web console that is based on Hawtio: This console includes some perspectives and dashboards for monitoring the most important components of the broker.
    • A Jolokia REST-like API: This provides full access to JMX beans through HTTP requests.
    • Red Hat JBoss Operation Network: This is an enterprise, Java-based administration and management platform for developing, testing, deploying, and monitoring Red Hat JBoss Middleware applications.

    These tools are incredible and fully integrated with the original product. However, there are cases where Red Hat AMQ 7 is deployed in environments where other tools are used to monitor the broker, for example, jmxtrans.

    jmxtrans is a popular monitoring tool for Java-based applications. It connects to a JVM via JMX, collects metrics, and sends the data to the back end of your choice. Included in jmxtrans is an agent to be deployed inside the application that is to be monitored. This blog shows how to integrate the jmxtrans agent with Red Hat AMQ 7.

    Set Up Red Hat AMQ 7

    First, you need to get the latest stable version of the jmxtrans agent. It is possible to get it from the following places:

    • Releases from GitHub repository
    • Maven Central Repository

    Copy the jmxtrans-agent JAR file into the $ARTEMIS_INSTANCE/lib folder.

    To load the agent at bootstrap time, you need to modify the artemis file in the $ARTEMIS_INSTANCE/bin folder. It defines an environment variable (AMQ_JMSTRANS_AGENT) to update the startup command line of the broker. This environment variable allows you to configure when to use the jmxtrans agent:

    # Add jmxtrans agent
    if [ "$AMQ_JMXTRANX_AGENT" = "true" ]; then
      echo "Using jmxtrans agent to collect metrics. Configuration loaded from $ARTEMIS_INSTANCE/etc/jmxtrans-agent.xml"
      JMXTRANX_OPTS="-Xbootclasspath/p:$ARTEMIS_INSTANCE/etc -javaagent:$ARTEMIS_INSTANCE/lib/jmxtrans-agent.jar=$ARTEMIS_INSTANCE/etc/jmxtrans-agent.xml"
    fi

    Next, you should load this configuration with the startup command line defined in the artemis file, as follows:

    exec "$JAVACMD" \
     $JAVA_ARGS \
     $JMXTRANX_OPTS -Xbootclasspath/a:"$LOG_MANAGER" \
     -Djava.security.auth.login.config="$ARTEMIS_INSTANCE/etc/login.config" \
     $ARTEMIS_CLUSTER_PROPS \
     -classpath "$CLASSPATH" \
     -Dartemis.home="$ARTEMIS_HOME" \
     -Dartemis.instance="$ARTEMIS_INSTANCE" \
     -Djava.library.path="$ARTEMIS_HOME/bin/lib/linux-$(uname -m)" \
     -Djava.io.tmpdir="$ARTEMIS_INSTANCE/tmp" \
     -Ddata.dir="$ARTEMIS_DATA_DIR" \
     -Djava.util.logging.manager="$ARTEMIS_LOG_MANAGER" \
     -Dlogging.configuration="$ARTEMIS_LOGGING_CONF" \
     $DEBUG_ARGS \
     org.apache.activemq.artemis.boot.Artemis "$@"

    Defining Queries and Metrics

    The jmstrans agent allows you to define different queries to collect metrics from JMX beans. These queries are defined in the jmxtrans-agent.xml file, which is located in the $ARTEMIS_INSTANCE/etc folder. The queries will define the JMX beans and the attributes to be collected. The following shows a sample to get metrics from addresses and queues.

    <queries>
      <!-- Addresses -->
      <query objectName="org.apache.activemq.artemis:broker=*,component=addresses,address=*"
             attributes="MessageCount,NumberOfMessages,NumberOfPages,QueueNames"
             resultAlias="service=amq7,host=#hostname#,broker=%broker%,address=%address%,attribute.#attribute#"/>
     
      <!-- Queues -->
      <query objectName="org.apache.activemq.artemis:broker=*,component=addresses,address=*,subcomponent=queues,routing-type=*,queue=*"
             attributes="ConsumerCount,MaxConsumers,DeliveringCount,MessageCount,MessagesAcknowledged,MessagesAdded,MessagesExpired,MessagesKilled"
             resultAlias="service=amq7,host=#hostname#,broker=%broker%,address=%address%,queue=%queue%,artemis.addresses.#attribute#"/>
    </queries>

    Other queries to get other metrics in the JMX tree are also valid.

    Getting Metrics from the Console

    jmxtrans includes several output writers to send the collected metrics to external services, for example, as Graphite, CSV files, and InfluxDB. The output writers are defined in the jmxtrans-agent.xml file as follows:

     <!-- Output Writers -->
     <outputWriter class="org.jmxtrans.agent.ConsoleOutputWriter" />

    This block defines the console output writer, so the metrics will be shown as messages in the server console log.

    If you now start Red Hat AMQ 7, the output will be similar to this:

    $ export AMQ_JMXTRANX_AGENT=true
    $ ./bin/artemis run
    Using jmxtrans agent to collect metrics. Configuration loaded from /opt/amq/brokers/broker01-master/etc/jmxtrans-agent.xml
    2018-06-04 17:14:39.103 INFO [main] org.jmxtrans.agent.JmxTransAgent - Starting 'JMX metrics exporter agent: 1.2.8' with configuration '/opt/amq/brokers/broker01-master/etc/jmxtrans-agent.xml'...
    2018-06-04 17:14:39.113 INFO [main] org.jmxtrans.agent.JmxTransAgent - PropertiesLoader: Empty Properties Loader
    2018-06-04 17:14:39.445 INFO [main] org.jmxtrans.agent.JmxTransExporter - Configuration reload interval: 10secs
    2018-06-04 17:14:39.445 INFO [main] org.jmxtrans.agent.JmxTransAgent - JmxTransAgent started with configuration '/opt/amq/brokers/broker01-master/etc/jmxtrans-agent.xml'
     __ __ ____ ____ _
     /\ | \/ |/ __ \ | _ \ | |
     / \ | \ / | | | | | |_) |_ __ ___ | | _____ _ __
     / /\ \ | |\/| | | | | | _ <| '__/ _ \| |/ / _ \ '__|
     / ____ \| | | | |__| | | |_) | | | (_) | < __/ |
     /_/ \_\_| |_|\___\_\ |____/|_| \___/|_|\_\___|_|
    
    Red Hat JBoss AMQ 7.1.0.GA
    2018-06-04 17:14:40,370 INFO [org.apache.activemq.artemis.integration.bootstrap] AMQ101000: Starting ActiveMQ Artemis Server
    ...

    After some seconds, you can see that the jmxtrans agent is collecting metrics and exporting them to the console (using the ConsoleOutputWriter):

    2018-06-04 17:14:43,740 INFO [org.apache.activemq.artemis] AMQ241001: HTTP Server started at http://localhost:8161
    2018-06-04 17:14:43,740 INFO [org.apache.activemq.artemis] AMQ241002: Artemis Jolokia REST API available at http://localhost:8161/console/jolokia
    2018-06-04 17:14:43,741 INFO [org.apache.activemq.artemis] AMQ241004: Artemis Console available at http://localhost:8161/console
    service=amq7,host=localhost,broker=0_0_0_0,address=DLQ,attribute.MessageCount 0 1528125286
    service=amq7,host=localhost,broker=0_0_0_0,address=DLQ,attribute.NumberOfMessages 0 1528125286
    service=amq7,host=localhost,broker=0_0_0_0,address=DLQ,attribute.NumberOfPages 0 1528125286
    service=amq7,host=localhost,broker=0_0_0_0,address=DLQ,attribute.QueueNames DLQ 1528125286
    service=amq7,host=localhost,broker=0_0_0_0,address=ExpiryQueue,queue=ExpiryQueue,artemis.addresses.ConsumerCount 0 1528125286
    service=amq7,host=localhost,broker=0_0_0_0,address=ExpiryQueue,queue=ExpiryQueue,artemis.addresses.MaxConsumers -1 1528125286
    service=amq7,host=localhost,broker=0_0_0_0,address=ExpiryQueue,queue=ExpiryQueue,artemis.addresses.DeliveringCount 0 1528125286
    service=amq7,host=localhost,broker=0_0_0_0,address=ExpiryQueue,queue=ExpiryQueue,artemis.addresses.MessageCount 0 1528125286
    service=amq7,host=localhost,broker=0_0_0_0,address=ExpiryQueue,queue=ExpiryQueue,artemis.addresses.MessagesAcknowledged 0 1528125286
    service=amq7,host=localhost,broker=0_0_0_0,address=ExpiryQueue,queue=ExpiryQueue,artemis.addresses.MessagesAdded 0 1528125286
    service=amq7,host=localhost,broker=0_0_0_0,address=ExpiryQueue,queue=ExpiryQueue,artemis.addresses.MessagesExpired 0 1528125286
    service=amq7,host=localhost,broker=0_0_0_0,address=ExpiryQueue,queue=ExpiryQueue,artemis.addresses.MessagesKilled 0 1528125286
    service=amq7,host=localhost,broker=0_0_0_0,address=DLQ,queue=DLQ,artemis.addresses.ConsumerCount 0 1528125286
    service=amq7,host=localhost,broker=0_0_0_0,address=DLQ,queue=DLQ,artemis.addresses.MaxConsumers -1 1528125286
    service=amq7,host=localhost,broker=0_0_0_0,address=DLQ,queue=DLQ,artemis.addresses.DeliveringCount 0 1528125286
    service=amq7,host=localhost,broker=0_0_0_0,address=DLQ,queue=DLQ,artemis.addresses.MessageCount 0 1528125286
    service=amq7,host=localhost,broker=0_0_0_0,address=DLQ,queue=DLQ,artemis.addresses.MessagesAcknowledged 0 1528125286
    service=amq7,host=localhost,broker=0_0_0_0,address=DLQ,queue=DLQ,artemis.addresses.MessagesAdded 0 1528125286
    service=amq7,host=localhost,broker=0_0_0_0,address=DLQ,queue=DLQ,artemis.addresses.MessagesExpired 0 1528125286
    service=amq7,host=localhost,broker=0_0_0_0,address=DLQ,queue=DLQ,artemis.addresses.MessagesKilled 0 1528125286

    Sample jmxtrans-agent.xml File

    The following shows a full sample file for the jmxtrans agent to be used with Red Hat AMQ 7:

    <jmxtrans-agent>
      <queries>
        <!-- ActiveMQ Artemis -->
        <!-- Addresses -->
        <query objectName="org.apache.activemq.artemis:broker=*,component=addresses,address=*"
               attributes="MessageCount,NumberOfMessages,NumberOfPages,QueueNames"
               resultAlias="service=amq7,host=#hostname#,broker=%broker%,address=%address%,attribute.#attribute#"/>
     
        <!-- Queues -->
        <query objectName="org.apache.activemq.artemis:broker=*,component=addresses,address=*,subcomponent=queues,routing-type=*,queue=*"
               attributes="ConsumerCount,MaxConsumers,DeliveringCount,MessageCount,MessagesAcknowledged,MessagesAdded,MessagesExpired,MessagesKilled"
               resultAlias="service=amq7,host=#hostname#,broker=%broker%,address=%address%,queue=%queue%,artemis.addresses.#attribute#"/>
     
      </queries>
    
      <!-- Output Writers -->
      <outputWriter class="org.jmxtrans.agent.ConsoleOutputWriter" />
     
      <!-- Other Properties -->
      <collectIntervalInSeconds>5</collectIntervalInSeconds>
      <reloadConfigurationCheckIntervalInSeconds>60</reloadConfigurationCheckIntervalInSeconds>
    </jmxtrans-agent>

    References

    More details about how to monitor Red Hat AMQ 7 using jmxtrans are available here:

    • Monitoring Your AMQ Deployment
    • Managing the Broker Using JMX
    • Using JON with AMQ Broker
    • jmxtrans Wiki
    • jmxtrans agent Wiki
    Last updated: November 16, 2023

    Recent Posts

    • A day in the life of an NVIDIA H100 on Red Hat OpenShift 5

    • Migrate BuildConfigs to builds for Red Hat OpenShift with one plug-in install

    • Run Red Hat Enterprise Linux CoreOS on NVIDIA BlueField DPUs

    • Agent harness engineering: Separating model capabilities from enforcement

    • What's new for developers in Red Hat Enterprise Linux 10.3 and 9.9

    Red Hat Developers logo

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    Red Hat Developer

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility
    Ask AI