content/embeds/rs-prometheus-grafana-quickstart.md
You can use Prometheus and Grafana to collect and visualize your Redis Software metrics.
Metrics are exposed at the cluster, node, database, shard, and proxy levels.
You can use Prometheus and Grafana to:
Collect and display metrics not available in the Cluster Manager UI
Set up automatic alerts for all resources
Display Redis Software metrics alongside data from other systems
{{<image filename="images/rs/grafana-prometheus.png" alt="Graphic showing how Prometheus and Grafana collect and display data from a Redis Software Cluster. Prometheus collects metrics from the Redis Software cluster, and Grafana queries those metrics for visualization." width="80%" class="mx-auto block my-6 p-4 border border-redis-pen-300 rounded-lg shadow-sm">}}
To get started with Prometheus and Grafana, see the following quick start or see Redis Software Observability with Prometheus and Grafana for a more detailed tutorial.
To get started with Prometheus and Grafana:
Create a directory called 'prometheus' on your local machine.
Within that directory, create a configuration file called prometheus.yml.
Add the following contents to the configuration file and replace <cluster_name> with your Redis Software cluster's FQDN:
{{< multitabs id="prometheus-config-yml" tab1="v2 (metrics stream engine)" tab2="v1" >}}
global:
scrape_interval: 15s
evaluation_interval: 15s
# Attach these labels to any time series or alerts when communicating with
# external systems (federation, remote storage, Alertmanager).
external_labels:
monitor: "prometheus-stack-monitor"
# Load and evaluate rules in this file every 'evaluation_interval' seconds.
#rule_files:
# - "first.rules"
# - "second.rules"
scrape_configs:
# scrape Prometheus itself
- job_name: prometheus
scrape_interval: 10s
scrape_timeout: 5s
static_configs:
- targets: ["localhost:9090"]
# scrape Redis Software
- job_name: redis-enterprise
scrape_interval: 30s
scrape_timeout: 30s
metrics_path: /v2
scheme: https
tls_config:
insecure_skip_verify: true
static_configs:
- targets: ["<cluster_name>:8070"]
-tab-sep-
global:
scrape_interval: 15s
evaluation_interval: 15s
# Attach these labels to any time series or alerts when communicating with
# external systems (federation, remote storage, Alertmanager).
external_labels:
monitor: "prometheus-stack-monitor"
# Load and evaluate rules in this file every 'evaluation_interval' seconds.
#rule_files:
# - "first.rules"
# - "second.rules"
scrape_configs:
# scrape Prometheus itself
- job_name: prometheus
scrape_interval: 10s
scrape_timeout: 5s
static_configs:
- targets: ["localhost:9090"]
# scrape Redis Software
- job_name: redis-enterprise
scrape_interval: 30s
scrape_timeout: 30s
metrics_path: /
scheme: https
tls_config:
insecure_skip_verify: true
static_configs:
- targets: ["<cluster_name>:8070"]
{{< /multitabs >}}
Set up your Prometheus and Grafana servers.
{{< note >}}
We recommend running Prometheus in Docker only for development and testing.
{{< /note >}}
To set up Prometheus and Grafana on Docker:
1. Create a _docker-compose.yml_ file:
```yml
version: '3'
services:
prometheus-server:
image: prom/prometheus
ports:
- 9090:9090
volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
grafana-ui:
image: grafana/grafana
ports:
- 3000:3000
environment:
- GF_SECURITY_ADMIN_PASSWORD=secret
links:
- prometheus-server:prometheus
```
1. To start the containers, run:
```sh
$ docker compose up -d
```
1. To check that all of the containers are up, run:
```sh
docker ps
```
1. In your browser, sign in to Prometheus at `http://localhost:9090` to make sure the server is running.
1. Select **Status** and then **Targets** to check that Prometheus is collecting data from your Redis Software cluster.
{{<image filename="images/rs/prometheus-target.png" alt="The Redis Software target showing that Prometheus is connected to the Redis Software Cluster.">}}
If Prometheus is connected to the cluster, you can type **node_up** in the Expression field on the Prometheus home page to see the cluster metrics.
Configure the Grafana datasource:
Sign in to Grafana. If you installed Grafana locally, go to http://localhost:3000 and sign in with:
In the Grafana configuration menu, select Data Sources.
Select Add data source.
Select Prometheus from the list of data source types.
{{<image filename="images/rs/prometheus-datasource.png" alt="The Prometheus data source in the list of data sources on Grafana.">}}
Enter the Prometheus configuration information:
redis-enterprisehttp://<your prometheus server name>:9090{{<image filename="images/rs/prometheus-connection.png" alt="The Prometheus connection form in Grafana.">}}
{{< note >}}
If the network port is not accessible to the Grafana server, select the Browser option from the Access menu.
In a testing environment, you can select Skip TLS verification.
{{< /note >}}
Redis publishes preconfigured dashboards for Redis Software and Grafana.
{{< note >}} V1 dashboards are not compatible with the v2 metrics exporter endpoint. Make sure to use the correct dashboard version for your metrics endpoint. {{< /note >}}
These dashboards are open source. For additional dashboard options, or to file an issue, see the Redis Software observability Github repository.
For more information about configuring Grafana dashboards, see the Grafana documentation.
Use the following dashboards when connecting to the v1 metrics endpoint (https://<cluster_name>:8070/):
Use the following dashboards when connecting to the v2 metrics endpoint (https://<cluster_name>:8070/v2):