# How to set up Digibee API metrics with Prometheus

**Prometheus** is a monitoring platform that provides comprehensive insight into the performance and health of various aspects of an organization’s IT infrastructure, applications, and services.

## **Requirements**

* The feature must be enabled for your realm.
* **Username,** **Password** and **API Key** generated on the [Digibee APIs](/documentation/developer-guide/platform-administration/digibee-apis.md) menu.
* Connection between your Prometheus and the Digibee Integration Platform cluster.

## **Example of usage**

### **Configuration**

In your [Prometheus job configuration file](https://prometheus.io/docs/prometheus/latest/configuration/configuration/), add a job configuration as demonstrated below:

```yaml
...
scrape_configs:
...
- job_name: digibee_platform_<ENVIRONMENT>
  scheme: https
  targets:
    - <DIGIBEE_SERVICES_API_URL>
  metrics_path: /metrics/openmetrics_raw?environment=<ENVIRONMENT>
  params:
    environment:
      - <ENVIRONMENT>
    apikey:
      - {DIGIBEE_SERVICES_API_APIKEY}
    metric:
      - <METRIC_NAME>

  basic_auth:
    username: <DIGIBEE_SERVICES_API_USERNAME>
    password: <DIGIBEE_SERVICES_API_PASSWORD>
  honor_timestamps: true
  scrape_interval: 5m
  scrape_timeout: 60s
  follow_redirects: true
```

{% hint style="info" %}
Add your username using the format: \<realm>-\<username>, as shown in [Digibee APIs](/documentation/developer-guide/platform-administration/digibee-apis.md).
{% endhint %}

### **VPN Configuration**

```yaml
...
scrape_configs:
...
- job_name: digibee_platform
  scheme: https
  targets:
    - <DIGIBEE_SERVICES_API_URL>
  metrics_path: /metrics/openmetrics_raw?
  params:
    apikey:
      - {DIGIBEE_SERVICES_API_APIKEY}
    metric:
      - <METRIC_NAME>

  basic_auth:
    username: <DIGIBEE_SERVICES_API_USERNAME>
    password: <DIGIBEE_SERVICES_API_PASSWORD>
  honor_timestamps: true
  scrape_interval: 5m
  scrape_timeout: 60s
  follow_redirects: true
```

## **Variables**

{% hint style="warning" %}
The ENVIRONMENT variable is **NOT** used for VPN metrics.
{% endhint %}

<table data-header-hidden data-full-width="true"><thead><tr><th width="91.33333333333331"></th><th></th><th></th></tr></thead><tbody><tr><td><strong>#</strong></td><td><strong>Variable name</strong></td><td><strong>Description</strong></td></tr><tr><td>1</td><td>HOST</td><td>HOST from the URL generated on the APIs credentials page after setting up a credential.eg: core.godigibee.io</td></tr><tr><td>2</td><td>REALM</td><td>Your realm’s name.</td></tr><tr><td>3</td><td>ENVIRONMENT</td><td>Environment to collect metrics from.</td></tr><tr><td>4</td><td>DIGIBEE_SERVICES_API_APIKEY</td><td>Generated after setting up a username and password on the Digibee APIs menu</td></tr><tr><td>5</td><td>DIGIBEE_SERVICES_API_USERNAME</td><td>Username created/configured on the Digibee APIs menu.</td></tr><tr><td>6</td><td>DIGIBEE_SERVICES_API_PASSWORD</td><td>Password created/configured on the Digibee APIs menu.</td></tr><tr><td>7</td><td>METRIC_NAME</td><td>List of metric names (one per line) according to the table below.</td></tr></tbody></table>

## **Visualizing your data in Prometheus with Grafana**

<table data-full-width="true"><thead><tr><th>Metric Name</th><th>Description</th><th>Type</th></tr></thead><tbody><tr><td><strong>jvm_memory_bytes_committed</strong></td><td>Committed (bytes) of a given JVM memory area.</td><td>Gauge</td></tr><tr><td><strong>jvm_memory_bytes_init</strong></td><td>Initial bytes of a given JVM memory area.</td><td>Gauge</td></tr><tr><td><strong>jvm_memory_bytes_max</strong></td><td>Maximum (bytes) of a given JVM memory area.</td><td>Gauge</td></tr><tr><td><strong>jvm_memory_bytes_used</strong></td><td>Used bytes of a given JVM memory area.</td><td>Gauge</td></tr><tr><td><strong>jvm_memory_pool_bytes_committed</strong></td><td>Committed bytes of a given JVM memory pool.</td><td>Gauge</td></tr><tr><td><strong>jvm_memory_pool_bytes_init</strong></td><td>Initial bytes of a given JVM memory pool.</td><td>Gauge</td></tr><tr><td><strong>jvm_memory_pool_bytes_max</strong></td><td>Maximum bytes of a given JVM memory pool.</td><td>Gauge</td></tr><tr><td><strong>jvm_memory_pool_bytes_used</strong></td><td>Used bytes of a given JVM memory pool.</td><td>Gauge</td></tr><tr><td><strong>pipeline_all_hung</strong></td><td>Boolean indicating if all pipeline consumers are hung.</td><td>Gauge</td></tr><tr><td><strong>pipeline_cached_bytes</strong></td><td>Total cached bytes.</td><td>Summary</td></tr><tr><td><strong>pipeline_component_executions_total</strong></td><td>The total number of executions per component.</td><td>Counter</td></tr><tr><td><strong>pipeline_component_processi_latency_seconds</strong></td><td>Component processing latency in seconds.</td><td>Summary</td></tr><tr><td><strong>pipeline_inflight</strong></td><td>Number of currently running (inflight) pipelines.</td><td>Gauge</td></tr><tr><td><strong>pipeline_inflight_reported_by_camel</strong></td><td>Number of currently running (inflight) pipelines reported by Camel.</td><td>Gauge</td></tr><tr><td><strong>pipeline_jvm_memory_bytes_max</strong></td><td>Maximum (bytes) of a given JVM memory area.</td><td>Gauge</td></tr><tr><td><strong>pipeline_jvm_memory_bytes_used</strong></td><td>Used bytes of a given JVM memory area.</td><td>Gauge</td></tr><tr><td><strong>pipeline_message_error_rate_in_sec</strong></td><td>Message error rate per seconds (integer number).</td><td>Gauge</td></tr><tr><td><strong>pipeline_message_monitoring_processor_latency_seconds</strong></td><td>Message monitoring processor latency in seconds.</td><td>Summary</td></tr><tr><td><strong>pipeline_message_processing_latency_seconds</strong></td><td>Duration that a message is executed within a replica (Pipeline response time).</td><td>Summary</td></tr><tr><td><strong>pipeline_message_rate_in_sec</strong></td><td>Message rate per seconds (integer number).</td><td>Gauge</td></tr><tr><td><strong>pipeline_message_size_bytes</strong></td><td>Message size in bytes.</td><td>Summary</td></tr><tr><td><strong>pipeline_process_cpu_seconds_total</strong></td><td>Total user and system CPU time spent in seconds.</td><td>Counter</td></tr><tr><td><strong>pipeline_redeliveries</strong></td><td>Total number of messages redelivered.</td><td>Counter</td></tr><tr><td><strong>pipeline_message_size_bytes</strong></td><td>Message size in bytes.</td><td>Summary</td></tr><tr><td><strong>pipeline_process_cpu_seconds_total</strong></td><td>Total user and system CPU time spent in seconds.</td><td>Counter</td></tr><tr><td><strong>rabbitmq_queue_messages</strong></td><td>Number of messages in the queue in a given time.</td><td>Gauge</td></tr></tbody></table>

### VPN Metrics

<table data-full-width="true"><thead><tr><th>Metric name</th><th>Description</th><th>Type</th></tr></thead><tbody><tr><td>ipsec_tunnel_bytes_in</td><td>Total amount of data received through the tunnel in bytes.</td><td>Counter</td></tr><tr><td>ipsec_tunnel_bytes_out</td><td>Total amount of data sent through the tunnel in bytes.</td><td>Counter</td></tr><tr><td>ipsec_tunnel_nat_status</td><td>Indicates the status of Network Address Translation (NAT).</td><td>Gauge</td></tr><tr><td>ipsec_tunnel_status</td><td>Current tunnel status (up or down).</td><td>Gauge</td></tr><tr><td>ipsec_tunnel_status_last_run</td><td>Timestamp of the last execution of the tunnel status check</td><td>Counter</td></tr><tr><td>ipsec_tunnel_vpncheck_status</td><td>Indicates the status of the service that collects VPN metrics. </td><td>Gauge</td></tr></tbody></table>


---

# 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.digibee.com/documentation/developer-guide/development-cycle/dashboards/pipeline-metrics/pipeline-metrics-api/how-to-set-up-digibee-api-metrics-with-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.
