NavigationContentFooter
Jump toSuggest an edit

Pushing metrics and logs from a Scaleway Instance

Reviewed on 02 January 2024 • Published on 28 June 2023
  • cockpit
  • observability
  • metrics
  • logs
  • instance

This page shows you how to push your metrics and logs from a Scaleway Instance.

Security & Identity (IAM)

To perform certain actions described below, you must either be the Owner of the Organization in which the actions will be performed or an IAM user with the necessary permissions.

Requirements
  • You have an account and are logged into the Scaleway console
  • You have activated your Cockpit
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.
  • 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 for more information.

Configure your environment

  1. 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:

    ssh root@<your Instance public IP>
  4. Open another terminal and type the following command to clone our tuto-cockpit-instance repository on your local machine:

    git clone git@github.com:scaleway/tuto-cockpit-instance.git
  5. In the same terminal as step 4, run the following command to send the tuto-cockpit-instance folder and its content into your Instance:

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

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

    cd tuto-cockpit-instance/workshop
  8. Install Golang on your Instance using the following commands:

    wget https://github.com/grafana/agent/releases/download/v0.34.3/grafana-agent-0.34.3-1.amd64.deb
    sudo tar -C /usr/local/ -xzf go1.20.linux-amd64.tar.gz
  9. Run the following command to set Golang in your environment:

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

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

    sudo apt-get install zip unzip

Configure the Grafana agent file

  1. Generate a token and select the push permissions for metrics and logs. Make sure you note down 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 ./download.sh
  3. Run vim agent.yaml to access the Grafana agent configuration file.
  4. Type i to be able to write in 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.

Push your metrics and logs

  1. Run the following command to launch the Grafana agent:

    bash ./run.sh
  2. Log in to the Scaleway console and click Cockpit in the side menu.

  3. Click Open dashboards at the top right corner of your screen.

  4. Log in to Grafana using your credentials.

  5. Click the downward pointing arrow at the top right corner of your screen and select Import dashboard.

  6. Paste the following dashboard ID 12486 in the Import via grafana.com section and click Load. Alternatively, download the dashboard’s JSON template and upload it in the Import dasboard section.

  7. Click Import.

  8. Configure your dashboard as you please.

  9. Select Scaleway metrics in the drop-down box and click Import.

    Important

    Select Metrics if you are using external data.

    Your metrics should display in the dashboard.

  10. Click Toggle menu and Explore.

    Important

    Select Logs if you are using external data.

  11. Select the labels you want to apply in the Label filters section.

  12. Click Run query at the top right corner of your screen. Your logs should display.

Cloud Products & Resources
  • Scaleway Console
  • Compute
  • Storage
  • Network
  • IoT
  • AI
Dedicated Products & Resources
  • Dedibox Console
  • Dedibox Servers
  • Network
  • Web Hosting
Scaleway
  • Scaleway.com
  • Blog
  • Careers
  • Scaleway Learning
Follow us
FacebookTwitterSlackInstagramLinkedin
ContractsLegal NoticePrivacy PolicyCookie PolicyDocumentation license
© 1999-2024 – Scaleway SAS