# Metrics

EMQX provides metrics monitoring functions, based on which the operation and maintenance personnel can monitor the current service status and troubleshoot possible system malfunctions.

EMQX provides users with multiple ways to view metrics and status. Most directly, users can see this data on the Metrics tab of the EMQX Dashboard.

Metrics in Dashboard

If it is not convenient to access the Dashboard, they can also obtain these data through HTTP API and system topic messages. You can refer to HTTP API and $SYS system topic.

# Integrate with Monitor Systems

EMQX supports integration with third-party monitoring systems, such as StatsD and Prometheus. Using a third-party monitoring system can bring the following advantages:

  • A complete monitoring system, where the monitoring data of EMQX will be integrated with that of the other systems. For example, we can get the monitoring information of the server host;
  • More intuitive monitoring report with figures and charts, such as using Grafana's dashboard;
  • Various alarm notification means, such as using Prometheus's Alertmanager.

# Metrics & Stats

EMQX divides metrics into Metrics and Stats.

  • Metrics are data that increase monotonically, such as the number of sent bytes and messages. EMQX Metrics currently covers four dimensions: bytes, packets, messages, and events.
  • Stats appear in pairs, including current values and historical maximums, such as the current number of subscriptions and the historical maximum number of subscriptions.

# Metrics

In this section, we will elaborate on the four types of metrics, bytes, packets, messages, and events.

# Bytes

KeyName (in Dashboard)Data typeDescription
bytes.receivedBytes/ReceivedIntegerNumber of received bytes
bytes.sentBytes/SentIntegerNumber of send bytes

# Packets

KeyName (in Dashboard)Data typeDescription
packets.receivedPackets/ReceivedIntegerNumber of received packets
packets.sentPackets/SentIntegerNumber of sent packets
packets.connect.receivedPackets/Connect ReceivedIntegerNumber of received CONNECT packets
packets.connack.auth_errorPackets/Connack Auth ErrorIntegerNumber of sent CONNACK messages with reason codes 0x86 and 0x87
packets.connack.errorPackets/Connack ErrorIntegerNumber of sent CONNACK packets where reason code is not 0x00. The value of this indicator is greater than or equal to the value of packets.connack.auth_error
packets.connack.sentPackets/Connack SentIntegerNumber of sent CONNACK packets
packets.publish.receivedPackets/Publish ReceivedIntegerNumber of received PUBLISH packets
packets.publish.sentPackets/Publish SentIntegerNumber of sent PUBLISH packets
packets.publish.inusePackets/Publish InuseIntegerNumber of received PUBLISH packets with occupied packet identifiers
packets.publish.auth_errorPackets/Publish Auth ErrorIntegerNumber of received PUBLISH packets that failed the ACL check
packets.publish.errorPackets/Publish ErrorIntegerNumber of received PUBLISH packets that cannot be published
packets.publish.droppedPackets/Publish DroppedIntegerNumber of PUBLISH packets that were discarded due to the receiving limit
packets.puback.receivedPackets/Puback ReceivedIntegerNumber of received PUBACK packets
packets.puback.sentPackets/Puback SentIntegerNumber of sent PUBACK packets
packets.puback.inusePackets/Puback InuseintegerNumber of received PUBACK messages with occupied identifiers
packets.puback.missedPackets/Puback MissedIntegerNumber of received PUBACK packets with unknown identifiers
packets.pubrec.receivedPackets/Pubrec ReceivedIntegerNumber of received PUBREC packets
packets.pubrec.sentPackets/Pubrec SentIntegerNumber of sent PUBREC packets
packets.pubrec.inusePackets/Pubrec InuseIntegerNumber of received PUBREC messages with occupied identifiers
packets.pubrec.missedPackets/Pubrec MissedIntegerNumber of received PUBREC packets with unknown identifiers
packets.pubrel.receivedPackets/Pubrel ReceivedIntegerNumber of received PUBREL packets
packets.pubrel.sentPackets/Pubrel SentIntegerNumber of sent PUBREL packets
packets.pubrel.missedPackets/Pubrel MissedIntegerNumber of received PUBREL packets with unknown identifiers
packets.pubcomp.receivedPackets/Pubcomp ReceivedIntegerNumber of received PUBCOMP packets
packets.pubcomp.sentPackets/Pubcomp SentIntegerNumber of sent PUBCOMP packets
packets.pubcomp.inusePackets/Pubcomp InuseIntegerNumber of received PUBCOMP messages with occupied identifiers
packets.pubcomp.missedPackets/Pubcomp MissedIntegerNumber of missed PUBCOMP packets
packets.subscribe.receivedPackets/Subscribe ReceivedIntegerNumber of received SUBSCRIBE packets
packets.subscribe.errorPackets/Subscribe ErrorIntegerNumber of received SUBSCRIBE packets with failed subscriptions
packets.subscribe.auth_errorPackets/Subscribe Auth ErrorIntegerNumber of received SUBACK packets that failed the ACL check
packets.suback.sentPackets/Suback SentIntegerNumber of sent SUBACK packets
packets.unsubscribe.receivedPackets/Unsubscribe ReceivedIntegerNumber of received UNSUBSCRIBE packets
packets.unsubscribe.errorPackets/Unsubscribe ErrorIntegerNumber of received UNSUBSCRIBE packets with failed unsubscriptions
packets.unsuback.sentPackets/Unsuback SentIntegerNumber of sent UNSUBACK packets
packets.pingreq.receivedPackets/Pingreq ReceivedIntegerNumber of received PINGREQ packets
packets.pingresp.sentPackets/Pingresp SentIntegerNumber of sent PUBRESP packets
packets.disconnect.receivedPackets/Disconnect ReceivedIntegerNumber of received DISCONNECT packets
packets.disconnect.sentPackets/Disconnect SentIntegerNumber of sent DISCONNECT packets
packets.auth.receivedPackets/Auth ReceivedIntegerNumber of received AUTH packets
packets.auth.sentPackets/Auth SentIntegerNumber of sent AUTH packets

