You must enable monitoring explicitly on each ksqlDB server. To enable
it in a Docker-based deployment, export an environment variable named
KSQL_JMX_OPTS with your JMX configuration and expose the port that
JMX will communicate over.
The following Docker Compose example shows how you can configure monitoring for ksqlDB server. The surrounding components, like the broker and CLI, are omitted for brevity. You can see an example of a complete setup in the quickstart.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
With respect to monitoring, here it what this does:
- The environment variable
KSQL_JMX_OPTSis supplied to the server with various arguments. The
>character lets you write a multi-line string in Yaml, which makes this long argument easier to read. The advertised hostname, port, and security settings are configured. JMX has a wide range of configuration options, and you can set these however you like.
1099is exposed, which corresponds to the JMX port set in the
KSQL_JMX_OPTSconfiguration. This enables remote monitoring tools to communicate into ksqlDB's process.
Verifying your monitoring setup¶
An easy way to check that ksqlDB is properly emitting metrics is by
jconsole. JConsole is a graphical monitoring tool to monitor
the JVM, and it ships with by default with Oracle JDK installations.
On your host machine, run the command:
You will be prompted for a host and port. If you used the example
localhost:1099 establishes the connection. You
should see a series of graphs showing resource utilization. If you
don't, make sure the networking between your machine and the Docker
container is configured correctly.