Configure the Java Options for Services Using JMX Agent in Ambari
You can update the Java options for the services through the Ambari UI.
Below are detailed, service-wise details for all services supported by the JMX agent.
Prerequistes
Ensure to update the ODP Services with JMX settings before proceeding. For details, see Configure ODP Cluster Services for Pulse.
Note
Before configuring the JMX Trans Agent for a service, verify that the required service-specific XML configuration file exists in ./opt/acceldata/jmx/config/enabled
For example, for Cruise Control, verify that exists in this directory. If the required XML file is missing, adding the JMX configuration and restarting the service may cause the service to fail to start.vm_cruise_control.xml
Configuration
Cruise Control
- In the Ambari UI, go to Kafka → Advanced → cruise-control-env template.
- Add the following line at the end of the template:
export KAFKA_OPTS="$KAFKA_OPTS -javaagent:/opt/acceldata/jmx/lib/jmxtrans-agent.jar=/opt/acceldata/jmx/config/enabled/vm_cruise_control.xml"

Cruise Control 3
- In the Ambari UI, go to Kafka3 → Advanced → cruise-control3-env template.
- Add the following line at the end of the template:
export KAFKA_OPTS="$KAFKA_OPTS -javaagent:/opt/acceldata/jmx/lib/jmxtrans-agent.jar=/opt/acceldata/jmx/config/enabled/vm_cruise_control3.xml

Hive Metastore
- In the Ambari UI, go to Hive → Advanced → hive-env template
- Add the following line inside the section: if [ "$SERVICE" = "metastore" ].
export HADOOP_OPTS="$HADOOP_OPTS -javaagent:/opt/acceldata/jmx/lib/jmxtrans-agent.jar=/opt/acceldata/jmx/config/enabled/vm_hive_metastore.xml"

Hive Server
- In the Ambari UI, go to Hive → Advanced → hive-env template.
- Add the following line inside the section: if [ "$SERVICE" = "hiveserver2" ].
export HADOOP_OPTS="$HADOOP_OPTS -javaagent:/opt/acceldata/jmx/lib/jmxtrans-agent.jar=/opt/acceldata/jmx/config/enabled/vm_hive_server.xml"

Kafka
If Kafka Connect is NOT enabled:
- Go to Kafka → Advanced → kafka-env template
- Add the following line at the end:
export KAFKA_OPTS="$KAFKA_OPTS -javaagent:/opt/acceldata/jmx/lib/jmxtrans-agent.jar=/opt/acceldata/jmx/config/enabled/vm_kafka.xml"
If Kafka Connect is enabled:
Add the following snippet at the end of the kafka-env template:
AGENT_PATH="/opt/acceldata/jmx/lib/jmxtrans-agent.jar"
if [[ "$KAFKA_OPTS" != *"$AGENT_PATH"* ]]; then
if [[ "$KAFKA_LOG4J_OPTS" == *"connect-log4j.properties"* ]]; then
export KAFKA_OPTS="$KAFKA_OPTS -javaagent:$AGENT_PATH=/opt/acceldata/jmx/config/enabled/vm_kafka_connect.xml"
else
export KAFKA_OPTS="$KAFKA_OPTS -javaagent:$AGENT_PATH=/opt/acceldata/jmx/config/enabled/vm_kafka.xml"
fi
fi
Kafka 3
If Kafka Connect is NOT enabled:
- Go to Kafka3 → Advanced → kafka-env template
- Add the following line at the end:
export KAFKA_OPTS="$KAFKA_OPTS -javaagent:/opt/acceldata/jmx/lib/jmxtrans-agent.jar=/opt/acceldata/jmx/config/enabled/vm_kafka3.xml"
If Kafka Connect is enabled:
Add the following snippet:
AGENT_PATH="/opt/acceldata/jmx/lib/jmxtrans-agent.jar"
if [[ "$KAFKA_OPTS" != *"$AGENT_PATH"* ]]; then
CURRENT_CMD_STRING=$(ps -p $$ -o args=)
if [[ "$CURRENT_CMD_STRING" == *"kafka-connect"* ]]; then
export KAFKA_OPTS="$KAFKA_OPTS -javaagent:$AGENT_PATH=/opt/acceldata/jmx/config/enabled/vm_kafka3_connect.xml"
elif [[ "$CURRENT_CMD_STRING" == *"kafka3 start"* ]] || [[ "$CURRENT_CMD_STRING" == *"kafka-server-start"* ]]; then
export KAFKA_OPTS="$KAFKA_OPTS -javaagent:$AGENT_PATH=/opt/acceldata/jmx/config/enabled/vm_kafka3.xml"
fi
fi