# Message (PUBLISH packet)

KeyName (in Dashboard)Data typeDescription
delivery.dropped.too_largeDelivery/Dropped Too Large MessagesIntegerNumber of messages dropped because the length exceeded the limit when sending
delivery.dropped.queue_fullDelivery/Dropped Messages (Queue Full)IntegerNumber of messages with a non-zero QoS that were dropped because the message queue was full when sending
delivery.dropped.qos0_msgDelivery/Dropped QoS 0 MessagesIntegerNumber of messages with QoS of 0 that were dropped because the message queue was full when sending
delivery.dropped.expiredDelivery/Dropped Expired MessagesIntegerNumber of messages that were dropped due to message expiration when sending
delivery.dropped.no_localDelivery/Dropped No Local MessagesIntegerNumber of messages dropped due to the No Local subscription option when sending
delivery.droppedDelivery/DroppedIntegerTotal number of messages that were dropped when sent
messages.delayedMessages/DelayedIntegerNumber of delay-published messages stored by EMQX
messages.deliveredMessages/DeliveredIntegerNumber of messages forwarded to the subscription process internally by EMQX
messages.droppedMessages/DroppedIntegerTotal number of messages dropped by EMQX before forwarding to the subscription process
messages.dropped.no_subscribersMessages/Dropped No SubscribersIntegerNumber of messages dropped due to no subscribers
messages.dropped.await_pubrel_timeoutMessages/Dropped Await Pubrel TimeoutIntegerNumber of messages dropped due to await PUBREL timeout
messages.forwardMessages/ForwardIntegerNumber of messages forwarded to other nodes
messages.publishMessages/PublishIntegerNumber of messages published in addition to system messages
messages.qos0.receivedMessages/QoS 0 ReceivedIntegerNumber of QoS 0 messages received from clients
messages.qos1.receivedMessages/QoS 1 ReceivedIntegerNumber of QoS 2 messages received from clients
messages.qos2.receivedMessages/QoS 2 ReceivedIntegerNumber of QoS 1 messages received from clients
messages.qos0.sentMessages/QoS 0 SentIntegerNumber of QoS 0 messages sent to clients
messages.qos1.sentMessages/QoS 1 SentIntegerNumber of QoS 1 messages sent to clients
messages.qos2.sentMessages/QoS 2 SentIntegerNumber of QoS 2 messages sent to clients
messages.receivedMessages/ReceivedIntegerNumber of messages received from the client, which is equal to the sum of messages.qos0.received,messages.qos1.received, and messages.qos2.received
messages.sentMessages/SentIntegerThe number of messages sent to the client, which is equal to the sum of messages.qos0.sent,messages.qos1.sent, and messages.qos2.sent
messages.ackedMessages/AckedIntegerNumber of acked messages

