Skip to content

Commit f2bc17b

Browse files
author
Bibas
committed
add(observability): new documentation for the federation endpoint of Cockpit datasource
1 parent af8b3f1 commit f2bc17b

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
meta:
3+
title: How to federate Scaleway metrics with your own Prometheus
4+
description: Learn how to retrieve the Scaleway product metrics with federation to re-use them within your own Prometheus
5+
content:
6+
h1: How to federate Scaleway metrics with your own Prometheus
7+
paragraph: Learn how to retrieve the Scaleway product metrics with federation to re-use them within your own Prometheus using Scaleway's comprehensive guide. This tutorial covers retrieving your Scaleway product metrics by federation of your Cockpit datasources and retrieving those metrics within Prometheus.
8+
tags: federation cockpit metrics observability monitoring prometheus
9+
categories:
10+
- observability
11+
dates:
12+
validation: TBD
13+
posted: TBD
14+
---
15+
16+
In this page, we will show you how to federate your Scaleway product metrics using the `/federate` endpoint of your Scaleway datasources with a [Prometheus](https://prometheus.io) configuration.
17+
18+
<Macro id="requirements" />
19+
20+
- A Scaleway account logged into the [console](https://console.scaleway.com)
21+
- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
22+
- [Created](/cockpit/how-to/create-token/) a Cockpit token with read access in the same region as the metrics data source
23+
- [Created](/iam/how-to/create-api-keys/) an API key and retrieved your API secret key
24+
- A running [Prometheus](https://prometheus.io) instance
25+
26+
<Message type="info">
27+
The `/federate` endpoint will not be charged during beta phase but please note that after the beta
28+
</Message>
29+
30+
<Message type="important">
31+
- Federating Scaleway product metrics is a billable feature. Refer to the [product pricing](https://www.scaleway.com/en/pricing/?tags=available,managedservices-observability-cockpit) page for more information.
32+
</Message>
33+
34+
## Configure your Prometheus
35+
36+
Create a `prometheus.yml` file to configure your Prometheus instance, using the example below.
37+
Make sure to replace `$SCW_DATASOURCE_URL` with the URL of your data source (you can find it under the "API URL" section in the [Data sources tab](https://console.scaleway.com/cockpit/dataSource) of the Scaleway console) and to replace `$SCW_READ_TOKEN` with your Cockpit token with read permissions.
38+
39+
```yaml
40+
global:
41+
scrape_interval: 60s
42+
43+
scrape_configs:
44+
- job_name: 'federate-scaleway-metrics'
45+
honor_labels: true
46+
metrics_path: '/federate'
47+
http_headers:
48+
X-Token:
49+
values:
50+
- '$SCW_READ_TOKEN'
51+
params:
52+
'match[]':
53+
- '{__name__="my-scaleway-metrics"}'
54+
- '{job="my-wanted-job"}'
55+
static_configs:
56+
- targets:
57+
- '$SCW_DATASOURCE_URL'
58+
```
59+
60+
<Message type="info">
61+
Please note that you should not include `https://` in the `SCW_DATASOURCE_URL`
62+
</Message>
63+
64+
Modify the different `match[]` parameters according to the metrics you want to retrive, in this example you will federate:
65+
- All metrics called `my-scaleway-metrics`
66+
- All metrics with the label `job` with the value `my-wanted-job`
67+
68+
## Run your Prometheus instance
69+
70+
Once you have configured your `prometheus.yml` file, you can use docker-compose to run your Prometheus instance with the configuration, and start federating Scaleway product metrics.
71+
72+
1. Create a `docker-compose.yml` file with :
73+
```yaml
74+
services:
75+
prometheus:
76+
image: prom/prometheus:latest
77+
container_name: prometheus
78+
volumes:
79+
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
80+
ports:
81+
- 9090:9090
82+
command:
83+
- '--config.file=/etc/prometheus/prometheus.yml'
84+
```
85+
2. Go to http://localhost:9090/targets and you should see your newly created target, federating your Scaleway product metrics

pages/cockpit/reference-content/cockpit-supported-endpoints.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,14 @@ Refer to the [official Mimir documentation](https://grafana.com/docs/mimir/lates
6262
- Path: `/prometheus/api/v1/metadata`
6363
- Path: `/prometheus/api/v1/read`
6464
- Path: `/prometheus/api/v1/status/buildinfo`
65+
- Path: `/federate`
6566
</Concept>
6667

68+
<Message type="important">
69+
The `/federate` endpoint will not be charged during beta phase but please note that after the beta, this endpoint will incurs additional costs.
70+
For more information, you can check [this tutorial](../how-to/federate-scaleway-metrics.mdx)
71+
</Message>
72+
6773
<Concept>
6874
## Mimir rules endpoints
6975

0 commit comments

Comments
 (0)