What is Grafana
Grafana is an open-source platform that allows the creation of custom dashboards for data visualization, monitoring, and analysis. With a vast supply of data integrations available this tool can tap into your data quickly and efficiently. Within the dashboard, panels are used to represent specific metrics over a set-based timeframe. Panels have built-in drill-down capability and will span out into other panels by selection.
Grafana also offers plugins for those who desire more than the out of the box usage. One of my personal favorite plugins is the Worldmap. This panel works with geohash or geospatial data and can be used with time-series metrics. Combining this plugin with other graph or bars makes for an attractive dashboard.
Having built-in alerting features allows this tool to provide information when you are away. This type of alerting can be used when metrics fall outside of a given range. Very nice feature.
Supporting CI/CD deployments help get your dashboards through your environment we ease. Having configured deployments with Octopus Deploy and Azure DevOps, this works seamless and highly recommend utilizing this style of deployment.
What Grafana is not
This tool does not take the place of SSRS, PowerBI or other applications like them. Grafana is typically used as a quick visual that will give you insight into your data. This tool does not give the flexibility to randomly drill into cubes by selecting data points for explorations. It has table features to dump text data to screen but has limited functionality and I still prefer SSRS or PowerBI for large scale “non-dashboard” reporting.
Grafana is not a tool for data manipulation or maintenance screens. It is recommended that access to your database is read-only. Grafana does offer links to configure into the dashboard that may direct them to other reporting for a deeper look.
How to get it
Docker – Grafana has a docker image out there for download on docker hub. From what I have seen, they keep this image up to date with the latest versions. Very easy to grab it and start playing around with it.
Download – another easy option. Just need to download and install. Comes in a variety of flavors (Windows / Unix).
Grafana Cloud – At the time of this article, they offer a monthly subscription that includes data source of Prometheus and Graphite.
Open a browser, navigate and login to your instance. The default username and password is admin / admin
Configure your first data source
We will be configuring a SQL Server data source for our CPU metric demo. As mentioned above, Grafana can tap into a variety of data platforms while supporting the syntax for each respectively. Having this ability allows data to come together from across your services, products, and platforms while keeping quick analysis via dashboarding in one location. A huge win here!
Demo Scripts If you want to follow along, you can get the scripts for this demo here.
Click on Add Data Source
Chose a Data Source Type. Find Microsoft SQL Server
We will be connecting to a local SQL Server instance with a predefined user (Grafana) defaulting to a database named Monitoring.
Once you have filled in the connection information click Save and Test. You will see a green success message if the connection worked. You now have a data source available for use within your dashboards.
Create a Dashboard
Your next step is to create a new dashboard by selecting the Plus to sign in the upper left then select a dashboard.
Click Add Query
Select your data source
Add your query. In this case, Grafana will be calling a stored procedure and passing in a Node Id and two dates converted to Epoch format. The data that is returned will consist of CPU data and then a baseline average by the hour.
You should have something that looks like this
By editing the panel you can change the visualization by changing colors and other settings.
Before you jump in and start making changes, you should have an understanding of design theory.
If you are a photographer or artist, you may have read about the rule of thirds. This rule basically helps breakdown the layout into sections, both horizontally and vertically, so you have nine parts. By doing this, you now have a grid that helps you create pleasing visuals.
When defining colors within your charts you need to keep a few things in mind. This list will give you the necessary thoughts and tips to create eye-pleasing dashboards.
Branding – Use company colors when possible to keep the brand look and feel. Usually, the company logo will have most if not all the approved colors. Having this palette will give you a good starting point and may be able to deviate from there.
Natural Colors – People can relate to earthy tones and tend to respond better to when seeing them.
Highlight Important Information – Most dashboards are designed to highlight the key points like a decrease in revenue or abnormal spike in web traffic. Keep your colors in mind and pick one that stands out the most.
Color Science – There are deep meanings behind different colors and how people feel or respond to them. The following is based on people from the Western Hemisphere.
Red – Draws attention, recognized as a stimulant, causes a sense of emergency.
Orange – sparks controversy, mixed emotions with this color (love it or hate it)
Yellow – Happiness, optimism and carries the promise of a positive future. Has creative thoughts.
Green – most visible to the human eye, pervasive color to nature
Dark Green – tranquil and refreshing, cool and warm, peace and ecology
Blue – trustworthy, dependable and committed.
Purple - Balance of red and blue. sense of mystic, unrest often liked by eccentric types
Pink – Youthful, fun and exciting. High energy and happiness.
Brown – stable, reliability and approachability.
Grey – intellect, knowledge, and wisdom. carries authority
Black – authoritative and powerful, strong emotions, sophisticated
White – purity, cleanliness and neutrality. Emotionless and calm.
Don’t forget some people are color blind – color combos to avoid are green & red; green & brown; blue & purple; green & blue; light green & yellow; blue & grey; green & grey; green & black.
I added a few more graphs and gauges that display basically the same data with different formatting.
Have worked with several reporting tools on the market and gathering feedback from end-users, I truly find Grafana as an asset to the business and the technology toolbelt. The attractive look and feel, ease of use and drill in functionality have brought many accolades my way.
The ability to configure dashboards with multiple data sources, meeting both security requirements and built-in notifications, while supporting true DevOps deployment (CI/CD) gives this tool a center stage on an enterprise level.
It appears Grafana is gaining traction within the community and growing support has boosted this toolset in popularity. Having the ability to tie in cloud metrics has helped Grafana with their momentum.
As always, selecting the right tool for the job is the most important part of building products based on technology. I will say, if this tool fits, you will not be disappointed. Hope this gets you started and, on your way, to delivering impressive metrics for your end-users.
A Quick disclaimer
I wanted to say I do not work for Grafana and have no affiliation with the organization whatsoever. I also gain no financial benefit or endorsements from them and my opinions are solely just that. I have used the product now for a few years and this article is based on my experience with the tool, features, and enhancements.