> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gcore.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Monitoring for load balancers

> Monitor load balancers with a Prometheus metrics listener and Managed Logging that sends access logs to OpenSearch.

Load Balancers expose metrics and access logs through two mechanisms: a Prometheus listener that publishes a scrape endpoint, and Managed Logging that forwards listener access logs to OpenSearch. Both are configured per Load Balancer in the Customer Portal.

## Prometheus listener

A Prometheus listener exposes an endpoint with the Load Balancer's metrics for scraping with Prometheus and viewing with Grafana. Unlike regular balancing listeners, it does not route traffic — it only serves metrics.

> [!TIP]
>
> Import [this pre-made Grafana dashboard](https://grafana.com/grafana/dashboards/15828-openstack-octavia-amphora-load-balancer/) to display the metrics.

### Enable Prometheus listener

**1. Open the Load Balancer settings**

In the **Cloud** menu, select **Networking** and then **Load Balancers**. Click the Load Balancer name to open its settings.

![Load Balancers list with two load balancers in Luxembourg-3 region](https://mintcdn.com/gcore/3Ju99x240BAsT7PX/images/docs/cloud/networking/load-balancers/monitoring-for-load-balancers/monitoring-lb-list.png?fit=max\&auto=format\&n=3Ju99x240BAsT7PX\&q=85\&s=eec9491c9109b841b63a3da11c2e7224)

**2. Open the Listeners tab**

Select the **Listeners** tab and click **Add Listener**.

![Listeners tab showing Add Listener button in the top right corner](https://mintcdn.com/gcore/3Ju99x240BAsT7PX/images/docs/cloud/networking/load-balancers/monitoring-for-load-balancers/monitoring-listeners-tab.png?fit=max\&auto=format\&n=3Ju99x240BAsT7PX\&q=85\&s=4ca76ee08c621a1ddca87959ad4d1744)

**3. Configure the listener**

Enter a **Name**, select **Prometheus** as the **Protocol**. The default port is `9101`. Set a **Connection limit** if needed.

The following options are available to secure the Prometheus listener:

* Define an allowed IP range with **Allowed CIDRs**.
* Define a list of users with access through **User List** (Basic Auth).
* Enable SSL/TLS by [adding certificates](/cloud/networking/load-balancers/add-certificates-to-load-balancer).
* Enable mTLS [via the Gcore Cloud API](/cloud/networking/load-balancers/configure-mtls-authentication).

![Add Listener dialog with Prometheus protocol selected, showing Port 9101 and security options](https://mintcdn.com/gcore/3Ju99x240BAsT7PX/images/docs/cloud/networking/load-balancers/monitoring-for-load-balancers/monitoring-add-listener-prometheus.png?fit=max\&auto=format\&n=3Ju99x240BAsT7PX\&q=85\&s=511632bb1f7eca99bf782f440401e591)

**4. Create the listener**

Click **Create Listener** and wait until the Prometheus listener appears in the list.

Add the listener as a target to a Prometheus instance by adding the following lines to `prometheus.yml` under `scrape_configs`:

```yaml theme={null}
- job_name: <LOAD_BALANCER_NAME>
  metrics_path: /metrics
  static_configs:
    - targets:
        - <LOAD_BALANCER_IP>:<PROMETHEUS_LISTENER_PORT>
```

### Disable Prometheus listener

> [!NOTE]
>
> Before deleting a Prometheus listener, delete the corresponding job from all `prometheus.yml` files.

**1. Open the Load Balancer settings**

In the **Cloud** menu, select **Networking** and then **Load Balancers**. Click the Load Balancer name.

**2. Delete the listener**

Select the **Listeners** tab, find the Prometheus listener, click the action menu on the right, and click **Delete**.

## Logging as a service

Load Balancers can forward listener access logs to Gcore Managed Logging (LaaS). Logs are stored in the destination region configured per Load Balancer.

### Enable logging

**1. Open the Load Balancer settings**

In the **Cloud** menu, select **Networking** and then **Load Balancers**. Click the Load Balancer name.

**2. Configure logging**

Select the **Logging** tab and activate the **Enable Logging** toggle.

Select a **Destination region**, then select an existing log **Topic** or create a new one and specify the **Retention** period. For full configuration details, see [Logging for load balancers](/cloud/networking/load-balancers/logging-for-load-balancers).

![Logging tab with Enable Logging toggle on, showing destination region and topic configuration fields](https://mintcdn.com/gcore/3Ju99x240BAsT7PX/images/docs/cloud/networking/load-balancers/monitoring-for-load-balancers/monitoring-logging-form.png?fit=max\&auto=format\&n=3Ju99x240BAsT7PX\&q=85\&s=6d57d0bc61952b36403d027f6898c20b)

**3. Save**

Click **Save changes**. The Logging service begins collecting logs for the Load Balancer.

### View the logs

Logs are accessible in the Customer Portal or in [a Grafana instance](/cloud/logging-as-a-service/view-opensearch-logs-in-Grafana).

**1. Open Managed Logging**

In the **Cloud** menu, select **Managed Logging**.

![Managed Logging page in Cloud section](https://mintcdn.com/gcore/3Ju99x240BAsT7PX/images/docs/cloud/networking/load-balancers/monitoring-for-load-balancers/monitoring-managed-logging.png?fit=max\&auto=format\&n=3Ju99x240BAsT7PX\&q=85\&s=a03a0a878628452e2291a90803a21c91)

**2. Open the OpenSearch dashboard**

Select a log topic from the list and click the corresponding **View Logs** link.

### Disable logging

**1. Open the Load Balancer settings**

In the **Cloud** menu, select **Networking** and then **Load Balancers**. Click the Load Balancer name.

**2. Deactivate logging**

Select the **Logging** tab, deactivate the **Enable Logging** toggle, and click **Save changes**.

![Logging tab with Enable Logging toggle off and Save changes button](https://mintcdn.com/gcore/3Ju99x240BAsT7PX/images/docs/cloud/networking/load-balancers/monitoring-for-load-balancers/monitoring-logging-disabled.png?fit=max\&auto=format\&n=3Ju99x240BAsT7PX\&q=85\&s=9ba4d386484684ed9d860e01df24cb89)

## Cloud API endpoints

Status, metrics, and general statistics for Load Balancers are available via the Gcore Cloud API.

### Load Balancer status

The status endpoints return the operating and provisioning status of a Load Balancer, its listeners, and their pools. Request [one Load Balancer's status](/api-reference/cloud#tag/Load-Balancers/operation/LoadBalancerStatusInstanceViewSet.get) or [status for all Load Balancers](/api-reference/cloud#tag/Load-Balancers/operation/LoadBalancerStatusViewSet.get).

### Load Balancer metrics

The [metrics endpoint](/api-reference/cloud#tag/Load-Balancers/operation/LoadbalancerMetricsHandler.post) returns CPU, memory, and network utilization data for the Load Balancer.

### Load Balancer and listener statistics

Request statistics by calling the GET endpoint with `?show_stats=true`: [one Load Balancer](/api-reference/cloud#tag/Load-Balancers/operation/LoadBalancerInstanceViewSet.get), [one listener](/api-reference/cloud#tag/Load-Balancers/operation/LoadBalancerListenerInstanceViewSet.get), or [all listeners](/api-reference/cloud#tag/Load-Balancers/operation/LoadBalancerListenerViewSet.get).