Kafka Connect
- Go to Kafka → Advanced → kafka-env template
- Add the following snippet at the end:
AGENT_PATH="/opt/acceldata/jmx/lib/jmxtrans-agent.jar"
if [[ "$KAFKA_OPTS" != *"$AGENT_PATH"* ]]; then
if [[ "$KAFKA_LOG4J_OPTS" == *"connect-log4j.properties"* ]]; then
export KAFKA_OPTS="$KAFKA_OPTS -javaagent:$AGENT_PATH=/opt/acceldata/jmx/config/enabled/vm_kafka_connect.xml"
else
export KAFKA_OPTS="$KAFKA_OPTS -javaagent:$AGENT_PATH=/opt/acceldata/jmx/config/enabled/vm_kafka.xml"
fi
fi
Kafka3 Connect
- Go to Kafka3 → Advanced → kafka3-env template.
- Add the following snippet at the end:
AGENT_PATH="/opt/acceldata/jmx/lib/jmxtrans-agent.jar"
if [[ "$KAFKA_OPTS" != *"$AGENT_PATH"* ]]; then
CURRENT_CMD_STRING=$(ps -p $$ -o args=)
if [[ "$CURRENT_CMD_STRING" == *"kafka-connect"* ]]; then
export KAFKA_OPTS="$KAFKA_OPTS -javaagent:$AGENT_PATH=/opt/acceldata/jmx/config/enabled/vm_kafka3_connect.xml"
elif [[ "$CURRENT_CMD_STRING" == *"kafka3 start"* ]] || [[ "$CURRENT_CMD_STRING" == *"kafka-server-start"* ]]; then
export KAFKA_OPTS="$KAFKA_OPTS -javaagent:$AGENT_PATH=/opt/acceldata/jmx/config/enabled/vm_kafka3.xml"
fi
fi
Kafka MirrorMaker2
- Go to Kafka → Advanced → kafka-mirrormaker2-env
- Add the following line at the end:
export KAFKA_OPTS="$KAFKA_OPTS -javaagent:/opt/acceldata/jmx/lib/jmxtrans-agent.jar=/opt/acceldata/jmx/config/enabled/vm_mm2.xml"

Kafka3 MirrorMaker2
- Go to Kafka3 → Advanced → kafka-mirrormaker2-env
- Add the following line at the end:
export KAFKA_OPTS="$KAFKA_OPTS -javaagent:/opt/acceldata/jmx/lib/jmxtrans-agent.jar=/opt/acceldata/jmx/config/enabled/vm_kafka3mm2.xml"

Pinot Broker
- Go to Pinot Broker → Java Virtual Machine (JVM) Options
- Add the below line to existing java opts.
-javaagent:/opt/acceldata/jmx/lib/jmxtrans-agent.jar=/opt/acceldata/jmx/config/enabled/vm_pinot_broker.xml

Pinot Controller
- Go to Pinot Controller → Java Virtual Machine (JVM) Options
- Add the below line to existing java opts.
-javaagent:/opt/acceldata/jmx/lib/jmxtrans-agent.jar=/opt/acceldata/jmx/config/enabled/vm_pinot_controller.xml

Pinot Server
- Go to Pinot Server → Java Virtual Machine (JVM) Options
- Add the below line to existing java opts.
-javaagent:/opt/acceldata/jmx/lib/jmxtrans-agent.jar=/opt/acceldata/jmx/config/enabled/vm_pinot_server.xml

Ranger (Admin, Tagsync, Usersync)
- Go to Ranger → Advanced → ranger-env template
Ranger Admin
Add the line below in the section:{% if is_ranger_admin_host %}
export JAVA_OPTS="${JAVA_OPTS} -javaagent:/opt/acceldata/jmx/lib/jmxtrans-agent.jar=/opt/acceldata/jmx/config/enabled/vm_ranger_admin.xml"
Ranger Tagsync
For Tagsync, add the below line in the section:{% if is_ranger_tagsync_host %}
export JAVA_OPTS="${JAVA_OPTS} -javaagent:/opt/acceldata/jmx/lib/jmxtrans-agent.jar=/opt/acceldata/jmx/config/enabled/vm_ranger_tagsync.xml"
Ranger Usersync
For Usersync, add the line below in the section:{% if is_ranger_usersync_host %}
export JAVA_OPTS=" ${JAVA_OPTS} -javaagent:/opt/acceldata/jmx/lib/jmxtrans-agent.jar=/opt/acceldata/jmx/config/enabled/vm_ranger_usersync.xml"

RangerKMS
- In the Ambari UI, go to Ranger KMS → Advanced kms-env-> kms-env template
- Update the kms-env template with the following values.
export JAVA_OPTS=" ${JAVA_OPTS} -javaagent:/opt/acceldata/jmx/lib/jmxtrans-agent.jar=/opt/acceldata/jmx/config/enabled/vm_ranger_kms_server.xml"

Schema Registry
- Go to Schema Registry → registry-env template
- Add the following line at the end:
export REGISTRY_OPTS="$REGISTRY_OPTS -javaagent:/opt/acceldata/jmx/lib/jmxtrans-agent.jar=/opt/acceldata/jmx/config/enabled/vm_schema_registry.xml"

Trino (Coordinator and Worker)
- Go to Trino → JVM Config file
- Add the following snippet at the end:
{% if hostname == coordinator_host %}
-javaagent:/opt/acceldata/jmx/lib/jmxtrans-agent.jar=/opt/acceldata/jmx/config/enabled/vm_trino_coordinator.xml
{% else %}
-javaagent:/opt/acceldata/jmx/lib/jmxtrans-agent.jar=/opt/acceldata/jmx/config/enabled/vm_trino_worker.xml
{% endif %}

Zookeeper
- Go to Zookeeper → Advanced → zookeeper-env template
- Add the following line at the end:
export SERVER_JVMFLAGS="$SERVER_JVMFLAGS -javaagent:/opt/acceldata/jmx/lib/jmxtrans-agent.jar=/opt/acceldata/jmx/config/enabled/vm_zookeeper_server.xml"

Zeppelin Master
- Go to Zeppelin → zeppelin_env_content
- Add the following line at the end:
export ZEPPELIN_JAVA_OPTS="$ZEPPELIN_JAVA_OPTS -javaagent:/opt/acceldata/jmx/lib/jmxtrans-agent.jar=/opt/acceldata/jmx/config/enabled/vm_zeppelin_master.xml"


Have a suggestion?