NavigationContentFooter
Jump toSuggest an edit

Using your own Grafana with Cockpit

Reviewed on 13 March 2024Published on 10 May 2023
  • cockpit
  • metrics
  • logs
  • alerts
  • prometheus
  • loki
  • grafana
  • mimir

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
    • Rules for metrics
    • Rules for logs
    • Alerts

    Your token configuration should look like the following:

  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 you have pushed

  1. From the Grafana homepage, click DATA SOURCES.

  2. Click Add data source.

  3. Select the Prometheus data source.

  4. Copy and paste the following URL in the URL field of the HTTP section:

    https://metrics.cockpit.fr-par.scw.cloud/prometheus
  5. Click Add header in the Custom HTTP Headers section.

  6. Enter X-Token in the Header field.

  7. Enter your token’s secret key in the Value field.

  8. Select Mimir in the Type and version section.

  9. Click Save & test to confirm.

Creating your data source for your Scaleway metrics

  1. From the Grafana homepage, click DATA SOURCES.

  2. Click Add data source.

  3. Select the Prometheus data source.

  4. Copy and paste the following URL in the URL field of the HTTP section:

    https://metrics.cockpit.fr-par.scw.cloud/prometheus
  5. Click Add header in the Custom HTTP Headers section.

  6. Enter X-Token in the Header field.

  7. Enter your token’s secret key in the Value field.

  8. Click Add header.

  9. Enter X-Datasource in the Header field.

  10. Enter product in the Value field.

  11. Select Mimir in the Type and version section.

  12. Click Save & test to confirm.

Creating your data source for logs you have pushed

  1. From the Grafana homepage, click DATA SOURCES.

  2. Click Add data source.

  3. Select the Loki data source.

  4. Copy and paste the following URL in the URL field of the HTTP section:

    https://logs.cockpit.fr-par.scw.cloud
  5. Click Add header in the Custom HTTP Headers section.

  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 Scaleway logs

  1. From the Grafana homepage, click DATA SOURCES.

  2. Click Add data source.

  3. Select the Loki data source.

  4. Copy and paste the following URL in the URL field of the HTTP section:

    https://logs.cockpit.fr-par.scw.cloud
  5. Click Add header in the Custom HTTP Headers section.

  6. Enter X-Token in the Header field.

  7. Enter your token’s secret key in the Value field.

  8. Click Add header.

  9. Enter X-Datasource in the Header field.

  10. Enter product in the Value field.

  11. Click Save & test to confirm.

Creating your data source for your Alert manager

  1. From the Grafana homepage, click DATA SOURCES.

  2. Click Add data source.

  3. Scroll down and select Alertmanager.

  4. Copy and paste the following URL in the URL field of the HTTP section:

    https://alertmanager.cockpit.fr-par.scw.cloud
  5. Click Add header in the Custom HTTP Headers section.

  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.

Once you have completed the steps above, your Grafana instance should be set up and ready to use.

Docs APIScaleway consoleDedibox consoleScaleway LearningScaleway.comPricingBlogCarreer
© 2023-2024 – Scaleway