Skip to navigationSkip to main contentSkip to footerScaleway Docs HomepageAsk our AI
Ask our AI

How to send metrics or logs to Cockpit using OTLP

This guide explains how to configure OpenTelemetry Protocol (OTLP) to push your metrics and logs to Cockpit. You can choose between using a vanilla OTLP exporter or Grafana Alloy as your metrics collector and forwarder.

Before you start

To complete the actions presented below, you must have:

  • Owner status or IAM permissions allowing you to perform actions in the intended Organization

  • A Scaleway account logged into the console

  • A token with push permissions for metrics and/or logs in the same region as your data

  • For vanilla OTLP:

    • An OTLP-compatible exporter installed on your system (e.g., OpenTelemetry Collector, otelcol)
    • Your metrics or logs endpoint URLs retrieved from the Data sources tab of the Scaleway console
    Note

    Cockpit supports both metrics and logs ingestion via OTLP. Use the following endpoints based on your data source region:

    • Metrics endpoint: https://<your-resource-id>.metrics.cockpit.<region>.scw.cloud/otlp/v1/metrics
    • Logs endpoint: https://<your-resource-id>.logs.cockpit.<region>.scw.cloud/otlp/v1/logs
  • For Grafana Alloy: Installed Grafana Alloy

Important
  • If you keep the agents at their default configuration, they may transmit a larger set of resource metrics, which can increase consumption and drive up costs.

  • Sending metrics and logs for Scaleway resources or personal data using an external path is a billable feature. Any data that you push yourself is billed, even if you send data from Scaleway products. Refer to the product pricing for more information.

Using a Vanilla OTLP Exporter

This section demonstrates how to configure a standard OTLP exporter to send metrics directly to Cockpit.

  1. Install the OpenTelemetry Collector on your system. For example, on macOS using Homebrew:

    brew install open-telemetry/opentelemetry-collector/opentelemetry-collector
  2. Create a configuration file named otel-collector-config.yaml:

    receivers:
      otlp:
        protocols:
          grpc:
            endpoint: 0.0.0.0:4317
          http:
            endpoint: 0.0.0.0:4318
    
    processors:
      batch:
        timeout: 10s
        send_batch_size: 1024
    
    exporters:
      otlphttp/cockpit-metrics:
        endpoint: "https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit.fr-par.scw.cloud/otlp/v1/metrics"
        headers:
          X-TOKEN: "COCKPIT_TOKEN_SECRET_KEY"
      otlphttp/cockpit-logs:
        endpoint: "https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.logs.cockpit.fr-par.scw.cloud/otlp/v1/logs"
        headers:
          X-TOKEN: "COCKPIT_TOKEN_SECRET_KEY"
    
    service:
      pipelines:
        metrics:
          receivers: [otlp]
          processors: [batch]
          exporters: [otlphttp/cockpit-metrics]
        logs:
          receivers: [otlp]
          processors: [batch]
          exporters: [otlphttp/cockpit-logs]
  3. Replace the following values:

    • https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit.fr-par.scw.cloud/otlp/v1/metrics with your metrics endpoint URL
    • https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.logs.cockpit.fr-par.scw.cloud/otlp/v1/logs with your logs endpoint URL (optional, if sending logs)
    • COCKPIT_TOKEN_SECRET_KEY with your Cockpit token's secret key
    Important

    Make sure that your token and your data sources (metrics and/or logs) were both created in the same region.

    Note

    You can configure both metrics and logs pipelines to send data to Cockpit. Each data type requires its own endpoint:

    • Metrics: /otlp/v1/metrics
    • Logs: /otlp/v1/logs
  4. Start the OpenTelemetry Collector:

    otelcol --config otel-collector-config.yaml
  5. Configure your applications to send metrics and logs to the collector:

    • gRPC endpoint: localhost:4317
    • HTTP endpoint: localhost:4318

    Your applications can send both metrics and logs to the same collector endpoints, which will forward them to the appropriate Cockpit endpoints based on the pipeline configuration.

Using Grafana Alloy

Grafana Alloy provides a flexible way to collect, transform, and forward metrics to Cockpit with built-in scraping capabilities.

Note

