# Monitoring & Analytics

CybusMQ leverages the monitoring and analytics capabilities of VerneMQ with minor extensions. For comprehensive documentation on metrics collection, health checks, and monitoring integration, refer to the [official VerneMQ documentation](https://docs.vernemq.com/1.13.0/monitoring/introduction).

## Scraping in a Cluster

{% hint style="warning" %}

### Node-Level Metrics in Clusters

All metrics are node-level. Each broker node exposes its own metrics independently. The cluster does not aggregate them into a single endpoint. When running a multi-node broker cluster, you must scrape every node individually to capture complete cluster metrics.
{% endhint %}

If you need cluster-level aggregates (for example, total connected clients across all nodes), calculate them at query time in Prometheus or Grafana.

## Additional Metrics

Beyond the standard VerneMQ metrics, CybusMQ provides the following additional metrics:

| Metric Name                                                | Description                                                                                                              |
| ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `mqtt_max_packet_size_exceeded`                            | The number of packets discarded due to exceeding the maximum size specified by the client.                               |
| `mqtt_publish_waited_flow_control`                         | The number of publish packets needed to wait for flow control, multiplied by the number of cycles the packet waited for. |
| `queue_size_qos0`                                          | The number of QoS 0 messages kept in memory by queues.                                                                   |
| `queue_size_qos1`                                          | The number of QoS 1 messages kept in memory by queues.                                                                   |
| `queue_size_qos2`                                          | The number of QoS 2 messages kept in memory by queues.                                                                   |
| `topics_api_request`                                       | The number of topics API requests.                                                                                       |
| `topics_api_error_response`                                | The number of error responses from the topics API. Counts errors by type.                                                |
| `histogram.metadata_put_sync_microseconds_bucket_10`       | Histogram metric for the synchronous metadata store update operations used in synchronous subscribe handling (≤ 10µs).   |
| `histogram.metadata_put_sync_microseconds_bucket_100`      | Histogram metric for synchronous metadata store updates (≤ 100µs).                                                       |
| `histogram.metadata_put_sync_microseconds_bucket_1000`     | Histogram metric for synchronous metadata store updates (≤ 1000µs).                                                      |
| `histogram.metadata_put_sync_microseconds_bucket_10000`    | Histogram metric for synchronous metadata store updates (≤ 10000µs).                                                     |
| `histogram.metadata_put_sync_microseconds_bucket_100000`   | Histogram metric for synchronous metadata store updates (≤ 100000µs).                                                    |
| `histogram.metadata_put_sync_microseconds_bucket_1000000`  | Histogram metric for synchronous metadata store updates (≤ 1000000µs).                                                   |
| `histogram.metadata_put_sync_microseconds_bucket_infinity` | Histogram metric for synchronous metadata store updates (> 1000000µs).                                                   |
| `histogram.metadata_put_sync_microseconds_count`           | Number of synchronous metadata store updates.                                                                            |
| `histogram.metadata_put_sync_microseconds_sum`             | Total time spent in synchronous metadata store updates.                                                                  |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cybus.io/broker/cybusmq/configuration/monitoring-and-analytics.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
