Creation of a Dashboard

Creation of a Dashboard

This guide will walk you through the process of creating your first dashboard in Grafana, using InfluxDB as the data source. For this tutorial, we will connect to the local InfluxDB server hosted at https://iot.hs-pforzheim.de/influx/.

Prerequisites

Before proceeding, ensure that:

  • You have access to the Grafana instance. A user is provided by the lecturers.
  • The InfluxDB server at https://iot.hs-pforzheim.de:8086/ is running.
  • You have the necessary credentials to access InfluxDB (if authentication is required).

Login and Creation of the Dashboard

Login to Grafana

  1. Open Grafana in your web browser. The URL is https://iot.hs-pforzheim.de/grafana. The Grafana instance is accessible without active use of VPN. Login Dashboard of Grafana
  2. Log in using your provided email or username and password.
  3. You might be prompted to change your password after logging in. If so, choose a strong password and proceed.
  4. If you see a dropdown on the top right corner (might not be the case for everybody!): Ensure, you are associated with the organisation “Württembergische VWA”. You can ensure this by looking at the top-left side of the interface. Organisation overview of Grafana

Check Connection to the InfluxDB Instance

  1. In the Grafana side menu, navigate to Connections.
  2. Select Data Sources.
  3. Check, if the list has the available option called IoT InfluxDB. Available Data Sources in Grafana
  4. In the connection settings, the following details should be visible:
    • Type: InfluxDB
    • Query language: Flux
    • URL: https://iot.hs-pforzheim.de:8086/
    • Auth: Skip TLS Verify (only tick this option)
  5. After validating in the details, you can create your first dashboard.

Creating Your First Dashboard

  1. Once you have successfully connected to InfluxDB, return to the Grafana side menu.
  2. Click on Dasboards and select the button New. Next, select New Dashboard Create new Dashboard
  3. On the landing page, select Add visualization Add visualization
  4. Select the IoT InfluxDB as data source to begin building your first panel. Select data source
  5. In the Query editor, build a query to retrieve the data from your InfluxDB instance. You can use the query builder to select measurements, fields, and time ranges or write a custom query. Default Dashboard
  6. To easy create a query, you can navigate to the InfluxDB interface and use the Data Explorer to build a query. Data Explorer of InfluxDB
    1. Select your bucket
    2. Select your preffered measurement, e.g. air_pressure.
    3. Select the corresponding field, e.g. air_pressure.
    4. Click the button SCRIPT EDITOR to see your query. Query Explorer of InfluxDB
    5. Copy the querie’s code to paste it in Grafana.
    InfluxQL
     from(bucket: "vwa_group0")
         |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
         |> filter(fn: (r) => r["_measurement"] == "air_pressure")
         |> filter(fn: (r) => r["_field"] == "air_pressure")
         |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
         |> yield(name: "mean")
  7. Hit the Query inspector to check if your query returns data. Visualization Type
  8. Choose the appropriate visualisation type for your data, such as a graph, table, or heatmap, depending on how you want to display the information. Visualization Type
  9. Adjust the panel settings to customise the appearance of your visualisation. You can change colours, axes, and formatting options to make the data presentation more intuitive.
  10. Save the panel and provide it with a meaningful title that reflects the data being displayed.
  11. Continue adding panels to the dashboard to visualise different data sets, if necessary. Followed below are two possible outcomes in terms of granularity of displaying the data. Demo 1 Dashboard Demo 2 Dashboard

Exporting and Importing Dashboards

Exporting Dashboards

If you want to share your dashboard with others or migrate it to a different environment:

  1. Open the dashboard you wish to export.
  2. Click the Share button and select Export.
  3. Save the dashboard as a JSON file.
Importing Dashboards

To import an existing dashboard:

  1. In the side menu, navigate to Create > Import.
  2. Upload the JSON file of the dashboard you want to import or paste the content into the provided input field.

Conclusion

By following these steps, you will have successfully created your first Grafana dashboard connected to an InfluxDB instance running on the local server at https://iot.hs-pforzheim.de:8086. Grafana offers extensive options to customise your dashboards, including visualisation styles, data transformations, and alerting mechanisms. For more advanced configuration options, refer to the official Grafana documentation or contact your lecturers.