To collect and display metrics data from your databases, you can connect your Prometheus or Grafana server to your Redis Cloud subscription.

  • Prometheus is an open source systems monitoring and alerting toolkit that can scrape metrics from different sources.
  • Grafana is an open source metrics dashboard and graph editor that can process Prometheus data.

Redis Cloud has an Prometheus compatible endpoint available in order to pull metrics. Prometheus needs to connect to the internal server on port 8070. This is only available on the internal network so VPC peering is required. VPC peering is only available with Flexible or Annual subscriptions. Because VPC peering is not available on Fixed or Free subscriptions, Prometheus and Grafana cannot connect to databases on Fixed or Free subscriptions.

For more information on how Prometheus communicates with Redis Enterprise clusters, see Prometheus integration with Redis Enterprise Software.

Quick start

You can quickly set up Prometheus and Grafana for testing using the Prometheus and Grafana Docker images.

Prerequisites

  1. Create a Flexible or Annual subscription with a database.

  2. Set up VPC peering for your subscription.

  3. Extract the Prometheus endpoint from the private endpoint to your database. The private endpoint is in the Redis Cloud console under the Configuration tab of your database. The Prometheus endpoint is on port 8070 of the internal server.

    For example, if your private endpoint is:

    redis-12345.internal.<cluster_address>:12345
    

    The Prometheus endpoint is:

    internal.<cluster_address>:8070
    
  4. Create an instance to run Prometheus and Grafana on the same provider as your Redis Cloud subscription (Amazon Web Services or Google Cloud Project). This instance must:

    • Exist in the same region as your Redis Cloud subscription.
    • Connect to the VPC subnet that is peered with your Redis Cloud subscription.
    • Allow outbound connections to port 8070, so that Prometheus can scrape the Redis Cloud server for data.
    • Allow inbound connections to port 9090 for Prometheus and 3000 for Grafana.

Set up Prometheus

To get started with custom monitoring with Prometheus on Docker:

  1. Create a directory on the Prometheus instance called prometheus and create a prometheus.yml file in that directory.

  2. Add the following contents to prometheus.yml. Replace <instance_ip> with the IP address of the instance and replace <prometheus_endpoint> with the Prometheus endpoint.

    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: ["<instance_ip>:9090"]
    
        # scrape Redis Cloud
        - job_name: redis-cloud
            scrape_interval: 30s
            scrape_timeout: 30s
            metrics_path: /
            scheme: https
            static_configs:
                - targets: ["<prometheus_endpoint>:8070"]
    
  3. Create a docker-compose.yml file with instructions to set up the Prometheus and Grafana Docker images.

    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
    
  4. To start the containers, run:

    $ docker compose up -d
    
  5. To check that all the containers are up, run: docker ps

  6. In your browser, sign in to Prometheus at http://<instance_ip>:9090 to make sure the server is running.

  7. Select Status and then Targets to check that Prometheus is collecting data from the Redis Cloud cluster.

    The Redis Enterprise target showing that Prometheus is connected to the Redis Enterprise 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.

See Prometheus Metrics for a list of metrics that Prometheus collects from Redis Enterprise clusters.

Set up Grafana

Once the Prometheus and Grafana Docker containers are running, and Prometheus is connected to your Redis Cloud subscription, you can set up your Grafana dashboards.

  1. Sign in to Grafana. If you installed Grafana with Docker, go to http://<instance_ip>:3000 and sign in with:

    • Username: admin
    • Password: secret
  2. In the Grafana configuration menu, select Data Sources.

  3. Select Add data source.

  4. Select Prometheus from the list of data source types.

    The Prometheus data source in the list of data sources on Grafana.
  5. Enter the Prometheus information:

    • Name: redis-cloud
    • URL: http://<your prometheus address>:9090
    • Access: Server
    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.
  6. Add dashboards for cluster, node, and database metrics. To add preconfigured dashboards:

    1. In the Grafana dashboards menu, select Manage.
    2. Select Import.
    3. Copy and enter one of the following configuration files into the Paste JSON field.
      database.json