Grafana Dashboard Setup

Grafana provides visualizations for the metrics collected from various exporters via Prometheus. Follow these steps to set up dashboards in Grafana for monitoring your infrastructure and applications effectively:

1. Access Grafana

  1. Open your browser and navigate to the Grafana URL (e.g., http://prodmon.merusphere.in/).

    login

  2. Log in with your credentials.

2. Add a Data Source

  1. From the left-hand menu, click Connections > Data Sources.

    datasource

  2. Click Add new data source.

  3. Select Prometheus from the list of data sources.

datasource

  1. Configure the data source:

    • URL: Provide the URL where Prometheus is running (e.g., http://172.21.0.45:9090).
  2. Click Save & Test to verify the connection.

3. Import or Create Dashboards

3.1 Importing Pre-Built Dashboards

  1. Go to Dashboards.

  2. Create a project folder to organize dashboards by project:

    • Click New > New Folder.
    • Navigate to the folder you created.
  3. Click New > Import to import a dashboard.

import

  1. Enter the dashboard ID from Grafana.com or upload a JSON file.

  2. Click Load.

  3. Select the Prometheus data source you configured earlier.

  4. Click Import to add the dashboard.

datasource

3.2 Creating Custom Dashboards

  1. Click New > Dashboard in the left-hand menu.

  2. Click Add Visualization to add panels.

  3. Select the data source.

  4. Configure the panel:

    • Query: Write a PromQL query to fetch the desired metrics.
    • Visualization: Choose the visualization type (e.g., graph, table, gauge).
    • Panel Options: Configure panel settings like thresholds, units, and display labels. datasource
  5. Click Apply to save the panel.

  6. Add more panels as needed.

  7. Click Save Dashboard and provide a name for your dashboard.

4. Example Dashboards

Below are some example dashboards that can be imported directly using their IDs:

Dashboard Name ID
Prometheus All Metrics 19268
Node Exporter Full 1860
Redpanda Ops Dashboard 18135
Redpanda Default Dashboard 18134
HAProxy Full 12693
NiFi Metrics 6123
MySQL 7362
Blackbox Exporter 7587
Jenkins 9964

5. Set Up Alerts

Steps to Configure Alerts in Grafana

  1. Open a Panel
    Navigate to the desired panel in your dashboard. Click on the three-dot menu (options) and select More > New Alert Rule.

    new_alert

  2. Edit the Alert Name
    Provide a meaningful name for the alert that reflects its purpose or monitored service.

    alert_name

  3. Define the Query
    Configure a query to fetch the numerical data required for evaluating the alert.

    define_query

  4. Define Alert Conditions
    Set conditions based on the metrics and thresholds you want to monitor. For example, trigger an alert if Node status is less than 1.

    threshold

  5. Set Evaluation Behavior
    Specify how the alert should be evaluated, including the evaluation interval and for how long the condition must persist before triggering an alert. evaution

  6. Configure Labels and Notifications

    • Add Labels: Create labels to classify the alert, such as severity and purpose.

      new_alert

    • Select Contact Points: Assign the contact point(s) where notifications should be sent (e.g., email, Slack).

      new_alert

  7. Add Annotations
    Include annotations to provide additional context or descriptions for the alert when it is triggered.

    new_alert

  8. Save the Alert
    Click “Save” to finalize the alert configuration.