Overview of Grafana visualization tool

Snehalhingane
8 min readJun 30, 2023

Playground for granfana → https://play.grafana.org/d/000000074/alerting?orgId=1

In this article we will get to know about monitoring tool i.e. Grafana, we will see what is grafana, how to use it etc., so lets gets started…..

What is Grafana?

  • Grafana is an open-source platform for data visualization, monitoring and analysis. It is use for running data analytics, pulling up metrics that make sense of the massive amount of data & to monitor our apps with the help of cool customizable dashboards.
  • Grafana connects with every possible data source such as Graphite, Prometheus, Influx DB, ElasticSearch, MySQL, PostgreSQL etc. Their are tones of datasources available in grafana that we can use it as per our requirement.
  • The tool helps us study, analyze and monitor data over a period of time, technically called time series analytics. It helps us track the user behavior, application behavior, frequency of errors popping up in production, pre-prod or any other environment, type of errors popping up and the contextual scenarios by providing relative data.

How to install grafana?
Follow the steps as per the grafana official document to setup grafana on your local environment → https://grafana.com/grafana/download

What features are offered by Grafana?

Grafana takes care of all the analytics of our app. We can easily query, visualize, set up alerts, and understand the data with the help of metrics. The dashboard is pretty equipped with various features and is continually evolving which helps us make sense of complex data. From displaying graphs to heatmaps, histograms, Geo maps and so on. The tool has a plethora of visualization options to understand data as per our use case.

Alerts are set up and triggered like tripwires whenever an anticipated scenario occurs. These happenings can be notified on Slack or whichever communication tool the monitoring team uses.

Grafana has native support for approx. a dozen databases with quite a number of plugins. Either host it on-prem or on any cloud platform of your choice.

It has built-in support for Graphite and expressions like add, filter, avg, min, max functions etc. to custom fetch data. What is Graphite? I’ll come to that. It also has built-in Influx DB, Prometheus, ElasticSearch, and CloudWatch support. I’ll talk about it all up ahead.

What Is A Grafana Dashboard?

Grafana dashboard looks like below:

  • The dashboards pull data from plugged-in data sources such as Graphite, Prometheus, Influx DB, ElasticSearch, MySQL, PostgreSQL etc. These are a few of the many data sources that Grafana supports by default.

Basic concepts:

Dashboard: A Grafana dashboard supports multiple panels in a single grid. You can visualize results from multiple data sources simultaneously.

Panel : In the panel editor, you can update all the elements of a visualization including the data source, queries, time range, and visualization display options.

Labels: Grafana variables allow you to use a drop down menu to select various options, no code modifications required.

How to view dashboard:

  • Click on search button on top and search dashboard as per the requirement

How to view available datasource on grafana:

  • Click on Home → connections → Data sources

What are labels/varibale:

  • Grafana variables allow you to use a drop down menu to select various options, no code modifications required.

How to filter data based on time_range:

  • On left side corner you will see time_range section, select time based on the requirement

What is Explore option:

  • Explore strips away the dashboard and panel options so that you can focus on the query.
  • If you just want to explore your data and do not want to create a dashboard, then Explore makes this much easier
  • If your data source supports graph and table data, then Explore shows the results both as a graph and a table.

How to monitor data using Explore option:

  • We can monitor all the records using different datasource via Explore
  • For that you just need to click on toggle menu → Explore (as shown in left picture), once you click on that you will redirect to explore window (as shown in right picture)
  • Here, First you will have to select is datasource, so you will need to see which datasource will give correct result as per the requirement eg.,
  • If we want to analyze the logs with respect to process or server then we can select datasource as “Loki”
  • If we want to see information specific to node or instance then we can select datasource as “mimir”
  • If we want to find the remote calls or jvm messages with respect to servers or components then we can select datasource as “Tempo”

Sample Use cases/Scenario’s:

lets say I want to see whether my instance is up or down

Step1: Open explore option (click on Home toggle button → Explore)

Step2: Select datasource as mimir

Step3: Select metrics with respect to label filter and value and run query, In this case

  • Metric — up (This metrics is use to check whether the exporter was available / reachable or not)
  • Label filter — instance = IP Address

Step4: Now you will see outcome as below

How to create dashboard:

Step 1: Open grafana, and on left hand you will see 3 lines, click on that and select dashboard

Step 2: once you click on dashboard you will see 3 options, click on New dashboard

Step 3: Now you will redirect to the new dashboard as shown in below

How to create customize panels inside dashboards:

Step 1: Click on Add option and then select visualization as shown in below

Step 2: In the modal that opens, do one of the following:

  • Select one of your existing data sources.
  • The Edit panel view opens with your data source selected. You can change the panel data source later using the dropdown in the Query tab of the panel editor if needed.
  • For more information about data sources, refer to Data sources for specific guidelines.
  • Write or construct a query in the query language of your data source.
  • Click the Refresh dashboard icon to query the data source.
  • In the visualization list, select a visualization type. Grafana displays a preview of your query results with the visualization applied.

Panel Options -

  • Panel title -Enter a name for your dashboard and select a folder, if applicable. eg., Memory Usage
  • You can transparent the background if needed otherwise leave as it is
  • Panel links — Each panel can have its own set of links that are shown in the upper-left corner of the panel. You can link to any available URLs, including dashboards, panels, or external sites.
  • Value Options — you can calculate the value based on the calculations options that we have in dropdown list eg, min, max, Last etc, also you can select the Fields based on the requirement
  • Stat style — you can style your panel eg., change the orientation, color of the text, text alignment etc
  • Text Size — customize the text size

Standard option -

  • Unit — Lets you choose what unit a field should use. Click in the Unit field, then drill down until you find the unit you want.
  • Min — Lets you set the minimum value used in percentage threshold calculations. Leave blank for auto calculation based on all series and fields.
  • Max — Lets you set the maximum value used in percentage threshold calculations. Leave blank for auto calculation based on all series and fields.
  • Decimal — Specify the number of decimals Grafana includes in the rendered value. If you leave this field blank, Grafana automatically truncates the number of decimals based on the value. For example 1.1234 will display as 1.12 and 100.456 will display as 100.
  • Display name — Lets you set the display title of all fields
  • color scheme — You can specify a single color, or select a continuous (gradient) color schemes, based on a value.
  • Value mapping
  • Thresholds — you can set the threshold value also you can set the color based on the threshold value
  • Data link — similar to panel link where it will open new dashboard once you click on displayed data on panel

Add new row in dashboard

  • Click on Add and then Row option
  • You can visualize the data based on the time range
  • You can add tag for dashboard this will help to filter out the dashboard easily, go to dashboard settings → General → Add tag → save dashboard
  • When you’ve finished editing your panel, click Save to save the dashboard.
  • Alternatively, click Apply if you want to see your changes applied to the dashboard first. Then click the save icon in the dashboard header.

How to add variables in grafana dashboard

  • Go to dashboard settings → variables → add variable → add N no of variable as per the requirement

Thanks for reading!!!!!!!!!

--

--