Azure with Grafana Monitoring

Grafana-Visualize-Content-3

Posted By : Subramani Sundaram

Added :

No Comments


In this blog, you will learn how you can use Azure with Grafana Monitoring. Grafana allows you to query, visualize, alert on, and understand your metrics no matter where they are stored. Create, explore, and share dashboards with your team and foster a data-driven culture.

Uses of Grafana :

  1. Visualize → Fast and flexible visualizations with a multitude of options allow you to visualize your data any way you want.
  2. Dynamic Dashboards → Create dynamic & reusable dashboards with template variables that appear as dropdowns at the top of the dashboard.
  3. Explore Metrics → Explore your data through ad-hoc queries and dynamic drill-down. Split view and compare different time ranges, queries, and data sources side by side.
  4. Explore Logs → Experience the magic of switching from metrics to logs with preserved label filters. Quickly search through all your logs or streaming them live.
  5. Alerting → Visually define alert rules for your most important metrics. Grafana will continuously evaluate and send notifications to systems like Slack, PagerDuty, VictorOps, OpsGenie.
  6. Mixed Data Sources → Mix different data sources in the same graph! You can specify a data source on a per-query basis. This works for even custom data sources.
  7. Annotations → Annotate graphs with rich events from different data sources. Hover over events shows you the full event metadata and tags.
  8. Ad-hoc Filters → Ad-hoc filters allow you to create new key/value filters on the fly, which are automatically applied to all queries that use that data source.
Grafana-Monitoring-4

Azure Monitor Data Source For Grafana

Azure Monitor is the platform service that provides a single source for monitoring Azure resources. Application Insights is an extensible Application Performance Management (APM) service for web developers on multiple platforms and can be used to monitor your live web application — it will automatically detect performance anomalies.

The Azure Monitor Data Source plugin supports Azure Monitor, Azure Log Analytics and Application Insights metrics in Grafana.

Features

  • Support for all the Azure Monitor metrics
  • includes support for the latest API version that allows multi-dimensional filtering for the Storage and SQL metrics.
  • Automatic time grain mode which will group the metrics by the most appropriate time grain value depending on whether you have zoomed in to look at fine-grained metrics or zoomed out to look at an overview.
  • Application Insights metrics
  • Write raw log analytics queries, and select x-axis, y-axis, and grouped values manually.
  • Automatic time grain support
  • Support for Log Analytics (both for Azure Monitor and Application Insights)
  • You can combine metrics from both services in the same graph.

Install Grafana on macOS

Download and install

Before you begin, you must have Home-brew installed on your mac machine.

  1. On the Grafana download page, select the Grafana version you want to install.
  2. Select an Edition.
  • Open Source — Functionally identical to the enterprise version, but you will need to download the enterprise version if you want enterprise features.
  • Enterprise — Not currently available for Mac.

3. Click Mac.

4. Copy and paste the code from the installation page into your command line and run. It follows the pattern shown below.

brew update
brew install grafana

Start Grafana

Start Grafana using Home-brew services:

brew services start grafana

To upgrade Grafana, use the reinstall command:

brew update
brew reinstall grafana

Installing the Plugin on an Existing Grafana with the CLI

Grafana comes with a command line tool that can be used to install plugins.

  1. Upgrade Grafana to the latest version.
  2. Run this command: grafana-cli plugins install grafana-azure-monitor-datasource
  3. Restart the Grafana server.
  4. Open the browser at: http://localhost:3000 or http://your-domain-name:3000
  5. Login in with a user that has admin rights. This is needed to create data sources.
  6. To make sure the plugin was installed, check the list of installed data sources. Click the Plugins item in the main menu. Both core data sources and installed data sources will appear.

Installing the Plugin Manually on an Existing Grafana

If the server where Grafana is installed has no access to the Grafana.com server, then the plugin can be downloaded and manually copied to the server.

  1. Upgrade Grafana to the latest version.
  2. Get the zip file from Grafana.com: https://grafana.com/plugins/grafana-azure-monitor-datasource/installation and click on the link in step 1.
  3. Extract the zip file into the data/plugins subdirectory for Grafana.
  4. Restart the Grafana server
  5. To make sure the plugin was installed, check the list of installed data sources. Click the Plugins item in the main menu. Both core data sources and installed data sources will appear.

Configure the data source

