Skip to content

Commit 82b0102

Browse files
PSeitzguilload
andauthored
add prometheus tutorial (#5457)
* add prometheus tutorial * Update docs/get-started/tutorials/prometheus-metrics.md Co-authored-by: Adrien Guillo <[email protected]> --------- Co-authored-by: Adrien Guillo <[email protected]>
1 parent 5de2cfa commit 82b0102

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
title: Metrics with Grafana and Prometheus
3+
description: A simple tutorial to display Quickwit metrics with Grafana.
4+
icon_url: /img/tutorials/quickwit-logo.png
5+
tags: [grafana, prometheus, integration]
6+
sidebar_position: 2
7+
---
8+
9+
In this tutorial, you will learn how to set up Grafana to display Quickwit metrics using Prometheus. Grafana will visualize the metrics collected from Quickwit, allowing you to monitor its performance effectively.
10+
11+
## Step 1: Create a Docker Compose File
12+
13+
First, create a `docker-compose.yml` file in your project directory. This file will configure and run Quickwit, Prometheus, and Grafana as Docker services.
14+
15+
Here’s the complete Docker Compose configuration:
16+
17+
```yaml
18+
services:
19+
quickwit:
20+
image: quickwit/quickwit
21+
environment:
22+
QW_ENABLE_OPENTELEMETRY_OTLP_EXPORTER: "true"
23+
OTEL_EXPORTER_OTLP_ENDPOINT: "http://localhost:7281"
24+
ports:
25+
- 7280:7280
26+
command: ["run"]
27+
28+
grafana:
29+
image: grafana/grafana-oss
30+
container_name: grafana
31+
ports:
32+
- "${MAP_HOST_GRAFANA:-127.0.0.1}:3000:3000"
33+
environment:
34+
GF_INSTALL_PLUGINS: https://github.com/quickwit-oss/quickwit-datasource/releases/download/v0.4.6/quickwit-quickwit-datasource-0.4.6.zip;quickwit-quickwit-datasource
35+
GF_AUTH_DISABLE_LOGIN_FORM: "true"
36+
GF_AUTH_ANONYMOUS_ENABLED: "true"
37+
GF_AUTH_ANONYMOUS_ORG_ROLE: Admin
38+
39+
prometheus:
40+
image: prom/prometheus:latest
41+
container_name: prometheus
42+
volumes:
43+
- ./prometheus.yml:/etc/prometheus/prometheus.yml # Ensure prometheus.yml exists in the same directory
44+
ports:
45+
- 9090:9090
46+
```
47+
48+
### Explanation of Services
49+
50+
- **Quickwit**: Runs the Quickwit service on port `7280`.
51+
- **Grafana**: Queries and displays data from Prometheus.
52+
- **Prometheus**: Collects metrics from Quickwit using the `/metrics` endpoint.
53+
54+
## Step 2: Configure Prometheus
55+
56+
Prometheus needs a configuration file to define how it scrapes metrics from Quickwit. Create a file named `prometheus.yml` in the same directory as your Docker Compose file with the following content:
57+
58+
```yaml
59+
global:
60+
scrape_interval: 1s
61+
scrape_timeout: 1s
62+
63+
scrape_configs:
64+
- job_name: quickwit
65+
metrics_path: /metrics
66+
static_configs:
67+
- targets:
68+
- quickwit:7280
69+
```
70+
71+
## Step 3: Start the Services
72+
73+
Run the following command in your terminal to start all services defined in the Docker Compose file:
74+
75+
```bash
76+
docker compose up
77+
```
78+
79+
This will launch Quickwit, Prometheus, and Grafana services.
80+
81+
## Step 4: Configure Grafana to Use Prometheus
82+
83+
1. Open Grafana in your browser at `http://localhost:3000`.
84+
2. Navigate to **Configuration** > **Data Sources**.
85+
3. Click **Add Data Source**, select **Prometheus**, and set the URL to `http://prometheus:9090`.
86+
4. Click **Save & Test** to verify the connection.
87+
88+
## Step 5: Create or Use Pre-Configured Dashboards
89+
90+
Now that Grafana is set up with Prometheus as a data source, you can create custom dashboards or use Quickwit's pre-configured dashboards:
91+
92+
1. Go to the **Dashboards** section in Grafana.
93+
2. Import or create a new dashboard to visualize metrics.
94+
3. Alternatively, use one of Quickwit’s [pre-configured dashboards](../../operating/monitoring).
95+

docs/operating/monitoring.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ sidebar_position: 2
44
---
55

66
You can monitor your Quickwit cluster with Grafana.
7+
Follow the tutorial at [Quickwit Monitoring with Grafana](../get-started/tutorials/prometheus-metrics) on how to set it up.
78

89
We provide three Grafana dashboards to help you monitor:
910
- [indexers performance](https://github.com/quickwit-oss/quickwit/blob/main/monitoring/grafana/dashboards/indexers.json)

0 commit comments

Comments
 (0)