Grafana on Azure (part 1)

For long time now I have been searching for some kind of universal visualization tool that could pull data from many different sources and visualize them in eye pleasing but useful interface.

Ease of use and setup was very important to me, as well as large number of predefined dashboards. Grafana was next in line for trial, and I must say I am very happy how it is working out for me. Fact that there are pre-built images in Azure one also welcome bonus.

My use case for Grafana is two fold. I want to monitor some home networking and storage equipment such as Unifi switches, access points and gateways and Synology NAS. At the same time I want to access Azure Monitor and Azure Log Analytics data and visualize it in Grafana.

What is Grafana?

Grafana is open source visualization and analytics software. It allows you to query, visualize, alert on, and explore your metrics no matter where they are stored. In plain English, it provides you with tools to turn your time-series database (TSDB) data into beautiful graphs and visualizations.

https://grafana.com/docs/grafana/latest/getting-started/what-is-grafana/

I am using free of charge version which does have some limitations compared to payed one but those where minor for my use case.

Setup Grafana in Azure

I opted to use free official Grafana image from Azure marketplace as it was fastest and easiest way to deploy it. This image is intended to be used for testing and PoC scenarios.

After selecting Create option for Grafana marketplace item we need to fill in couple of attributes and that is it.

Make sure to fill correct values and remember any usernames and passwords. 🙂

Creating VM and deploying Grafana takes approximately 5 minutes. In my case I selected Standard DS2 v2 virtual machine which is probably overkill for me, but it is just PoC for now and I can reduce its size later on if needed.

Open http://<your hostname or IP address>:3000 and you will be presented with Grafana login screen. Initial username and password are Admin:Admin if you installed it from scratch. If you used Grafana image from Azure, username is Admin and password you set up in step one of creating VM from image.

Setup Azure monitor data source

There are multiple steps involved and you will have to have sufficient permissions in Azure portal and on Azure AD instance to complete these.

Setup Azure resources

  1. Go to Azure Portal – Azure Active Directory and select App registrations
  2. Select New registration and enter required data
    • Give it some meaningfull name
    • Leave Supported accounts as is
    • For Redirect URI you can enter anything (eg. https://localhost)
  3. Hit Register
  4. Go back to App registrations and select your app
  5. Select Certificates and secrets
  6. Create new secret
  7. Select Subscriptions
  8. Select your subscription
  9. Select Access control (IAM)
  10. Add – Add role assignment
    • Role – Reader
    • In the Select field search for application name you just regstered
  11. Select Save

I step 7 we gave our newly registered Azure AD application read access to all resources in our subscription.

Setup Azure monitor data source in Grafana

  1. Open your Grafana admin page and login
  2. Select Gear wheel and select Data Sources
  3. Select Azure Monitor data source
  4. Fill in required field for Azure monitor
    • Information such as Tenant ID, Client ID can be located in Azure portal where you created your Azure AD application
  5. Click Save and test

Azure Log Analytics API Details are optional but you can always add them later on.

Considering that your connection was successful, now we can finally add some dashboards to our Grafana.

Visualize Azure VM data in Grafana

Grafana community is very large and there are lots of interesting pre-configured dashboards to choose from. I just did a quick search on Azure topic and got about 30 dashboards.

In my case I was interested in Azure Virtual Machineby yesoreyeram.

Note the ID of this dashboard as we will need it in next steps.

  1. Go to Grafana admin page
  2. Select + sign on the left and select Import
  3. Paste plugin ID and select Load
    • Fill in required fields

At the time of this posting, dashboard had a small error in visualization of CPU Usage gauge. To fix it follow these steps:

  1. Hover over CPU usage gauge
  2. In drop down menu select Edit
  3. On the left select Visualizations if not already selected
  4. Select Gauge
  5. On top left select back arrow

After loading, this dashboard will give you options to choose some parameters such ads Subscription to view, resource group and VMs.

Here you can switch between different attributes. If you want to view same one with same selection of attributes every time you open dashboard, in the top right corner select Save icon and move Save current variables slider to On.

Now, you will have dashboard similar to this one.

In part 2 I will configure monitoring of Unifi devices and how to set up Unifi controller and Grafana to visualize data from all devices.

You May Also Like

About the Author: Marin

Started as trainer and administrator in Algebra, 5 years later became head of operating systems department at Algebra private college. At that time, he became IT Pro group lead and 5-year Microsoft MVP. Joined Microsoft in 2014. and after covering roles of Infrastructure and Azure TSP for 4 years, moved to Span to take the role of Senior Solutions Architect for cloud solutions. Currently holds Microsoft Azure MVP award. Personal time is occupied by enjoying short trips with his family and close friends, tinkering with home automation and networking and spending money on too many gadgets.

1 Comment

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.