Giter Club home page Giter Club logo

azure-grafana-dashboard-templates's Introduction

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.

azure-grafana-dashboard-templates's People

Contributors

asheniam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

azure-grafana-dashboard-templates's Issues

It Aint Working for some reason

Hey man,

Thanks for this great tool and I appreciate the time you have put investigating and building this.
Seems like a nice feature that should be included in the Azure plugin at the beginning.

Though running it as shown in the instructions, using on Mac with az cli 2 everything working + service principle etc. and in the end, it couldn't find the resource type in your git repo.
I tried modifying the parsing but couldn't manage to get it working. Can you please review.

resourcetype=microsoft.storage/storageaccounts # not found

Armclient docs

How do I run the armclient command - I dont know Go and struggling to even run a basic use case - feeling stopuid now lol

Thanks for any help

Importing generated JSON dashboards give all queries the same RefID ("A")

Since the queries are all marked as A, only the bottom query in the list gets visualised. It also throws an error saying "The subscription 'undefined' could not be found." even though the valid subscription is in each query.

To fix this, I have to directly edit the JSON for the panel. Is this a bug at your end or a Grafana limitation?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.