For this guide, we are using Grafana Alloy on macOS. Refer to the official Grafana documentation to find the commands for your operating system.

  1. Create a folder named config on your local machine.

  2. Inside the config folder, create a file named cockpit.alloy.

  3. Paste the following template inside cockpit.alloy:

    prometheus.exporter.unix "node" {
        set_collectors = [
            "uname",
            "cpu",
            "cpufreq",
            "loadavg",
            "meminfo",
            "filesystem",
            "netdev",
        ]
    }
    
    prometheus.scrape "node" {
        scrape_interval = "60s"
        scrape_timeout  = "4s"
    
        targets    = prometheus.exporter.unix.node.targets
        forward_to = [prometheus.remote_write.cockpit.receiver]
    }
    
    prometheus.remote_write "cockpit" {
        endpoint {
            url = "https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit.fr-par.scw.cloud/otlp/v1/metrics"
            headers = {
                "X-TOKEN" = "COCKPIT_TOKEN_SECRET_KEY",
            }
        }
    }
    
    // Optional: Configure logs exporter
    // otelcol.exporter.otlphttp "cockpit_logs" {
    //     client {
    //         endpoint = "https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.logs.cockpit.fr-par.scw.cloud/otlp/v1/logs"
    //         headers = {
    //             "X-TOKEN" = "COCKPIT_TOKEN_SECRET_KEY",
    //         }
    //     }
    // }
  4. Replace the following values:

    • https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit.fr-par.scw.cloud/otlp/v1/metrics with your metrics endpoint URL from the Data sources tab
    • COCKPIT_TOKEN_SECRET_KEY with your Cockpit token's secret key
    • (Optional) Uncomment and configure the logs exporter with your logs endpoint: https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.logs.cockpit.fr-par.scw.cloud/otlp/v1/logs
    Important

    Make sure that your token and your data sources (metrics and/or logs) were both created in the same region.

    Note

    Grafana Alloy can send both metrics and logs to Cockpit. The example above shows metrics configuration using Prometheus remote_write. To send logs, uncomment the OTLP HTTP exporter configuration and configure your log collection components to forward to it.

    • Metrics endpoint: /otlp/v1/metrics
    • Logs endpoint: /otlp/v1/logs
  5. Open a terminal and start Alloy. For example, on macOS:

    brew services start alloy
  6. In the same terminal, run the following command:

    alloy run config/cockpit.alloy

    The last lines of your output should look similar to the following:

    ts=2026-01-23T14:23:05.542081Z level=info msg="now listening for http traffic" service=http addr=127.0.0.1:12345
    ts=2026-01-23T14:23:13.432896Z level=info msg="Done replaying WAL" component_path=/ component_id=prometheus.remote_write.cockpit subcomponent=rw remote_name=aa0551 url=https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit.fr-par.scw.cloud/otlp/v1/metrics duration=12.900498616s

Visualizing your metrics

  1. Click Cockpit in the Monitoring section of the console side menu. The Cockpit overview page displays.

  2. Click Access Grafana to open your preconfigured dashboards in Grafana. You are redirected to the Grafana website.

  3. Click the Grafana icon in the top left side of your screen to open the menu.

  4. Click Dashboards, then click New in the top right corner of your screen. A drop-down displays.

  5. Click Import to import a dashboard.

  6. In the Import via grafana.com field, enter 1860, then click Load.

    Note

    1860 is the ID of the Node Exporter Full dashboard provided by Grafana.

  7. Enter a name for your dashboard or leave the default one.

  8. In the Folder field, select a folder in which to store your dashboard.

  9. In the Prometheus field, select your metrics data source from the drop-down.

  10. Click Import. Your dashboard should load and display.

  11. In the drop-down next to Datasource, select your metrics data source. By default, your dashboard retrieves your data source's data from the last 24 hours.

  12. If your data source was created less than 24 hours ago, click the clock icon and adjust the time range to match its creation time.

Your dashboard should now display your metrics collected via OTLP.

Viewing logs

To view logs sent to Cockpit:

  1. Click Cockpit in the Monitoring section of the console side menu.

  2. Click Access Grafana to open Grafana.

  3. Navigate to Explore in the left menu.

  4. Select your logs data source from the drop-down.

  5. Use LogQL queries to filter and analyze your logs.

Still need help?

Create a support ticket
No Results