# Export cluster metrics to Prometheus

## Overview

Cloud WEKA Home (CWH) allows exporting key cluster metrics directly to Prometheus using a custom application that follows the [Prometheus Data Model](https://prometheus.io/docs/concepts/data_model/#data-model).

This feature is designed for customers who do not use the [WEKAmon](/monitor-the-weka-cluster/external-monitoring.md) monitoring utility but still need to integrate essential cluster statistics into their Prometheus environments.

Key exported metrics include:

* Throughput metrics
* IO performance metrics
* Cluster resource metrics
* Cluster health and alerts
* Cluster capacity metrics

<details>

<summary>Cluster metrics in Prometheus format</summary>

{% code overflow="wrap" %}

```
Name: weka_throughput_bytes_per_second
Help: Weka throughput in bytes per second
Labels with Values:
type: read, write

Name: weka_iops
Help: Weka cluster IOPS
Labels with Values:
type: read, write, metadata

Name: weka_cluster_drives_count
Help: Number of drives in the cluster
Labels with Values:
status: active, created

Name: weka_cluster_processes_count
Help: Number of processes in the cluster
Labels with Values:
status: active, created
type: compute, drive

Name: weka_cluster_containers_count
Help: Number of containers in the cluster
Labels with Values:
status: active, created
type: compute, drive

Name: weka_cluster_alerts_count
Help: Number of alerts in the cluster
Labels with Values:
status: active

Name: weka_cluster_status
Help: Weka cluster status
Labels with Values:
status: (Dynamic values based on cluster status, e.g., OK, Rebuilding, etc.)

Name: weka_cluster_protection_level
Help: Weka cluster protection level
Labels with Values:
num_failures: (Dynamic values based on the number of failures, e.g., 0, 1, 2, etc.)

Name: weka_cluster_capacity_bytes
Help: Weka cluster capacity in bytes
Labels with Values:
type: total, unprovisioned, unavailable, hotSpare
```

{% endcode %}

</details>

<div data-with-frame="true"><figure><img src="/files/Cmqg52X70t5kZlLOd1US" alt=""><figcaption><p>Cluster metrics sync with Prometheus</p></figcaption></figure></div>

## Export Prometheus metrics from CWH

To export Prometheus metrics from CWH, implement the Prometheus API call within a custom application to retrieve metrics at the required intervals. This procedure demonstrates the operation using the `curl` command to extract the metrics.

**Procedure**

1. **Obtain the Prometheus token:**
   * Contact the Customer Success Team to obtain the Prometheus token of your cluster.
2. **Export metrics in Prometheus format:**

   * Use the following API call, replacing `<cluster_id>` with your cluster ID and `<prometheus_token>` with the Prometheus token from Step 1:

     <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">curl --location \
     'https://api.home.weka.io/api/v3/clusters/&#x3C;cluster_id>/stats/prometheus' \
     --header 'Authorization: Bearer &#x3C;prometheus_token>'
     </code></pre>

   The command returns Prometheus-formatted metrics cluster information.
3. **Import the metrics into Prometheus:**
   1. Configure Prometheus to import the exported metrics.
   2. Use the Prometheus UI to visualize and monitor the metrics.

{% hint style="info" %}
If accessing the backend, prepend `api.` to the URL for legacy ingress support.
{% endhint %}

**Related information**

[Prometheus documentation](https://prometheus.io/docs/introduction/overview/)


---

# 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.weka.io/monitor-the-weka-cluster/the-wekaio-support-cloud/export-cluster-metrics-to-prometheus.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.