The plugin can access metrics from both the Azure Monitor service and the Application Insights API. You can configure access to one service or both services.

  1. Accessed from the Grafana main menu, newly installed data sources can be added immediately within the Data Sources section. Next, click the “Add data source” button in the upper right. The data source will be available for selection in the Type select box.

2. Select Azure Monitor from the Type dropdown:

Azure-Monitor-Data-Source-5

3. In the name field, fill in a name for the data source. It can be anything. Some suggestions are Azure Monitor or App Insights.

4. If you are using Azure Monitor, then you need 4 pieces of information from the Azure portal (see link above for detailed instructions):

  • Tenant Id (Azure Active Directory -> Properties -> Directory ID)
  • Subscription Id (Subscriptions -> Choose subscription -> Overview -> Subscription ID)
  • Client Id (Azure Active Directory -> App Registrations -> Choose your app -> Application ID)
  • Client Secret ( Azure Active Directory -> App Registrations -> Choose your app -> Keys)

5. Paste these four items into the fields in the Azure Monitor API Details section:

Azure-Monitor-API-6

6. If you are also using the Azure Log Analytics service, then you need to specify these two config values (or you can reuse the Client Id and Secret from the previous step).

  • Client Id (Azure Active Directory -> App Registrations -> Choose your app -> Application ID)
  • Client Secret ( Azure Active Directory -> App Registrations -> Choose your app -> Keys -> Create a key -> Use client secret)

7. If you are are using Application Insights, then you need two pieces of information from the Azure Portal (see link above for detailed instructions):

  • Application ID
  • API Key

8. Paste these two items into the appropriate fields in the Application Insights API Details section:

Azure-Monitor-API-7

9. Test that the configuration details are correct by clicking on the “Save & Test” button:

Azure-Monitor-API-8

Alternatively on step 4 if creating a new Azure Active Directory App, use the Azure CLI:

az ad sp create-for-rbac -n "http://localhost:3000"
Azure-with-Grafana-Monitoring-9
Azure-with-Grafana-Monitoring-10

Once after all the details are passed on , we need to click on Save & Test and we must get this output below :

Azure-with-Grafana-Monitoring-11

Importing a Dashboard from the Grafana Dashboard :

  1. Click on the below website and then choose the Dashboards and we can choose any template that we wanted to do so .

Grafana Dashboards – discover and share dashboards for Grafana.Grafana.com provides a central repository where the community can come together to discover and share dashboards.grafana.com

2. Filter the Data Source as Azure monitor since we have used that as our Data Source.

Azure-Monitor-Data-Source-12

3. We can see these are the major reviewed and downloaded ones , so we can use this on our project.

Azure-Monitor-for-Containers-13

4. Click on any of these and then download the json file as export.

Azure-Monitor-14

5. Now we need to login to Grafana Dashboard and then we need to click on the Dashboard section and import the json file which we downloaded it.

Grafana-Dashboard-15

6. After importing we can see the Dashboard and its corresponding Data Source.

Grafana-Dashboard-16
Grafana-Dashboard-17

7. Now we can click on the Dashboard and then we can check the output from it.

Grafana-Dashboard-18

8. Here is the output of the same for the Azure VM’s that are monitored by the Azure monitor.

Azure-Monitor-19

9. Here is the output for the same for the Mongo DB monitored by the Azure monitor.

Azure-Monitor-MongoDB-19

Similarly we have some many Data sources and we can make use of this Grafana as much as we can.

Grafana-Dashboard-20
Grafana-Dashboard-21

Here are some of the examples of the Grafana Dashboards .

Grafana-Monitoring-Dashboard-23

Start Learning Azure DevOps today with our eLearning Video Course.

Recommended Courses

VILT & Self-Paced

AZ-204 Developing Solutions for Microsoft Azure

This self-paced course will help you prepare for the Azure Developer certification exam AZ-204: Developing Solutions for Microsoft Azure.

Self-Paced

AZ-900: Microsoft Azure Fundamentals Tutorial

AZ-900: Microsoft Azure Fundamentals Tutorial provides foundational level knowledge on cloud concepts; core Azure services; security, privacy, compliance, and trust; and Azure pricing and support.

Self-Paced

AZ-400 Designing and Implementing Microsoft DevOps Solutions

This self-paced course will help you prepare for the Azure DevOps certification exam AZ-400: Designing and Implementing Microsoft DevOps Solutions.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments