Knowledge Base

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I use jConsole to test and troubleshoot connectivity issues?

jConsole is a utility that comes with the Java Development Kit (JDK). It helps to test the connection between the extension and the JMX artifact being monitored. You can use jConsole to troubleshoot connection issues in the extension. You can also use it to configure the MBeans the extension collects.

 

This article walks you through using jConsole with the artifact that you want to monitor.

 

Prerequisite

The JDK needs to be installed on the machine where the extension is installed.

 

Table of Contents

How do I get started with jConsole?
How do I troubleshoot JMX connection fails?
How do I view and configure the JMX MBeans?

 

How do I get started with jConsole?

To start using jConsole with a JMX artifact, you'll need to Launch jConsole, and then connect the artifact to it.

Step 1: Launch jConsole

  1. Open a terminal from the machine where the extension is installed.
  2.  If JMX monitoring over SSL is not enabled, then type jconsole in the terminal.1_Launch_Terminal.png

     

  1. If you have enabled JMX monitoring via SSL on the artifact, you need to run jconsole as follows.

jconsole -J-Djavax.net.ssl.trustStore=/path/to/truststore \

-J-Djavax.net.ssl.trustStorePassword=trustword2_run jConsole.png

 

  1. This will open a  jConsole window.3_Open jConsole window.png

     

 

Step 2: Connect to the artifact.

  1. On the jConsole window, select “Remote Process”.

  2. You can enter the JMX service URL from either the config.yml OR a host JMX-port pair to connect to the artifact.

    If you are using the JMX service URL, the format is:
    service:jmx:rmi:///jndi/rmi://host:JMXport/jmxrmi

4_Connect artifact.pngjConsole Window, Remote Process, JMX service URL format

If you're choosing the host and JMX port to connect, the format of the Host JMX-port pair is
<IP address of the machine on which the artifact is running>:<JMX-port>5_Connect artifact JMX port pair.pngjConsole window, Remote Process, host and JMX-port pair formatFor example: 

34.222.32.114:9999
localhost:9999

 

  1. Only provide a Username and Password if authentication is enabled on the artifact you’re installing. 

    The JMX username and JMX password are not the same as the credentials used to connect to the artifact via REST API, terminal. If you don’t have password authentication enabled on the artifact that you’re trying to monitor, please leave the fields blank.

  2. Click the “Connect” button.

If monitoring via SSL is not enabled, you will see a “Secure connection failed” pop-up window. Click the "Insecure Connection" button.6_Secure connection failed.pngIf SSL monitoring is not enabled, a "Secure connection failed" pop-up window will appear. Click the "Insecure Connection" button.

 

If the configuration is correct, the connection between the extension and the artifact will be successful, and metrics will be reported. 

 

How do I troubleshoot JMX connection fails?3_Open jConsole window.png

 

If you see a jConsole connection failing, as shown above with the “Connection refused” message, it might be because of one or more of the following reasons: 

  • JMX monitoring is not enabled. See the extension documentation for the steps to enable JMX monitoring.
  • The serviceUrl maybe incorrect.
  • The hostname/port pair maybe incorrect.
  • SSL may be required, and the jConsole was launched in non-SSL mode.
  • JMX port might not be configured on the artifact.
  • The username or password may be incorrect.
  • A proxy or firewall between the machine on which jConsole was launched and the artifact may be blocking incoming JMX connections.

 

How do I view and configure the JMX MBeans?

Once the connection is successful, from the Java Monitoring and Management Console, navigate to the MBeans tab.

8_Navigate to MBeans tab.pngMBeans tab in the Java monitoring and management console

 

The extension is configured to fetch some metrics by default. But if you find that the metrics that you want aren’t listed in config.yml by default, you can configure config.yml to add them. 

 

Once you have followed How do I get started with jConsole steps 1 and 2, the jConsole should be up, with the MBean Explorer visible on the left pane of the jConsole window. Each MBean has a few metrics listed underneath it. Navigate through the MBeans down to the metric(s) you are interested in.9_MBeans Explorer.png

 

 

Examples of metrics you can track 

Using Kafka to see the number of under-replicated partitions

Let’s consider using the Kafka monitoring extension if you’d like to see the number of UnderReplicatedPartitions in your partition.10_Kafka under-replicated partitions.png

 

 

Add the MBean in your config.yml MBeans:

<<Other MBeans>>
<<add your MBean here>>
<<Example of adding UnderReplicatedPartitions.Value here>>
 - objectName: 'kafka.server:type=ReplicaManager,name=UnderReplicatedPartitions'
   metrics:
     - Value:
         alias: 'Value'
         multiplier: ''
         delta: false
         aggregationType: 'OBSERVATION'
         timeRollUpType: 'CURRENT'
clusterRollUpType: 'INDIVIDUAL'

 

Using Kafka with multiple metrics under a single object

Let’s also consider another case where there are multiple metrics under one object:FailedIsrUpdatesPerSec. Those metrics are listed under kafka.server -> Replica Manager ->object:FailedIsrUpdatesPerSec -> Attributes.11_Kafka multiple metrics single object.png

 

For example, to fetch all metrics(stats) about FailedIsrUpdatesPerSec (Count, MeanRate, OneMinuteRate, etc.), list each of them in the metrics section of the FailedIsrUpdatesPerSec. The Value metric is listed as an example.

 

Using wildcards with Kafka

If you want to add all the MBeans under ReplicaManager, you can add a wildcard (a *) in your config.yml MBeans:

<<Other MBeans>>
<<add your MBean here>>
<<Example of adding UnderReplicatedPartitions.Value here>>
 - objectName: 'kafka.server:type=ReplicaManager,name=*'
   metrics:
     - Value:
         alias: 'Value'
         multiplier: ''
         delta: false
         aggregationType: 'OBSERVATION'
         timeRollUpType: 'CURRENT'
         clusterRollUpType: 'INDIVIDUAL'

 

Please note that the extension can collect metrics only if the JMX connection is successful.

Version history
Revision #:
12 of 12
Last update:
Friday
Updated by:
 
Labels (1)


Found this article helpful? Click the Thumbs Up button.
Have an additional comment? Post it below.