# Event

KeyName (in Dashboard)Data typeDescription
client.connectConnections/ConnetIntegerclient.connect hook trigger times
client.authenticateAccess/AuthenticateIntegerclient.authenticate hook trigger times
client.connackConnections/ConnackIntegerclient.connack hook trigger times
client.connectedConnections/ConnectedIntegerclient.connected hook trigger times
client.disconnectedConnections/DisconnectedIntegerclient.disconnected hook trigger times
client.authorizeAccess/AuthorizeIntegerclient.authorize hook trigger times
client.subscribeConnections/SubscribeIntegerclient.subscribe hook trigger times
client.unsubscribeConnections/UnsubscribeIntegerclient.unsubscribe hook trigger times
session.createdSessions/CreatedIntegersession.created hook trigger times
session.discardedSessions/DiscardedIntegersession.discarded hook trigger times
session.resumedSessions/ResumedIntegersession.resumed hook trigger times
session.takenoverSessions/TakenoverIntegersession.takenover hook trigger times
session.terminatedSessions/TerminatedIntegersession.terminated hook trigger times

# Authentication & Authorization

KeyName (in Dashboard)Data typeDescription
authorization.allowAccess/AllowIntegerNumber of client authorization passes
authorization.denyAccess/DenyIntegerNumber of client authorization failures
authorization.matched.allowAccess/Matched AllowIntegerNumber of client authorization passes due to authorized by some rules
authorization.matched.denyAccess/Matched DenyIntegerNumber of client authorization failures due to being rejected by some rules
authorization.nomatchAccess/No MatchIntegerNumber of client authorization request not be matched any rules
authorization.cache_hitAccess/Cache HitIntegerNumber of client getting authorization result (allow or deny) by cache

# Stats

Here is the EMQX Stats list:

KeyData typeDescription
connections.countIntegerCurrent connections
connections.maxIntegerHistorical maximum number of connections
live_connections.countIntegerNumber of currently live connections
live_connections.maxIntegerHistorical maximum number of live connections
channels.countIntegersame as sessions.count
channels.maxIntegersame as sessions.max
sessions.countIntegerNumber of current sessions
sessions.maxIntegerHistorical maximum number of sessions
topics.countIntegerNumber of current topics
topics.maxIntegerHistorical maximum number of topics
suboptions.countIntegersame as subscriptions.count
suboptions.maxIntegersame as subscriptions.max
subscribers.countIntegerNumber of current subscribers
subscribers.maxIntegerHistorical maximum number of subscribers
subscriptions.countIntegerNumber of current subscriptions, including shared subscriptions
subscriptions.maxIntegerHistorical maximum number of subscriptions
subscriptions.shared.countIntegerNumber of current shared subscriptions
subscriptions.shared.maxIntegerHistorical maximum number of shared subscriptions
retained.countIntegerNumber of currently retained messages
retained.maxIntegerHistorical maximum number of retained messages
delayed.countIntegerNumber of currently delayed messages
delayed.maxIntegerHistorical maximum number of delayed messages