KubeMQ
ConnectorsMQTTReference

Connections Endpoint

The KubeMQ MQTT connector's observability surface — the node-local connections snapshot endpoint, its JSON schema, and the three Prometheus metrics.

The KubeMQ internal HTTP API exposes a node-local snapshot of active MQTT client connections and their subscriptions, plus three Prometheus metrics. Use this reference to observe who is connected, what they are subscribed to, and how the MQTT bridge is performing.

Endpoint

GET http://<host>:8080/api/mqtt/connections
PropertyValue
Port8080 (internal HTTP API — network-protected, not exposed to the public internet)
AuthenticationNone (internal network access control)
ScopeNode-local: data reflects only the connections to the node you query. In a multi-node cluster, query each node separately and sum the totals.
Inline clientsFiltered out — the internal bridge client is never included in the response.

Response envelope

All responses use the standard KubeMQ API envelope:

{
  "error": false,
  "error_string": "",
  "data": {
    "connections": [ ],
    "total": 3
  }
}
FieldTypeNotes
errorboolfalse on success
error_stringstringEmpty on success; error description on failure
dataobjectContains the connections array and total count
data.connectionsarrayConnection objects (schema below). Empty array [] when no clients are connected or the MQTT connector is disabled.
data.totalintCount of entries in data.connections

Connection object schema

Each entry in data.connections:

FieldTypeNotes
client_idstringMQTT client identifier
protocol_versionint4 = MQTT 3.1.1; 5 = MQTT 5.0
remote_addrstringClient IP and ephemeral port
connected_atstringRFC 3339 UTC timestamp of session establishment
clean_sessionbooltrue = clean start; false = persistent session
usernamestringMQTT Username field; display-only (not used for authentication). Omitted when empty.
subscriptionsarrayActive subscriptions for this client. Empty array when none.

Subscription object schema

Each entry in subscriptions:

FieldTypeNotes
filterstringOriginal MQTT topic filter string
qosintGranted QoS (0, 1, or 2)
patternstringMapped KubeMQ pattern: events, store, queues, commands, queries, or empty for local ($reply) topics
channelstringMapped KubeMQ channel (dot-separated; may contain * or > for wildcard subscriptions). Empty for $reply local topics.
shared_groupstringNon-empty for $share/<group>/queues/<ch> subscriptions; the group name.

Live example

Response with one connected MQTT 5.0 client subscribed to an Events wildcard and a shared queue:

{
  "error": false,
  "error_string": "",
  "data": {
    "connections": [
      {
        "client_id": "go-example-01",
        "protocol_version": 5,
        "remote_addr": "127.0.0.1:55412",
        "connected_at": "2026-06-12T10:30:00Z",
        "clean_session": true,
        "subscriptions": [
          {
            "filter": "events/site1/#",
            "qos": 1,
            "pattern": "events",
            "channel": "site1.>",
            "shared_group": ""
          },
          {
            "filter": "queues/jobs/email",
            "qos": 1,
            "pattern": "queues",
            "channel": "jobs.email",
            "shared_group": "workers"
          }
        ]
      }
    ],
    "total": 1
  }
}

Response when no clients are connected:

{
  "error": false,
  "error_string": "",
  "data": {
    "connections": [],
    "total": 0
  }
}

Prometheus metrics

The connector exports three Prometheus metrics.

kubemq_mqtt_connections (gauge)

kubemq_mqtt_connections

Current number of active MQTT client connections on this node. Incremented on session establishment, decremented on disconnect. Session takeovers (same client ID reconnect) do not double-count.

kubemq_mqtt_operations_total (counter)

kubemq_mqtt_operations_total{operation="<op>", status="<status>"}

Total bridge operations since process start.

LabelValues
operationpublish_events, publish_store, publish_queues, rpc_command, rpc_query, deliver_events, deliver_store, deliver_queues, rpc_response
statussuccess, error, dropped

Operation semantics:

operationDescription
publish_eventsMQTT PUBLISH routed to KubeMQ Events
publish_storeMQTT PUBLISH routed to KubeMQ Events-Store
publish_queuesMQTT PUBLISH routed to KubeMQ Queues (produce)
rpc_commandMQTT 5.0 PUBLISH routed to KubeMQ Commands
rpc_queryMQTT 5.0 PUBLISH routed to KubeMQ Queries
deliver_eventsEvents message injected to an MQTT subscriber
deliver_storeEvents-Store message injected to an MQTT subscriber
deliver_queuesQueue message injected to an MQTT subscriber (PUBACK = ack)
rpc_responseRPC response injected to the requester's $reply topic

kubemq_mqtt_operation_duration_seconds (histogram)

kubemq_mqtt_operation_duration_seconds{operation="<op>"}

Latency histogram for MQTT bridge operations. Duration is recorded only for request-response operations (rpc_command, rpc_query, rpc_response); per-message stream deliver operations (deliver_events, deliver_store, deliver_queues) pass duration 0 and are counted but not histogrammed.

Buckets: 0.01, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, 30, 60 seconds.

curl examples

List all current connections:

curl -s http://127.0.0.1:8080/api/mqtt/connections | jq .

Count connected clients:

curl -s http://127.0.0.1:8080/api/mqtt/connections | jq '.data.total'

List all client IDs:

curl -s http://127.0.0.1:8080/api/mqtt/connections \
  | jq '[.data.connections[].client_id]'

Filter for MQTT 5.0 clients only:

curl -s http://127.0.0.1:8080/api/mqtt/connections \
  | jq '[.data.connections[] | select(.protocol_version == 5)]'

List all active queue subscriptions with their groups:

curl -s http://127.0.0.1:8080/api/mqtt/connections \
  | jq '[.data.connections[].subscriptions[]
          | select(.pattern == "queues")
          | {filter, channel, shared_group}]'

Was this page helpful?

On this page