---
title: Pushing metrics and logs from a Scaleway Instance
description: This page shows you how to push metrics and logs from a Scaleway Instance
tags: cockpit observability metrics logs
products:
  - cockpit
  - instances
dates:
  validation: 2025-04-22
  posted: 2023-06-28
  validation_frequency: 12
difficulty: beginner
usecase:
  - monitoring
ecosystem:
  - scaleway-only
---
import image from './assets/scaleway-import-dashboard.webp'
import image2 from './assets/scaleway-metrics-display.webp'
import image3 from './assets/scaleway-logs-display.webp'

import Requirements from '@macros/iam/requirements.mdx'


This page shows you how to push your metrics and logs from a [Scaleway Instance](/instances/concepts/#instance). You can also use this tutorial to **push metrics and logs from external Instances (i.e. Instances outside of Scaleway)**.


<Requirements />

- A Scaleway account logged into the [console](https://console.scaleway.com)
- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization

<Message type="important">
 - 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. Find out [how to avoid additional costs when using Cockpit](/cockpit/reference-content/understanding-cockpit-usage/).
 - 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.
</Message>

## Configure your environment

1. [Create an Instance](/instances/how-to/create-an-instance/) from the **Compute** section of the Scaleway console.
2. Copy your Instance's public IP 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@<your Instance public IP>
            ```
## Clone the GitHub repository

We have created a [GitHub repository](https://github.com/scaleway/tuto-cockpit-instance/tree/main) that contains all the code you need to configure the Grafana agent, to push your data.

### Files in the directory

The `tuto-cockpit-instance` directory contains a `workshop` folder with several files inside of it:

- `download.sh` is a script responsible for downloading the necessary binaries and tools you need for the monitoring setup. It fetches the Grafana agent, for example.
- `agent.yaml` is the Grafana agent configuration file responsible for collecting metrics and logs from your data sources, and pushing them to your Cockpit.
- `docker-compose.yaml` is the Docker compose configuration file
- `setup.sh` ensures that all dependencies required for monitoring are properly installed and configured
- `nginx.conf` specifies server settings
- `run.sh` executes the Grafana agent with the specified configuration file (agent.yaml).

The only file we will be editing in this tutorial is the `agent.yaml` file to add your Cockpit [token](/cockpit/concepts/#cockpit-tokens).

1. Open another terminal and type the following command to clone our `tuto-cockpit-instance` directory on your local machine:

            ```bash
            git clone git@github.com:scaleway/tuto-cockpit-instance.git
            ```
2. In the same terminal, run the following command to send the `tuto-cockpit-instance` directory and its content into your Instance:

            ```bash
            scp -r tuto-cockpit-instance root@<your Instance public IP>:~/
            ```
3. Make sure the `tuto-cockpit-instance` directory is inside your Instance with the following command:

            ```bash
            ls
            ```
4. Access the `workshop` folder inside `tuto-cockpit-instance`, using the following command:

            ```bash
            cd tuto-cockpit-instance/workshop
            ```
5. Install [Golang](https://go.dev/) on your Instance using the following commands:

            ```bash
            wget https://go.dev/dl/go1.20.linux-amd64.tar.gz
            sudo tar -C /usr/local/ -xzf go1.20.linux-amd64.tar.gz
            ```
6. Run the following command to set Golang in your environment:

            ```bash
            export PATH=$PATH:/usr/local/go/bin
            ```
7. Run the following command to install docker. Docker allows you to run the `docker-compose.yaml` file.

            ```bash
            apt install docker.io
            ```
8. Run the following command to unzip the files in the `workshop` folder:

        ```bash
        sudo apt-get install zip unzip
        ```

## Configure the Grafana agent file and push your data

1. [Generate a token](/cockpit/how-to/create-token/) and select the push permissions for metrics and logs. Make note of your token's secret key, as you will need it in the following steps.
2.  In the same terminal where you are connected to your Instance, run the following command to download the Grafana agent:
        ```bash
        bash ./download.sh
        ```
3. Run `vim agent.yaml` to access the Grafana agent configuration file.
4. Type `i` to edit the file.
5. Add your token's secret key next to `X-Token` in the `metrics` section.
6. Add your token's secret key next to `tenant_id` in the `logs` section.
7. Press `escape`, `:wq`, and `Enter` to save and exit the file.
8. Run the following command to launch the Grafana agent:
        ```bash
        bash ./run.sh
        ```

## Visualize your metrics and logs

1. Log in to the Scaleway console and click **Cockpit** in the side menu.
2. Click **Open dashboards** in the top right corner of your screen.
3. Log in to Grafana using your credentials.
4. Click the downward pointing arrow in the top right corner of your screen and select **Import dashboard**.
    <Lightbox image={image} alt="" />
5. Paste the following dashboard ID `12486` in the **Import via grafana.com** section and click **Load**. Alternatively, download the [dashboard's JSON template](https://grafana.com/grafana/dashboards/12486-node-exporter-full/) and upload it in the **Import dashboard** section.
6. Click **Import**.
7. Configure your dashboard as you please.
8. Select **Scaleway metrics** in the drop-down box and click **Import**.

    <Message type="important">
     Select **Metrics** if you are using custom data.
    </Message>

    Your metrics should display in the dashboard.

    <Lightbox image={image2} alt="" />

9. Click **Toggle menu** and **Explore**.
    <Message type="important">
     Select **Logs** if you are using custom data.
    </Message>
10. Select the labels you want to apply in the **Label filters** section.
11. Click **Run query** in the top right corner of your screen. Your logs should display.
    <Lightbox image={image3} alt="" />
