Java application environments usually support JMX (Java Management Extensions) or IBM Performance Monitoring Infrastructure (PMI). AppDynamics automatically discovers JMX and PMI attributes.
About JMX Monitoring Support
JMX uses objects called MBeans (Managed Beans) to expose data and resources from your application. In a typical application environment, there are three main layers that use JMX:
- JVMs provide built-in JMX instrumentation or platform-level MBeans that supply important metrics about the JVM.
- Application servers provide server or container-level MBeans that reveal metrics about the server.
- Applications often define custom MBeans that monitor application-level activity.
MBeans are typically grouped into domains to indicate where resources belong. Usually, in a JVM there are multiple domains. For example, for an application running on Apache Tomcat, there are Catalina and Java.lang domains. Catalina represents resources and MBeans relating to the Tomcat container, and Java.lang represents the same for the JVM Hotspot runtime. The application may have its own custom domains.
You can use MBean attributes to create persistent JMX metrics in AppDynamics as described here. In addition, you can import and export JMX metric configurations from one version or instance of AppDynamics to another.
To learn about PMI see Writing PMI Applications Using the JMX Interface.
Requirements for JMX Monitoring
AppDynamics can capture MBean data if:
- The monitored system runs on Java 1.5 or later.
- Each monitored Java process has JMX enabled. See JMX documentation.
AppDynamics creates long-term metrics of the key MBean attributes that represent the health of the Java container. Depending on your application configuration, metrics may include:
- Session information such as the number of active and expired sessions, maximum active sessions, processing time, average and maximum alive times, and a session counter.
- Web container runtime metrics that represent the thread pool that services user requests. The metrics include pending requests and the number of current threads servicing requests. These metrics are related to Business Transaction metrics such as response time.
- Messaging metrics related to JMS destinations, including the number of current consumers and the number of current messages.
- JDBC connection pool metrics including current pool size and maximum pool size.
To view the JMX metrics discovered in a node, see the JMX tab on the Node Dashboard. For additional metrics not discovered automatically, you canyourself.
You can mask sensitive JMX and MBean data by setting the sensitive-data-filters property in the app-agent-config.xml. For more information, see Filter Sensitive Data.
View JMX Metric Data
You can view MBean-based metrics using the Node Dashboard and the Metric Browser. In addition, the MBean Browser enables you to view all the MBeans defined in the system.
To view JMX metrics in the Metrics Browser, click the JMX tab in the Node Dashboard. The JMX Metrics browser opens and displays the MBeans in a Metric Tree.
You can perform all the operations that are provided by the Metric Browser. For information on using the Metric Browser, see Metric Browser.
View Trending MBeans with Live Graphs
You can monitor the trend of a particular MBean attribute over time using the Live Graph.
To view live graphs:
In the Node Dashboard, click the JMX tab and then the MBean Browser sub-tab.
- Select the domain for which you want to monitor MBeans.
- In the domain tree, expand the domains to find and then select the MBean that is of interest to you.
- Expand the Attributes section and then choose an attribute of the MBean.
- Click Start Live Graph for Attribute and then click Start Live Graph. The runtime values appear.
- Select an attribute and click Live Graph for Attribute to see a larger view of a particular graph.
Working with MBean Values
When troubleshooting or monitoring a Java-based system, you may want to change the values of composite MBeans and execute MBean methods.
To view and edit MBean attribute values:
- From the JMX window, select MBean Browser.
- In the Domain tree, search and find the MBean that interests you.
- Select an editable attribute, one that has Yes in the Editable column, and then click View/Edit Attribute.
- In the MBean Attribute window that displays, you see the current value of the MBean Attribute.
- You can change the value of an editable MBean Attribute by entering a new value in the Value field.
Invoke MBean Operations
Using the JMX viewer, you can invoke an MBean operation with standard Java language strings for parameters, and view return values.
To invoke MBean operations:
- Open the MBean Browser.
- In the Domain tree, search and find the MBean that interests you.
- Open the Operations pane, scroll to find the operation that interests you, and double-click the Invoke Action activator.
- Enter the parameter values for the operation and then click Invoke. Scalar values for constructors of complex types, such as getMBeanInfo(java.util.Locale) allow you to enter "en-us".
A message appears indicating that the operation is in progress and the number of seconds elapsed. When the operation completes, the results display. The method return result from an invocation can also be a complex attribute. In this case, the name, description, type, and editable attributes of the method are also displayed in the MBean Operation Result area.
Available JMX Metrics
Java Management Extensions (JMX) is a public specification for monitoring and managing Java applications. Through JMX, AppDynamics can access Java class properties that collect management data, such as the resources your application is consuming.
For information on the specific metrics available for your environment, see the documentation provided by your vendor:
- Apache ActiveMQ, see ActiveMQ MBeans Reference, in the ActiveMQ Features documentation
- Apache Kafka, see Default JMX Metrics for Apache Kafka Backends
- Apache Solr, see Quick Demo in the Solr JMX documentation
- Apache Tomcat, see the descriptions of JMX MBeans for Catalina in the
mbeans-descriptor.xmlfile for each package
- Cassandra, see Cassandra Metrics
- Coherence, see the Coherence MBeans Reference in Appendix A of the Coherence Management Guide
- GlassFish, see the Oracle Sun Glassfish Administration Guide where you can find a Metrics Information Reference
- HornetQ, see Using Management Via JMX
- JBoss, see An Introduction to JMX
- Kafka Broker, see Monitoring Kafka
- Oracle WebLogic Server, see Understanding JMX
- WebSphere PMI, see PMI data organization in the IBM Websphere Application documentation
Adding JMX Metrics
In addition to the preconfigured metrics, you can define a new persistent metric using a JMX Metric Rule that maps a set of attributes from one or more MBeans. For more information, see Configure JMX Metrics from MBeans.
Extending Monitoring with the Agent API
The Application Server Agent API lets you access metrics that are not supported by default or by MBeans. You can use the API to:
- Inject custom events and report on them
- Create and report on new metrics
- Correlate distributed transactions when using protocols that AppDynamics does not support
To learn more about the Application Server Agent API, see the Javadoc included with the Java Agent software at the following location: