Skip to content

asheniam/azure-grafana-dashboard-templates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grafana dashboard templates for Microsoft Azure

This repository contains a collection of pre-built Grafana dashboard templates for Microsoft Azure resources. Use the armclient tool to automatically generate Grafana dashboards which you can import into your Grafana server.

For details on the armclient tool, please refer to the following:
https://github.com/asheniam/armclient

usage: armclient grafana --title=TITLE --datasource=DATASOURCE --resourcetype=RESOURCETYPE [<flags>]
  
Generate Grafana dashboard JSON files for given Azure resource type.

Flags:
  --help                       Show context-sensitive help (also try --help-long and --help-man).
  --config.file="sample-azure.yml"  
                               Azure configuration file
  --debug                      Debug flag
  --title=TITLE                This will be used as prefix in the dashboard title
  --datasource=DATASOURCE      The Azure Monitor data source name on Grafana
  --resourcetype=RESOURCETYPE  The Azure Resource Manager (ARM) resource type
  --kind=""                    The kind property on the Azure Resource Manager (ARM) resource type. This is optional.
  --maxdashboardresource=10    The max number of Azure resources to include in each dashboard. Default to 10.
  --maxcontinuation=10         The max number of continuations to follow when calling ARM API. Default to 10.

Prerequisite:

This assumes that you are familiar with Grafana and the Azure Monitor data source plugin. For more information, please refer to the following article:

https://docs.microsoft.com/en-us/azure/monitoring-and-diagnostics/monitor-send-to-grafana

How to use:

  1. Create a service principal which has Reader permission to access your Azure subscription. https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal

  2. Create armclient config file with service principal credentials.

Example: sample-azure.yml

Credentials:
  environment: public
  subscription_id: <subscriptionId>
  client_id: <clientId>
  client_secret: <clientSecret>
  tenant_id: <tenantId>
  1. Run armclient command line tool to generate Grafana dashboard JSON files.

You will need the name of the Azure Monitor data source on your Grafana server and the ARM resource type that you want to generate dashboards.

Example: ./armclient --config.file=sample-azure.yml grafana --title=production --datasource=AzureMonitorDataSource --resourcetype=microsoft.storage/storageaccounts

  • production = This string is added to the title of the generated Grafana dashboard
  • AzureMonitorDataSource = This is the name of the Azure Monitor data source on your Grafana server
  • microsoft.storage/storageaccounts = This is the Azure Resource Manager (ARM) resource type

The armclient tool will generate dashboard JSON files -- one for each region and one for all regions.

In the above example the following JSON files could be generated:

dashboard_production_microsoft_storage_storageaccounts_overview_allregions.json dashboard_production_microsoft_storage_storageaccounts_overview_eastus.json dashboard_production_microsoft_storage_storageaccounts_overview_southcentralus.json dashboard_production_microsoft_storage_storageaccounts_overview_westcentralus.json

  1. Import the dashboard JSON files into your Grafana server.

  2. Enjoy!

How to contribute

The armclient automatically pulls dashboard templates from this GitHub repository. To contribute new dashboard templates, please following the following instructions.

  1. On your Grafana server, create a dashboard for a given Azure Resource Manager (ARM) resource type. Note: In your dashboard, you should only select single Azure resource for each of the charts. The armclient tool will automatically replace all the Azure Monitor targets in the dashboard JSON using ARM resource IDs from the given Azure subscription.

  2. Export the dashboard to JSON. Save the JSON into a file called template.json.

  3. Anonymize the contents of template.json

  • Replace the data source name with {dataSourceName}
  • Replace the resource group name with {resourceGroupName}
  • Replace the resource name with {resourceName}
  1. Create the following directory structure: <ARM resource type>/<dashboard friendly name>

For example, if you are creating a dashboard specific to Azure Storage account latencies, you could create the following directory structure:

microsoft.storage/storageaccounts/latency

  1. In the new directory, create the following 3 files:
  • template.json : This is the dashboard template from step #3
  • dashboard.png : This is a sample screenshot of the dashboard.
  • README.md : This README contains the dashboard screenshot and a sample armclient command to generate the dashboard.
  1. Submit a pull request.

  2. After the pull request is merged, anyone who runs ./armclient grafana command for the given ARM resource type will generate dashboards using your template.

Releases

No releases published

Packages

No packages published