> For the complete documentation index, see [llms.txt](https://docs.cybus.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cybus.io/2-6-0/monitoring/connectware-metrics/metrics-reference.md).

# Metrics Reference

Protocol Mapper, Service Manager, Resource Status Tracking, and Auth Server expose metrics in [OpenMetrics](https://openmetrics.io) format on a dedicated HTTP endpoint at port `9184`. This page lists every metric, its type, its labels, and an example scrape output for each component.

{% hint style="info" %}
For Kubernetes deployments, metrics endpoints and [Prometheus Operator](https://prometheus-operator.dev/docs/developer/getting-started/) `ServiceMonitor` resources are configured through the `connectware` and `connectware-agent` or `connectware-agent` Helm charts. See [Configuring Metrics](/2-6-0/cybus-helm-charts/working-with-cybus-helm-charts/metrics.md) for Helm-specific configuration.
{% endhint %}

## Common Configuration Parameters

Each component that exposes metrics shares the following environment variables.

| Parameter                          | Default | Description                                                                                                                                                          |
| ---------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `CYBUS_METRICS_BINDHOST`           | `::`    | Network interface the metrics HTTP server binds to. The default `::` exposes the endpoint on all interfaces. Set to `localhost` to restrict access to the host only. |
| `CYBUS_METRICS_COLLECTINTERVALMS`  | `5000`  | How often collected values are stored into Prometheus counters and gauges, in milliseconds. Scrape intervals shorter than this value will return cached data.        |
| `CYBUS_METRICS_RATELIMIT_COUNT`    | `1`     | Maximum number of scrape requests accepted within the rate limit window. When the limit is reached, the cached value for each metric is returned.                    |
| `CYBUS_METRICS_RATELIMIT_WINDOWMS` | `1000`  | Duration of the rate limit window, in milliseconds.                                                                                                                  |

## Protocol Mapper

The Protocol Mapper component uses the `agent_` metric prefix. Its metrics reflect the current state of connections, endpoints, mappings, nodes, and the overall health of the component.

| Metric                           | Type    | Labels                  | Description                                                                             |
| -------------------------------- | ------- | ----------------------- | --------------------------------------------------------------------------------------- |
| `agent_connections_deployed`     | Gauge   | `protocol`, `status`    | Current number of deployed connections, broken down by protocol and connection status.  |
| `agent_endpoints_deployed`       | Gauge   | `protocol`, `operation` | Current number of deployed endpoints, broken down by protocol and operation type.       |
| `agent_endpoints_messages_total` | Counter | `protocol`, `operation` | Total number of messages processed by endpoints, broken down by protocol and operation. |
| `agent_mappings_messages_total`  | Counter | `direction`             | Total number of messages processed by mappings, broken down by direction.               |
| `agent_nodes_operations_total`   | Counter | `protocol`, `operation` | Total number of executed node operations, broken down by protocol and operation type.   |
| `agent_health`                   | Gauge   | `component`             | Health status of the agent components. A value of `1` indicates healthy.                |

**Label values**

* `agent_endpoints_deployed`, `agent_endpoints_messages_total` — `operation`: `read`, `write`, `subscribe`
* `agent_mappings_messages_total` — `direction`: `inbound`, `outbound`
* `agent_nodes_operations_total` — `operation`: `serverProvides`, `serverReceives`
* `agent_health` — `component`: `control-plane`, `data-plane`

**Example output**

{% code lineNumbers="true" %}

```
agent_connections_deployed{protocol="mqtt",status="connected"} 2
agent_connections_deployed{protocol="opcua",status="connected"} 1

agent_endpoints_deployed{protocol="mqtt",operation="subscribe"} 4
agent_endpoints_deployed{protocol="mqtt",operation="read"} 1
agent_endpoints_deployed{protocol="mqtt",operation="write"} 1
agent_endpoints_deployed{protocol="opcua",operation="subscribe"} 120

agent_endpoints_messages_total{protocol="opcua",operation="subscribe"} 814440
agent_endpoints_messages_total{protocol="mqtt",operation="write"} 1
agent_endpoints_messages_total{protocol="mqtt",operation="read"} 1

agent_mappings_messages_total{direction="inbound"} 4
agent_mappings_messages_total{direction="outbound"} 4

agent_nodes_operations_total{protocol="http",operation="serverProvides"} 1
agent_nodes_operations_total{protocol="http",operation="serverReceives"} 3

agent_health{component="control-plane"} 1
agent_health{component="data-plane"} 1
```

{% endcode %}

## Service Manager

The Service Manager component uses the `sm_` metric prefix. Its metrics track deployed service counts, installation failures, enabling durations, and dependency resolution failures.

| Metric                                                     | Type      | Labels   | Description                                                                |
| ---------------------------------------------------------- | --------- | -------- | -------------------------------------------------------------------------- |
| `sm_services_deployed`                                     | Gauge     | `status` | Current number of deployed services, broken down by status.                |
| `sm_service_installation_failures_total`                   | Counter   | —        | Total number of service installation failures.                             |
| `sm_service_enabling_duration_milliseconds`                | Histogram | —        | Duration of service enabling operations, in milliseconds.                  |
| `sm_unresolved_dependencies_service_enable_failures_total` | Counter   | —        | Total number of service enable failures caused by unresolved dependencies. |

**Label values**

* `sm_services_deployed` — `status`: `enabled`, `disabled`

**Example output**

{% code lineNumbers="true" %}

```
sm_services_deployed{status="enabled"} 0
sm_services_deployed{status="disabled"} 1

sm_service_installation_failures_total 0

sm_service_enabling_duration_milliseconds_bucket{le="25"} 1
sm_service_enabling_duration_milliseconds_bucket{le="50"} 3
sm_service_enabling_duration_milliseconds_bucket{le="100"} 3
sm_service_enabling_duration_milliseconds_bucket{le="250"} 3
sm_service_enabling_duration_milliseconds_bucket{le="1000"} 3
sm_service_enabling_duration_milliseconds_bucket{le="3000"} 3
sm_service_enabling_duration_milliseconds_bucket{le="+Inf"} 3
sm_service_enabling_duration_milliseconds_sum 77
sm_service_enabling_duration_milliseconds_count 3

sm_unresolved_dependencies_service_enable_failures_total 10
```

{% endcode %}

## Resource Status Tracking

The Resource Status Tracking component uses the `rst_` metric prefix. Its metrics report the number of services that have active deviations.

| Metric                    | Type  | Labels | Description                                                    |
| ------------------------- | ----- | ------ | -------------------------------------------------------------- |
| `rst_services_deviations` | Gauge | —      | Current number of services with one or more active deviations. |

**Example output**

{% code lineNumbers="true" %}

```
rst_services_deviations 1
```

{% endcode %}

## Auth Server

The Auth Server component uses the `as_` metric prefix. Its metrics track authentication and authorization failures and request volumes, broken down by request type.

| Metric                             | Type    | Labels | Description                                                                    |
| ---------------------------------- | ------- | ------ | ------------------------------------------------------------------------------ |
| `as_authentication_failures_total` | Counter | `type` | Total number of authentication failures, broken down by request type.          |
| `as_authorization_failures_total`  | Counter | `type` | Total number of authorization failures, broken down by request type.           |
| `as_authorization_requests_total`  | Counter | `type` | Total number of authorization requests processed, broken down by request type. |

**Label values for `type`**

| Value             | Applies to                                                           | Description                                        |
| ----------------- | -------------------------------------------------------------------- | -------------------------------------------------- |
| `login`           | `as_authentication_failures_total`                                   | Failures during the login process.                 |
| `mfa`             | `as_authentication_failures_total`                                   | Failures during multi-factor authentication calls. |
| `http`            | All three metrics                                                    | Any HTTP API call.                                 |
| `mqtt`            | `as_authentication_failures_total`                                   | Any MQTT publish or subscribe request.             |
| `mqtt_publish`    | `as_authorization_failures_total`, `as_authorization_requests_total` | MQTT publish requests.                             |
| `mqtt_subscribe`  | `as_authorization_failures_total`, `as_authorization_requests_total` | MQTT subscribe requests.                           |
| `mqtt5_subscribe` | `as_authorization_failures_total`, `as_authorization_requests_total` | MQTT 5 subscribe requests.                         |

**Example output**

{% code lineNumbers="true" %}

```
as_authentication_failures_total{type="login"} 1
as_authentication_failures_total{type="mqtt"} 2
as_authentication_failures_total{type="http"} 1
as_authentication_failures_total{type="mfa"} 1

as_authorization_failures_total{type="http"} 1
as_authorization_failures_total{type="mqtt_publish"} 1
as_authorization_failures_total{type="mqtt_subscribe"} 1
as_authorization_failures_total{type="mqtt5_subscribe"} 1

as_authorization_requests_total{type="http"} 132
as_authorization_requests_total{type="mqtt_publish"} 13
as_authorization_requests_total{type="mqtt_subscribe"} 12
as_authorization_requests_total{type="mqtt5_subscribe"} 3
```

{% endcode %}

## Broker and NATS Metrics

Broker and NATS also expose metrics endpoints, but their metrics come from the underlying software rather than from Connectware instrumentation, so this page does not list them.

* Broker metrics are node-level and combine the standard broker metric set with Cybus-specific additions. For the metric list and for scraping a multi-node cluster, see [Monitoring & Analytics](/2-6-0/broker/cybusmq/configuration/monitoring-and-analytics.md).
* NATS serves metrics in JSON format. A Prometheus exporter sidecar is deployed by default, which translates NATS metrics into an OpenMetrics compatible format. Setting `nats.metrics.enabled` to `false` disables this sidecar. For the available Helm values, see [Configuring Prometheus Metrics](/2-6-0/cybus-helm-charts/working-with-cybus-helm-charts/metrics.md#configuration-values).

Both components use their own metrics Service and port. For the details, see [Metrics Endpoints](/2-6-0/monitoring/connectware-metrics/scraping-metrics.md#metrics-endpoints).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.cybus.io/2-6-0/monitoring/connectware-metrics/metrics-reference.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
