From e9f39065b8baaff7cbbfcba7879b4572d7c52913 Mon Sep 17 00:00:00 2001 From: Vanda ILLYES Date: Fri, 9 Oct 2026 18:34:13 +0200 Subject: [PATCH 1/9] fix(cockpit): fix outdated info --- .../send-metrics-with-grafana-alloy.mdx | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx b/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx index 05ffaed841..da07a3428e 100644 --- a/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx +++ b/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx @@ -3,7 +3,7 @@ title: Send metrics to Cockpit using Grafana Alloy description: Learn to configure Grafana Alloy to push metrics and visualize them in your Grafana dashboard with this step-by-step tutorial. tags: cockpit observability grafana-alloy agent push-metrics dates: - validation: 2026-01-21 + validation: 2026-10-09 posted: 2024-06-28 --- import Requirements from '@macros/iam/requirements.mdx' @@ -75,7 +75,7 @@ For the sake of this documentation, we are using Grafana Alloy on macOS. Refer t 6. Open a terminal and [start Alloy](https://grafana.com/docs/alloy/latest/get-started/run/): ``` - brew services start alloy + alloy ``` 7. In the same terminal, run the following command. ``` @@ -90,24 +90,22 @@ For the sake of this documentation, we are using Grafana Alloy on macOS. Refer t ## Visualizing your metrics 1. Click **Cockpit** in the **Monitoring** section of the [console](https://console.scaleway.com/) side menu. The **Cockpit** overview page displays. -2. Click **Open dashboards** to open your preconfigured dashboards in Grafana. You are redirected to the Grafana website. +2. Click **Access Grafana** to open your preconfigured dashboards in Grafana. You are redirected to the Grafana website. 3. Log in to your Grafana account. The Grafana overview page displays. -4. Click the Grafana icon in the top left side of your screen to open the menu. -5. Click **Dashboards**, then click **New** in the top right corner of your screen. A drop-down displays. -6. Click **Import** to import a dashboard. -7. In the **Import via grafana.com** field, enter `1860`, then click **Load**. +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**. `1860` is the ID of the [Node Exporter Full dashboard](https://grafana.com/grafana/dashboards/1860-node-exporter-full/) provided by Grafana. -8. Enter a name for your dashboard or leave the default one. -9. In the **Folder** field, select a folder in which to store your dashboard. -10. In the **Prometheus** field, select your metrics data source in the drop-down. -11. Click **Import**. Your dashboard should load and display. -12. 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. +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. Click **Import**. Your dashboard should load and display. +10. 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. -13. 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. +11. 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 look similar to the one in the image below. From d67743e45b1b19c6cba35ce2f8f9f58f7c530a34 Mon Sep 17 00:00:00 2001 From: Vanda ILLYES Date: Fri, 9 Oct 2026 18:45:57 +0200 Subject: [PATCH 2/9] fix(cockpit): editorial fix --- pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx b/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx index da07a3428e..ae65c6f0f5 100644 --- a/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx +++ b/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx @@ -92,7 +92,7 @@ For the sake of this documentation, we are using Grafana Alloy on macOS. Refer t 1. Click **Cockpit** in the **Monitoring** section of the [console](https://console.scaleway.com/) 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. Log in to your Grafana account. The Grafana overview page displays. -4. Click **Dashboards**, then click **New** in the top right corner of your screen. A drop-down displays. +4. Click **Dashboards**, then click **New** in the top right corner of your screen. A dropdown displays. 5. Click **Import** to import a dashboard. 6. In the **Import via grafana.com** field, enter `1860`, then click **Load**. @@ -103,7 +103,7 @@ For the sake of this documentation, we are using Grafana Alloy on macOS. Refer t 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. Click **Import**. Your dashboard should load and display. -10. 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. +10. In the dropdown next to **Datasource**, select your metrics data source. By default, your dashboard retrieves your data source's data from the last 24 hours. 11. 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. From 42f82c0c810b65783a39c8e008491178bccb55b3 Mon Sep 17 00:00:00 2001 From: Vanda ILLYES Date: Fri, 9 Oct 2026 19:05:37 +0200 Subject: [PATCH 3/9] fix(cockpit): editorial fixes --- .../send-metrics-with-grafana-alloy.mdx | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx b/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx index ae65c6f0f5..b6b340b1f5 100644 --- a/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx +++ b/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx @@ -1,6 +1,6 @@ --- title: Send metrics to Cockpit using Grafana Alloy -description: Learn to configure Grafana Alloy to push metrics and visualize them in your Grafana dashboard with this step-by-step tutorial. +description: Learn how to configure Grafana Alloy to push metrics and visualize them in your Grafana dashboard with this step-by-step tutorial. tags: cockpit observability grafana-alloy agent push-metrics dates: validation: 2026-10-09 @@ -28,9 +28,9 @@ For the sake of this documentation, we are using Grafana Alloy on macOS. Refer t - A [token](/cockpit/how-to/create-token/) with push permissions for metrics in the **same region as your metrics** - - Having the default configuration on your agents might lead to more of your resources' metrics being sent, a high consumption and a high bill at the end of the month. + - Using default agent settings may collect unnecessary metrics, driving up resource consumption and your monthly bill. - - Sending metrics and logs for Scaleway resources or personal data using an external path is a billable feature. In addition, any data that you push yourself is billed, even if you send data from Scaleway products. Refer to the [product pricing](https://www.scaleway.com/en/pricing/managed-services/#cockpit) for more information. + - Sending metrics and logs for Scaleway resources or personal data using an external path is a billable feature. In addition, any data that you push yourself is billed, even if you send data from Scaleway products. See the [product pricing](https://www.scaleway.com/en/pricing/managed-services/#cockpit) for more information. ## Configuring Grafana Alloy @@ -68,8 +68,8 @@ For the sake of this documentation, we are using Grafana Alloy on macOS. Refer t } } ``` -4. Replace `https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit.fr-par.scw.cloud/api/v1/push` with your metrics' URL. You can retrieve it in the [Data sources tab](https://console.scaleway.com/cockpit/dataSource) of the Scaleway console. -5. Replace `COCKPIT_TOKEN_SECRET_KEY` with your Cockpit token's secret key, then save your changes. +4. Replace `https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit.fr-par.scw.cloud/api/v1/push` with your metrics URL. You can retrieve it from the Scaleway console > **Monitoring** > **Cockpit** >[**Data sources** tab](https://console.scaleway.com/cockpit/dataSource). +5. Replace `COCKPIT_TOKEN_SECRET_KEY` with the secret key of your Cockpit token, then save your changes. Make sure that your token and your metrics data source were both created in the same region. @@ -89,24 +89,24 @@ For the sake of this documentation, we are using Grafana Alloy on macOS. Refer t ## Visualizing your metrics -1. Click **Cockpit** in the **Monitoring** section of the [console](https://console.scaleway.com/) side menu. The **Cockpit** overview page displays. +1. In the [console](https://console.scaleway.com/) side menu, click **Monitoring** > **Cockpit**. The **Cockpit** overview page opens. 2. Click **Access Grafana** to open your preconfigured dashboards in Grafana. You are redirected to the Grafana website. -3. Log in to your Grafana account. The Grafana overview page displays. -4. Click **Dashboards**, then click **New** in the top right corner of your screen. A dropdown displays. +3. Log in to your Grafana account. The Grafana overview page opens. +4. Click **Dashboards**, then click the **New** side menu. A dropdown displays. 5. Click **Import** to import a dashboard. -6. In the **Import via grafana.com** field, enter `1860`, then click **Load**. +6. In the **Find and import dashboards for common applications at grafana.com/dashboards** field, enter `1860`, then click **Load**. `1860` is the ID of the [Node Exporter Full dashboard](https://grafana.com/grafana/dashboards/1860-node-exporter-full/) provided by Grafana. -7. Enter a name for your dashboard or leave the default one. +7. Enter a name for your dashboard or use the default name. 8. In the **Folder** field, select a folder in which to store your dashboard. -9. Click **Import**. Your dashboard should load and display. -10. In the dropdown next to **Datasource**, select your metrics data source. By default, your dashboard retrieves your data source's data from the last 24 hours. - +9. Click **Import**. Your dashboard should load and open. +10. In the dropdown next to **Datasource**, select the data source of your metrics. By default, your dashboard retrieves the data of your data source from the last 24 hours. + 11. 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 look similar to the one in the image below. + Your dashboard should look similar to the one in the following image. - + From 49950cf7c903276a49ce20ace3a6a44d4ae775c8 Mon Sep 17 00:00:00 2001 From: Vanda ILLYES Date: Mon, 12 Oct 2026 14:58:51 +0200 Subject: [PATCH 4/9] fix(cockpit): add log instructions --- .../send-metrics-with-grafana-alloy.mdx | 75 +++++++++++++++++-- 1 file changed, 68 insertions(+), 7 deletions(-) diff --git a/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx b/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx index b6b340b1f5..8769f984a2 100644 --- a/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx +++ b/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx @@ -15,16 +15,16 @@ import AlloyDashboard from './assets/scaleway-alloy-dashboard.webp' The Grafana Alloy agent is a component used in observability and monitoring setups, to collect and send metrics, logs, and traces from your applications, services, and infrastructure to observability platforms, such as Cockpit. -This page explains how to configure the Grafana Alloy agent to push your metrics and visualize them in Grafana. You can use it to **push your data from Scaleway resources or external/custom resources**. +This page shows you how to configure the Grafana Alloy agent to push your metrics and logs from a [Scaleway Instance](/instances/concepts/#instance) and visualize them in Grafana. You can also use this tutorial to **push your data from Scaleway resources or external/custom resources**. -For the sake of this documentation, we are using Grafana Alloy on macOS. Refer to the [official Grafana documentation](https://grafana.com/docs/alloy/latest/get-started/) to find the commands to use depending on your operating system of choice. +For the sake of this documentation, we are using Grafana Alloy on Linux. Refer to the [official Grafana documentation](https://grafana.com/docs/alloy/latest/get-started/) to find the commands to use depending on your operating system of choice. - [Owner](/iam/concepts/glossary/#owner) status or [IAM permissions](/iam/concepts/glossary/#permission) allowing you to perform actions in the intended Organization - A Scaleway account logged into the [console](https://console.scaleway.com) - - [Installed Grafana Alloy](https://grafana.com/docs/alloy/latest/get-started/install/) - [Created a custom data source of the metrics type](/cockpit/how-to/create-external-data-sources/) + - [Created a custom data source of the logs type](/cockpit/how-to/create-external-data-sources/) - A [token](/cockpit/how-to/create-token/) with push permissions for metrics in the **same region as your metrics** @@ -33,9 +33,20 @@ For the sake of this documentation, we are using Grafana Alloy on macOS. Refer t - Sending metrics and logs for Scaleway resources or personal data using an external path is a billable feature. In addition, any data that you push yourself is billed, even if you send data from Scaleway products. See the [product pricing](https://www.scaleway.com/en/pricing/managed-services/#cockpit) for more information. -## Configuring Grafana Alloy +## Create your Instance and install Grafana Alloy -1. Create a folder named `config` on your local machine. +1. [Create an Instance](/instances/how-to/create-an-instance/) from the **Compute** section of the Scaleway console. +2. Copy the public IP your Instance as you will need it in the next steps. +3. Open a terminal and type the following command to connect to your Instance: + + ```bash + ssh root@ + ``` +4. [Install Grafana Alloy](https://grafana.com/docs/alloy/latest/get-started/install/) on the Instance. + +## Configure Grafana Alloy on the Instance to send metrics to Prometheus + +1. Create a folder named `config` on the Instance. 2. Create a file named `cockpit.alloy` inside the `config` folder. 3. Paste the following template inside `cockpit.alloy`: ``` @@ -61,14 +72,14 @@ For the sake of this documentation, we are using Grafana Alloy on macOS. Refer t prometheus.remote_write "cockpit" { endpoint { - url = "https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit.fr-par.scw.cloud/api/v1/push" + url = "https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit..scw.cloud/api/v1/push" headers = { "X-TOKEN" = "COCKPIT_TOKEN_SECRET_KEY", } } } ``` -4. Replace `https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit.fr-par.scw.cloud/api/v1/push` with your metrics URL. You can retrieve it from the Scaleway console > **Monitoring** > **Cockpit** >[**Data sources** tab](https://console.scaleway.com/cockpit/dataSource). +4. Replace `https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit..scw.cloud/api/v1/push` with your metrics URL. You can retrieve it from the Scaleway console > **Monitoring** > **Cockpit** >[**Data sources** tab](https://console.scaleway.com/cockpit/dataSource). 5. Replace `COCKPIT_TOKEN_SECRET_KEY` with the secret key of your Cockpit token, then save your changes. Make sure that your token and your metrics data source were both created in the same region. @@ -110,3 +121,53 @@ For the sake of this documentation, we are using Grafana Alloy on macOS. Refer t Your dashboard should look similar to the one in the following image. + +## Configure Grafana Alloy on the Instance to send logs to Loki + +1. Go to the `config/cockpit.alloy` file on the Instance (created when you set the Instance up for metrics collection). +2. Paste the following template inside `cockpit.alloy`: + ``` + local.file_match "local_files" { + path_targets = [{"__path__" = "/var/log/*.log"}] + sync_period = "5s" + } + + loki.source.file "log_scrape" { + targets = local.file_match.local_files.targets + forward_to = [loki.process.filter_logs.receiver] + tail_from_end = true + } + + loki.process "filter_logs" { + stage.drop { + source = "" + expression = ".*Connection closed by authenticating user root" + drop_counter_reason = "noisy" + } + forward_to = [loki.write.grafana_loki.receiver] + } + + loki.write "grafana_loki" { + endpoint { + url = "https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.logs.cockpit..scw.cloud/api/v1/push" + } + } + ``` +4. Replace `https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.logs.cockpit..scw.cloud/api/v1/push` with your logs URL. You can retrieve it from the Scaleway console > **Monitoring** > **Cockpit** >[**Data sources** tab](https://console.scaleway.com/cockpit/dataSource). +5. Replace `COCKPIT_TOKEN_SECRET_KEY` with the secret key of your Cockpit token, then save your changes. + + Make sure that your token and your logs data source were both created in the same region. + +6. Open a terminal and [start Alloy](https://grafana.com/docs/alloy/latest/get-started/run/): + ``` + alloy + ``` +7. In the same terminal, run the following command. + ``` + alloy run config/cockpit.alloy + ``` + The two last lines of your output should look similar to the following. + ``` + ts=2026-10-12T12:24:19.223570135Z level=info msg="start tailing file" component_path=/ component_id=loki.source.file.log_scrape component=tailer path=/var/log/dpkg.log + ts=2026-10-12T12:24:19.223825237Z level=info msg="start tailing file" component_path=/ component_id=loki.source.file.log_scrape component=tailer path=/var/log/kern.log + ``` From dafb74caf7ea9a5b0e4a0fd127b40e1d344b9fed Mon Sep 17 00:00:00 2001 From: Vanda ILLYES Date: Mon, 12 Oct 2026 17:42:27 +0200 Subject: [PATCH 5/9] fix(cockpit): remove log instructions + editorial --- .../send-metrics-with-grafana-alloy.mdx | 87 ++++--------------- 1 file changed, 16 insertions(+), 71 deletions(-) diff --git a/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx b/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx index 8769f984a2..9e8ece1c7a 100644 --- a/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx +++ b/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx @@ -15,17 +15,16 @@ import AlloyDashboard from './assets/scaleway-alloy-dashboard.webp' The Grafana Alloy agent is a component used in observability and monitoring setups, to collect and send metrics, logs, and traces from your applications, services, and infrastructure to observability platforms, such as Cockpit. -This page shows you how to configure the Grafana Alloy agent to push your metrics and logs from a [Scaleway Instance](/instances/concepts/#instance) and visualize them in Grafana. You can also use this tutorial to **push your data from Scaleway resources or external/custom resources**. +This page shows you how to configure the Grafana Alloy agent to push your metrics from a [Scaleway Instance](/instances/concepts/#instance) and visualize them in Grafana. You can also use this tutorial to **push your data from Scaleway resources or external/custom resources**. -For the sake of this documentation, we are using Grafana Alloy on Linux. Refer to the [official Grafana documentation](https://grafana.com/docs/alloy/latest/get-started/) to find the commands to use depending on your operating system of choice. +For the sake of this documentation, we are using Grafana Alloy on an Ubuntu instance. Refer to the [official Grafana documentation](https://grafana.com/docs/alloy/latest/get-started/) to find the commands to use depending on your operating system of choice. - [Owner](/iam/concepts/glossary/#owner) status or [IAM permissions](/iam/concepts/glossary/#permission) allowing you to perform actions in the intended Organization - A Scaleway account logged into the [console](https://console.scaleway.com) - [Created a custom data source of the metrics type](/cockpit/how-to/create-external-data-sources/) - - [Created a custom data source of the logs type](/cockpit/how-to/create-external-data-sources/) - - A [token](/cockpit/how-to/create-token/) with push permissions for metrics in the **same region as your metrics** + - A [Cockpit token](/cockpit/how-to/create-token/) with push permissions for metrics in the **same region as your metrics** - Using default agent settings may collect unnecessary metrics, driving up resource consumption and your monthly bill. @@ -35,19 +34,18 @@ For the sake of this documentation, we are using Grafana Alloy on Linux. Refer t ## Create your Instance and install Grafana Alloy -1. [Create an Instance](/instances/how-to/create-an-instance/) from the **Compute** section of the Scaleway console. -2. Copy the public IP your Instance as you will need it in the next steps. -3. Open a terminal and type the following command to connect to your Instance: +1. In the Scaleway console side menu, go to **Compute** > **CPU & GPU Instances**, and [create an Instance](/instances/how-to/create-an-instance/). +3. Open a terminal and execute the following command to connect to your Instance: ```bash ssh root@ ``` 4. [Install Grafana Alloy](https://grafana.com/docs/alloy/latest/get-started/install/) on the Instance. -## Configure Grafana Alloy on the Instance to send metrics to Prometheus +## Configure Grafana Alloy to send metrics to Prometheus 1. Create a folder named `config` on the Instance. -2. Create a file named `cockpit.alloy` inside the `config` folder. +2. Inside the `config` folder, create a file named `cockpit.alloy`. 3. Paste the following template inside `cockpit.alloy`: ``` prometheus.exporter.unix "node" { @@ -79,7 +77,7 @@ For the sake of this documentation, we are using Grafana Alloy on Linux. Refer t } } ``` -4. Replace `https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit..scw.cloud/api/v1/push` with your metrics URL. You can retrieve it from the Scaleway console > **Monitoring** > **Cockpit** >[**Data sources** tab](https://console.scaleway.com/cockpit/dataSource). +4. Replace `https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit..scw.cloud/api/v1/push` with your metrics URL. You can retrieve it from the Scaleway console, from **Monitoring** > **Cockpit** > **Data sources** tab. 5. Replace `COCKPIT_TOKEN_SECRET_KEY` with the secret key of your Cockpit token, then save your changes. Make sure that your token and your metrics data source were both created in the same region. @@ -103,71 +101,18 @@ For the sake of this documentation, we are using Grafana Alloy on Linux. Refer t 1. In the [console](https://console.scaleway.com/) side menu, click **Monitoring** > **Cockpit**. The **Cockpit** overview page opens. 2. Click **Access Grafana** to open your preconfigured dashboards in Grafana. You are redirected to the Grafana website. 3. Log in to your Grafana account. The Grafana overview page opens. -4. Click **Dashboards**, then click the **New** side menu. A dropdown displays. +4. Click **Dashboards**, then click the **New** side menu. A dropdown appears. 5. Click **Import** to import a dashboard. -6. In the **Find and import dashboards for common applications at grafana.com/dashboards** field, enter `1860`, then click **Load**. - - - `1860` is the ID of the [Node Exporter Full dashboard](https://grafana.com/grafana/dashboards/1860-node-exporter-full/) provided by Grafana. - +6. In the **Find and import dashboards for common applications at grafana.com/dashboards** field, enter `1860`, then click **Load**. + `1860` is the ID of the [Node Exporter Full dashboard](https://grafana.com/grafana/dashboards/1860-node-exporter-full/) provided by Grafana. 7. Enter a name for your dashboard or use the default name. 8. In the **Folder** field, select a folder in which to store your dashboard. -9. Click **Import**. Your dashboard should load and open. -10. In the dropdown next to **Datasource**, select the data source of your metrics. By default, your dashboard retrieves the data of your data source from the last 24 hours. +9. Click **Import**. Your dashboard loads and opens. +10. In the **Datasource** field, select the data source of your metrics from the dropdown. -11. 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 look similar to the one in the following image. - - - -## Configure Grafana Alloy on the Instance to send logs to Loki - -1. Go to the `config/cockpit.alloy` file on the Instance (created when you set the Instance up for metrics collection). -2. Paste the following template inside `cockpit.alloy`: - ``` - local.file_match "local_files" { - path_targets = [{"__path__" = "/var/log/*.log"}] - sync_period = "5s" - } +11. By default, your dashboard retrieves the data of your data source from the last 24 hours. 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. - loki.source.file "log_scrape" { - targets = local.file_match.local_files.targets - forward_to = [loki.process.filter_logs.receiver] - tail_from_end = true - } - - loki.process "filter_logs" { - stage.drop { - source = "" - expression = ".*Connection closed by authenticating user root" - drop_counter_reason = "noisy" - } - forward_to = [loki.write.grafana_loki.receiver] - } + Your dashboard should look similar to the one in the following screenshot. - loki.write "grafana_loki" { - endpoint { - url = "https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.logs.cockpit..scw.cloud/api/v1/push" - } - } - ``` -4. Replace `https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.logs.cockpit..scw.cloud/api/v1/push` with your logs URL. You can retrieve it from the Scaleway console > **Monitoring** > **Cockpit** >[**Data sources** tab](https://console.scaleway.com/cockpit/dataSource). -5. Replace `COCKPIT_TOKEN_SECRET_KEY` with the secret key of your Cockpit token, then save your changes. - - Make sure that your token and your logs data source were both created in the same region. - -6. Open a terminal and [start Alloy](https://grafana.com/docs/alloy/latest/get-started/run/): - ``` - alloy - ``` -7. In the same terminal, run the following command. - ``` - alloy run config/cockpit.alloy - ``` - The two last lines of your output should look similar to the following. - ``` - ts=2026-10-12T12:24:19.223570135Z level=info msg="start tailing file" component_path=/ component_id=loki.source.file.log_scrape component=tailer path=/var/log/dpkg.log - ts=2026-10-12T12:24:19.223825237Z level=info msg="start tailing file" component_path=/ component_id=loki.source.file.log_scrape component=tailer path=/var/log/kern.log - ``` + \ No newline at end of file From db1df420902abadfd77854a1cb59ffd6cc41ef26 Mon Sep 17 00:00:00 2001 From: Vanda ILLYES Date: Wed, 14 Oct 2026 17:32:49 +0200 Subject: [PATCH 6/9] fix(cockpit): change token info --- .../send-metrics-with-grafana-alloy.mdx | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx b/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx index 9e8ece1c7a..c0f0532bc4 100644 --- a/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx +++ b/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx @@ -3,7 +3,7 @@ title: Send metrics to Cockpit using Grafana Alloy description: Learn how to configure Grafana Alloy to push metrics and visualize them in your Grafana dashboard with this step-by-step tutorial. tags: cockpit observability grafana-alloy agent push-metrics dates: - validation: 2026-10-09 + validation: 2026-10-14 posted: 2024-06-28 --- import Requirements from '@macros/iam/requirements.mdx' @@ -24,7 +24,7 @@ For the sake of this documentation, we are using Grafana Alloy on an Ubuntu inst - [Owner](/iam/concepts/glossary/#owner) status or [IAM permissions](/iam/concepts/glossary/#permission) allowing you to perform actions in the intended Organization - A Scaleway account logged into the [console](https://console.scaleway.com) - [Created a custom data source of the metrics type](/cockpit/how-to/create-external-data-sources/) - - A [Cockpit token](/cockpit/how-to/create-token/) with push permissions for metrics in the **same region as your metrics** + - Created an IAM application with an API key and assigned it an IAM policy with the `ObservabilityFullAccess` permission set. For detailed instructions, see [Create an API secret key](#create-an-api-secret-key). - Using default agent settings may collect unnecessary metrics, driving up resource consumption and your monthly bill. @@ -32,13 +32,28 @@ For the sake of this documentation, we are using Grafana Alloy on an Ubuntu inst - Sending metrics and logs for Scaleway resources or personal data using an external path is a billable feature. In addition, any data that you push yourself is billed, even if you send data from Scaleway products. See the [product pricing](https://www.scaleway.com/en/pricing/managed-services/#cockpit) for more information. +## Create an API secret key + +Your Grafana Alloy configuration must include the `X-Auth-Token` header with your Scaleway API secret key. + +Follow these steps to create your API secret key: +1. [Create an IAM application](/iam/principals/create-application/). +2. [Create a policy](/iam/policies-permissions/create-policy/), making sure that: + - When selecting the principal type, you choose the application you created in Step 1. + - When adding rules, you select the **Resource management** > **Cockpit** > **ObservabilityFullAccess** permission set. +3. Go back to your IAM application, select the **API keys** tab, and click **Generate an API key**. +4. In the **Generate an API keys** dialog that appears: + 1. Provide an optional key description, and select a key expiration time. + 2. Leave the Object Storage as **No, skip for now**. + 3. Click **Generate API key**. A screen appears showing the access key and secret key for your new API key. Save the secret key in a secure place, it will not be shown again after closing the screen. + ## Create your Instance and install Grafana Alloy 1. In the Scaleway console side menu, go to **Compute** > **CPU & GPU Instances**, and [create an Instance](/instances/how-to/create-an-instance/). -3. Open a terminal and execute the following command to connect to your Instance: +3. Open a terminal and execute the following command to connect to your Instance. You can retrieve the public IP address of your Instance from the **Overview** page > **Public Network** section of the Instance. ```bash - ssh root@ + ssh root@ ``` 4. [Install Grafana Alloy](https://grafana.com/docs/alloy/latest/get-started/install/) on the Instance. @@ -72,16 +87,13 @@ For the sake of this documentation, we are using Grafana Alloy on an Ubuntu inst endpoint { url = "https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit..scw.cloud/api/v1/push" headers = { - "X-TOKEN" = "COCKPIT_TOKEN_SECRET_KEY", + "X-Auth-Token" = "API_SECRET_KEY", } } } ``` 4. Replace `https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit..scw.cloud/api/v1/push` with your metrics URL. You can retrieve it from the Scaleway console, from **Monitoring** > **Cockpit** > **Data sources** tab. -5. Replace `COCKPIT_TOKEN_SECRET_KEY` with the secret key of your Cockpit token, then save your changes. - - Make sure that your token and your metrics data source were both created in the same region. - +5. Replace `API_SECRET_KEY` with the secret key of your API key, then save your changes. 6. Open a terminal and [start Alloy](https://grafana.com/docs/alloy/latest/get-started/run/): ``` alloy @@ -96,7 +108,7 @@ For the sake of this documentation, we are using Grafana Alloy on an Ubuntu inst 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/api/v1/push duration=12.900498616s ``` -## Visualizing your metrics +## Visualize your metrics 1. In the [console](https://console.scaleway.com/) side menu, click **Monitoring** > **Cockpit**. The **Cockpit** overview page opens. 2. Click **Access Grafana** to open your preconfigured dashboards in Grafana. You are redirected to the Grafana website. From 963d114771064cc8d2725034b7abc0d233c75edf Mon Sep 17 00:00:00 2001 From: vanda-scw Date: Thu, 15 Oct 2026 09:55:09 +0200 Subject: [PATCH 7/9] Apply review suggestion (editorial) Co-authored-by: mmfrayssens --- pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx b/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx index c0f0532bc4..405a7c6601 100644 --- a/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx +++ b/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx @@ -42,7 +42,7 @@ Follow these steps to create your API secret key: - When selecting the principal type, you choose the application you created in Step 1. - When adding rules, you select the **Resource management** > **Cockpit** > **ObservabilityFullAccess** permission set. 3. Go back to your IAM application, select the **API keys** tab, and click **Generate an API key**. -4. In the **Generate an API keys** dialog that appears: +4. In the **Generate an API keys** dialog box that appears: 1. Provide an optional key description, and select a key expiration time. 2. Leave the Object Storage as **No, skip for now**. 3. Click **Generate API key**. A screen appears showing the access key and secret key for your new API key. Save the secret key in a secure place, it will not be shown again after closing the screen. From 1e3f9dded79d4adb6c6cf2ee81ee9d3651d62a45 Mon Sep 17 00:00:00 2001 From: vanda-scw Date: Thu, 15 Oct 2026 10:21:28 +0200 Subject: [PATCH 8/9] Apply review suggestion (editorial) Co-authored-by: Paul --- pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx b/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx index 405a7c6601..b538724fbc 100644 --- a/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx +++ b/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx @@ -85,7 +85,7 @@ Follow these steps to create your API secret key: prometheus.remote_write "cockpit" { endpoint { - url = "https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit..scw.cloud/api/v1/push" + url = "https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit..scw.cloud/api/v1/push" headers = { "X-Auth-Token" = "API_SECRET_KEY", } From e08c7f3aa3673f1ea9897acb48c276bd4b434c07 Mon Sep 17 00:00:00 2001 From: Vanda ILLYES Date: Thu, 15 Oct 2026 10:36:10 +0200 Subject: [PATCH 9/9] fix(cockpit): editorial improvements --- pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx b/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx index b538724fbc..895fa781f6 100644 --- a/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx +++ b/pages/cockpit/how-to/send-metrics-with-grafana-alloy.mdx @@ -39,7 +39,7 @@ Your Grafana Alloy configuration must include the `X-Auth-Token` header with you Follow these steps to create your API secret key: 1. [Create an IAM application](/iam/principals/create-application/). 2. [Create a policy](/iam/policies-permissions/create-policy/), making sure that: - - When selecting the principal type, you choose the application you created in Step 1. + - When selecting the principal type, you choose the application you created in step 1. - When adding rules, you select the **Resource management** > **Cockpit** > **ObservabilityFullAccess** permission set. 3. Go back to your IAM application, select the **API keys** tab, and click **Generate an API key**. 4. In the **Generate an API keys** dialog box that appears: @@ -53,7 +53,7 @@ Follow these steps to create your API secret key: 3. Open a terminal and execute the following command to connect to your Instance. You can retrieve the public IP address of your Instance from the **Overview** page > **Public Network** section of the Instance. ```bash - ssh root@ + ssh root@ ``` 4. [Install Grafana Alloy](https://grafana.com/docs/alloy/latest/get-started/install/) on the Instance. @@ -92,7 +92,7 @@ Follow these steps to create your API secret key: } } ``` -4. Replace `https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit..scw.cloud/api/v1/push` with your metrics URL. You can retrieve it from the Scaleway console, from **Monitoring** > **Cockpit** > **Data sources** tab. +4. Replace `https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit..scw.cloud/api/v1/push` with your metrics URL. You can retrieve it from the Scaleway console, from **Monitoring** > **Cockpit** > **Data sources** tab. 5. Replace `API_SECRET_KEY` with the secret key of your API key, then save your changes. 6. Open a terminal and [start Alloy](https://grafana.com/docs/alloy/latest/get-started/run/): ``` @@ -102,7 +102,7 @@ Follow these steps to create your API secret key: ``` alloy run config/cockpit.alloy ``` - The two last lines of your output should look similar to the following. + The last two 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/api/v1/push duration=12.900498616s