Search code examples
activemq-artemisjmx-exporter

Trying to implement monitoring for ActiveMQ Artemis


After updating the configuration I'm getting this error while running ActiveMQ Artemis

enter image description here

add the jmx in broker.xml:

    <?xml version='1.0'?>


      <configuration xmlns="urn:activemq"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:xi="http://www.w3.org/2001/XInclude"
               xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">

      <core xmlns="urn:activemq:core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="urn:activemq:core ">

       <name>localhost</name>
      
       <server>

        <jmx-management-enabled>true</jmx-management-enabled>

       </server>     

       <persistence-enabled>true</persistence-enabled>

       <max-redelivery-records>1</max-redelivery-records>
       <journal-type>NIO</journal-type>

artemis.profile:

      rem Java Opts
        IF "%JAVA_ARGS%"=="" (
          set JAVA_ARGS= -XX:AutoBoxCacheMax=20000 - 
          XX:+PrintClassHistogram -XX:+UseG1GC - 
          XX:+UseStringDeduplication -Xms512M -Xmx2G - 
         
        Djava.security.auth.login.config=%ARTEMIS_ETC_DIR%\login.config 

    -Dhawtio.disableProxy=true -Dhawtio.offline=true - 
   Dhawtio.realm=activemq -Dhawtio.role=amq -Dhawtio.rolePrincipalClasses=org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal -Dhawtio.http.strictTransportSecurity=max-age=31536000;includeSubDomains;preload -Djolokia.policyLocation=%ARTEMIS_INSTANCE_ETC_URI%\jolokia-access.xml -Dartemis.instance=%ARTEMIS_INSTANCE% -Dlog4j2.disableJmx=true
    )
    
    rem Add JMX Exporter Java Agent configuration
    set JAVA_ARGS=%JAVA_ARGS% -javaagent:C:\Users\tenal\Downloads\apache-artemis-2.31.2-bin\apache-artemis-2.31.2\lib\jmx_prometheus_javaagent-0.19.0.jar=9876:C:\Users\tenal\Downloads\apache-artemis-2.31.2-bin\apache-artemis-2.31.2\bin\master\etc\config.yaml

Solution

  • The configuration changes you've made are invalid. This is the problem:

    <server>
       <jmx-management-enabled>true</jmx-management-enabled>
    </server>
    

    You should use this instead:

    <jmx-management-enabled>true</jmx-management-enabled>
    

    That said, if you want to use Prometheus with ActiveMQ Artemis I strongly recommend use the metrics subsystem and configure the Prometheus Metrics Plugin. You may run into difficulties with the Prometheus JMX Exporter because ActiveMQ Artemis manages its own embedded MBean server in order to enforce role-based access control.