NavigationContentFooter
Jump toSuggest an edit

Using your own Grafana with Cockpit

Reviewed on 10 June 2024Published on 10 May 2023
  • metrics
  • logs
  • prometheus
  • loki
  • grafana

In this tutorial, you will learn how to use your own Grafana with Scaleway’s Cockpit service. In this tutorial, we are using Grafana version 9.5.1.

Before you start

To complete the actions presented below, you must have:

  • A Scaleway account logged into the console
  • Owner status or IAM permissions allowing you to perform actions in the intended Organization
  • Installed Docker
  • Downloaded the latest version of Grafana

Launching Grafana

  1. Run the following command to launch Grafana in a Docker container on your local machine:

    docker run -d -p 3000:3000 grafana/grafana-oss:9.5.1
  2. Create a token with the following permissions:

    • Query metrics
    • Query logs
    • Query traces
    • Rules for metrics
    • Rules for logs
    • Alerts
  3. Copy your token’s secret key as you will need it for the following steps.

  4. Open http://localhost:3000 in a web browser on your local computer to access Grafana.

  5. Sign up using admin as your username and password. You will then be prompted to change your password.

Creating your data source for metrics

  1. From the Grafana homepage, click Add your first data source.
  2. Select the Prometheus data source in the list that displays.
  3. Retrieve the URL of the metrics data source you want to add from the Data sources tab of the Scaleway console. Make sure that the region in the URL is the one where your data source is located.
  4. Add /prometheus at the end of the URL. Your metrics’ URL should look like the following:
    https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit.fr-par.scw.cloud/prometheus
  5. Paste your metrics’ URL in the URL field of the HTTP section.
  6. From the Custom HTTP Headers section, click + Add header.
  7. Enter X-Token in the Header field.
  8. Enter your token’s secret key in the Value field.
  9. From the Type and version section, select Prometheus in the Prometheus type drop-down.
  10. Select the latest version in the Prometheus version drop-down.
  11. Click Save & test to confirm.

Creating your data source for logs

  1. From the Grafana homepage, click Add your first data source.
  2. Select the Loki data source in the list that displays.
  3. Retrieve the URL of the logs data source you want to add from the Data sources tab of the Scaleway console.
  4. Paste your logs’ URL in the URL field of the HTTP section.
  5. From the Custom HTTP Headers section, click + Add header.
  6. Enter X-Token in the Header field.
  7. Enter your token’s secret key in the Value field.
  8. Click Save & test to confirm.

Creating your data source for your Alert manager

  1. From the Grafana homepage, click Add your first data source.
  2. Select the Alertmanager data source.
  3. In the Alertmanager section > Implementation, select Mimir in the drop-down.
  4. Copy and paste the following URL in the URL field of the HTTP section:
    https://alertmanager.cockpit.fr-par.scw.cloud
  5. From the Custom HTTP headers section, click + Add header.
  6. Enter X-Token in the Header field.
  7. Enter your token’s secret key in the Value field.
  8. Click Save & test to confirm.

Creating your data source for your traces

  1. From the Grafana homepage, click Add your first data source.
  2. Select the Tempo data source in the list that displays.
  3. Retrieve the URL of the traces data source you want to add from the Data sources tab of the Scaleway console.
  4. Paste your logs’ URL in the URL field of the HTTP section.
  5. From the Custom HTTP headers, click + Add header.
  6. Enter X-Token in the Header field.
  7. Enter your token’s secret key in the Value field.
  8. Click Save & test to confirm.
API DocsScaleway consoleDedibox consoleScaleway LearningScaleway.comPricingBlogCareers
© 2023-2024 – Scaleway