Skip to main content
OpenSRE queries Grafana (Cloud or self-hosted) for metrics, dashboard context, and alert annotations during investigations.

Overview

  1. Grafana Cloud / self-hosted setup
  2. Local Grafana Setup (Minikube example)

Grafana Cloud / self-hosted setup

Prerequisites

Option 1: Interactive CLI

Provide the instance URL and service account token when prompted.

Option 2: Environment variables

For prod/staging pairs, use GRAFANA_INSTANCES — see Multi-instance integrations.

Option 3: Persistent store

Option 4: Hosted web app (OpenSRE Cloud)

  1. In app.tracer.cloud, go to IntegrationsGrafana
  2. Enter a name, instance URL, and service account token
  3. Click Save
Connect Grafana

Verify

Self-signed or internal CA certificates

If your Grafana instance is self-hosted behind a certificate signed by an internal/private CA, opensre onboard will prompt:
  • Verify SSL certificate? — answer No to skip TLS verification entirely (only recommended for local/lab instances).
  • Path to CA bundle for SSL verification — point this at a PEM file containing your internal CA certificate to keep full TLS verification while trusting your organization’s CA. This is the recommended option for a real internal Grafana deployment, since it still validates the certificate chain and hostname.
These can also be set directly via GRAFANA_VERIFY_SSL (true/false) and GRAFANA_CA_BUNDLE (path to a PEM file) in .env.

Local Grafana Setup (Minikube example)

Steps

  1. Start minikube:
  2. Add prometheus community and podinfo helm repositories:
  3. Create monitoring namespace and install kube-prometheus stack:
  4. Create podinfo namespace and install podinfo application:
  5. (Optional) Check the status of the pods in the podinfo and monitoring namespaces:
  6. (Run in separate terminals) Port forward the podinfo service:
  7. (Run in separate terminals) Port forward the prometheus service:
  8. (Run in separate terminals) Port forward the grafana service and expose it on all network interfaces:
  9. Patch the kube-stack-prometheus service to allow it to scrape the podinfo service:

Credentials for Grafana

Run this command to get the Grafana admin password:
The username is admin and the password is the output of the command above.

Access

Access the:

Simulate load on the podinfo application

Open a new terminal and run the following command to simulate load on the podinfo application:

Grafana Dashboard

Run the following queries in the Grafana dashboard to visualize the metrics:
  • For the number of requests to the podinfo application:
  • For the average response time of the podinfo application:
Spike in Error Rate in Grafana

Setting up Prometheus Alerts

Run this command to create a Prometheus alert for the podinfo application which triggers when the error rate is high:
The prometheus alert will be fired after 30 seconds of the error rate being high. You can check the alert in the prometheus dashboard at http://localhost:9090/alerts.
Prometheus Alert Firing

Integrating with OpenSRE

  1. Get the LAN IP address of your machine:
  2. Create a service account token in Grafana following the official documentation: How to add a token to a service account in Grafana
  3. Run opensre integration add grafana and follow the prompts to enter the required information:
    • Instance URL: Enter the endpoint URL for your Grafana instance (e.g., http://<LAN_IP_ADDRESS>:3000)
    • Service account token: Paste the Service Account token you created in Grafana
    Successful Grafana Integration with OpenSRE