Using your own Grafana with Cockpit
- 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.
You may need certain IAM permissions to carry out some actions described on this page. This means:
- you are the Owner of the Scaleway Organization in which the actions will be carried out, or
- you are an IAM user of the Organization, with a policy granting you the necessary permission sets
- You have an account and are logged into the Scaleway console.
- You have activated your Cockpit
- You have installed Docker
- You are using the latest version of Grafana
Launching Grafana
-
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 -
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:
-
Copy your token’s secret key as you will need it for the following steps.
-
Open http://localhost:3000 in a web browser on your local computer to access Grafana.
-
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
-
From the Grafana homepage, click DATA SOURCES.
-
Click Add data source.
-
Select the Prometheus data source.
-
Copy and paste the following URL in the URL field of the HTTP section:
https://metrics.cockpit.fr-par.scw.cloud/prometheus -
Click Add header in the Custom HTTP Headers section.
-
Enter
X-Token
in the Header field. -
Enter your token’s secret key in the Value field.
-
Select Mimir in the Type and version section.
-
Click Save & test to confirm.
Creating your data source for your Scaleway metrics
-
From the Grafana homepage, click DATA SOURCES.
-
Click Add data source.
-
Select the Prometheus data source.
-
Copy and paste the following URL in the URL field of the HTTP section:
https://metrics.cockpit.fr-par.scw.cloud/prometheus -
Click Add header in the Custom HTTP Headers section.
-
Enter
X-Token
in the Header field. -
Enter your token’s secret key in the Value field.
-
Click Add header.
-
Enter
X-Datasource
in the Header field. -
Enter
product
in the Value field. -
Select Mimir in the Type and version section.
-
Click Save & test to confirm.
Creating your data source for logs you have pushed
-
From the Grafana homepage, click DATA SOURCES.
-
Click Add data source.
-
Select the Loki data source.
-
Copy and paste the following URL in the URL field of the HTTP section:
https://logs.cockpit.fr-par.scw.cloud -
Click Add header in the Custom HTTP Headers section.
-
Enter
X-Token
in the Header field. -
Enter your token’s secret key in the Value field.
-
Click Save & test to confirm.
Creating your data source for your Scaleway logs
-
From the Grafana homepage, click DATA SOURCES.
-
Click Add data source.
-
Select the Loki data source.
-
Copy and paste the following URL in the URL field of the HTTP section:
https://logs.cockpit.fr-par.scw.cloud -
Click Add header in the Custom HTTP Headers section.
-
Enter
X-Token
in the Header field. -
Enter your token’s secret key in the Value field.
-
Click Add header.
-
Enter
X-Datasource
in the Header field. -
Enter
product
in the Value field. -
Click Save & test to confirm.
Creating your data source for your Alert manager
-
From the Grafana homepage, click DATA SOURCES.
-
Click Add data source.
-
Scroll down and select Alertmanager.
-
Copy and paste the following URL in the URL field of the HTTP section:
https://alertmanager.cockpit.fr-par.scw.cloud -
Click Add header in the Custom HTTP Headers section.
-
Enter
X-Token
in the Header field. -
Enter your token’s secret key in the Value field.
-
Click Save & test to confirm.
Once you have completed the steps above, your Grafana instance should be set up and ready to use.