Skip to content

Monitoring

MicWalter edited this page Sep 17, 2021 · 2 revisions

Monitoring

The ability to monitor server applications is very important for operating these applications. HiveMQ is no exception, in fact HiveMQ was designed to enable different kinds of monitoring easily. When using HiveMQ in critical infrastructure, it is strongly recommended to enable monitoring and use a decent application for displaying the relevant information you need for your operations.

Gathering metrics is enabled by default. The HiveMQ metrics subsystem is designed to be very performant and no performance penalties are expected for monitoring relevant metrics, even in low-latency and high-throughput environments.

JMX

HiveMQ has extensive support for Java Management Extensions (JMX) to monitor internals of HiveMQ and the JVM. JMX is a proven industry standard for Java Monitoring and many external tools support JMX natively or via extensions.

Configuration

If your HiveMQ runs behind some kind of NAT you have to set some additional options:

JAVA_OPTS="$JAVA_OPTS -Djava.rmi.server.hostname=<PUBLIC_IP>"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.rmi.port=9010"

This allows you to connect via JConsole using PUBLIC_IP:9010.

MBeans

When JMX is activated, the following MBeans can be used for monitoring:

MBean Name Description

metrics

The HiveMQ metrics and statistics. A list of all available metrics is available here.

java.nio

Statistics and metrics about used native memory.

java.lang

All information about the Java Virtual Machine can be monitored here.

Available Metrics

Metric Types

There are five different types of Metrics available. The following table shows all available metric types:

Table 1. Metric Types
Metric Type Description

Gauge

A gauge returns a simple value at the point of time the metric was requested.

Counter

A counter is a simple incrementing and decrementing number.

Histogram

A histogram measures the distribution of values in a stream of data. They allow to measure min, mean, max, standard deviation of values and quantiles.

Meter

A meter measures the rate at which a set of events occur. Meters measure mean, 1-, 5-, and 15-minute moving averages of events.

Timer

A timer is basically a histogram of the duration of a type of event and a meter of the rate of its occurrence. It captures rate and duration information.

The following table lists metrics that are available for monitoring HiveMQ CE:

Table 2. Available standard metric details
Metric Type Description

com.hivemq.messages.dropped.count

Counter

Counts every dropped message.

com.hivemq.messages.incoming.connect.count

Counter

Counts every incoming MQTT CONNECT message

com.hivemq.messages.incoming.publish.count

Counter

Counts every incoming MQTT PUBLISH message

com.hivemq.messages.incoming.total.count

Counter

Counts every incoming MQTT message

com.hivemq.messages.outgoing.publish.count

Counter

Counts every outgoing MQTT PUBLISH message

com.hivemq.messages.outgoing.total.count

Counter

Counts every outgoing MQTT message

com.hivemq.messages.retained.current

Gauge

The current amount of retained messages

com.hivemq.mqtt.connections.not-writable.current

Counter

Counts the number of MQTT client channels which are currently not writable

com.hivemq.networking.bytes.read.total

Gauge

The total amount of read bytes

com.hivemq.networking.bytes.write.total

Gauge

Total amount of written bytes

com.hivemq.networking.connections.current

Gauge

The current total number of active MQTT connections

com.hivemq.networking.connections-closed.total.count

Counter

Counts all clients which disconnected from HiveMQ (= graceful + ungraceful)

com.hivemq.sessions.overall.current

Gauge

Measures the current count of stored sessions. These sessions include all sessions, including online and offline clients

com.hivemq.subscriptions.overall.current

Counter

Measures the current count of subscriptions on the broker

com.hivemq.persistence.client-sessions.in-memory.total-size

Gauge

Measures the approximate memory usage of the client session persistence if the memory persistence is used

com.hivemq.persistence.client-session.subscriptions.in-memory.total-size

Gauge

Measures measures the approximate memory usage of the subscription persistence if the memory persistence is used.

com.hivemq.persistence.retained-messages.in-memory.total-size

Gauge

Measures measures the approximate memory usage of the retained message persistence if the memory persistence is used

com.hivemq.persistence.payload.in-memory.total-size

Gauge

Measures the approximate memory usage of the payload persistence if the memory persistence is used

com.hivemq.persistence.queued-messages.in-memory.total-size

Gauge

Measures the approximate memory usage of the queued message persistence if the memory persistence is used

Clone this wiki locally