|
| 1 | +--- |
| 2 | +title: Create a Grafana dashboard with Azure Managed Grafana |
| 3 | +description: Learn how to create and configure Azure Managed Grafana dashboards. |
| 4 | +author: maud-lv |
| 5 | +ms.author: malev |
| 6 | +ms.service: managed-grafana |
| 7 | +ms.topic: how-to |
| 8 | +ms.date: 01/02/2023 |
| 9 | +--- |
| 10 | + |
| 11 | +# Create a dashboard in Azure Managed Grafana |
| 12 | + |
| 13 | +In this guide, learn how to create a dashboard in Azure Managed Grafana to visualize data from your Azure services. |
| 14 | + |
| 15 | +A Grafana dashboard contains panels and rows. You can import a Grafana dashboard and adapt it to your own scenario, create a new Grafana dashboard, or duplicate an existing dashboard. |
| 16 | + |
| 17 | +> [!NOTE] |
| 18 | +> The Grafana UI may change periodically. This article shows the Grafana interface and user flow at a given point. Your experience may slightly differ from the examples below at the time of reading this document. If this is the case, refer to the [Grafana Labs documentation.](https://grafana.com/docs/grafana/latest/dashboards/) |
| 19 | +
|
| 20 | +## Prerequisites |
| 21 | + |
| 22 | +- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free). |
| 23 | +- An Azure Managed Grafana instance. If you don't have one yet, [create an Azure Managed Grafana instance](./quickstart-managed-grafana-portal.md). |
| 24 | +- Another existing Azure service instance with monitoring data. |
| 25 | + |
| 26 | +## Import a Grafana dashboard |
| 27 | + |
| 28 | +To quickly create a dashboard, import a dashboard template from the Grafana Labs website and add it to your Managed Grafana workspace. |
| 29 | + |
| 30 | +1. From the Grafana Labs website, browse through [Grafana dashboards templates](https://grafana.com/grafana/dashboards/?category=azure) and select a dashboard to import. |
| 31 | +1. Select **Copy ID to clipboard**. |
| 32 | +1. For the next steps, use the Azure portal or the Azure CLI. |
| 33 | + |
| 34 | + ### [Portal](#tab/azure-portal) |
| 35 | + |
| 36 | + 1. In the Azure portal, open your Azure Managed Grafana workspace and select the **Endpoint** URL. |
| 37 | + 1. In the Grafana portal, go to **Dashboards > Import**. |
| 38 | + 1. On the **Import** page, under **Import via grafana.com**, paste the Grafana dashboard ID copied earlier, and select **Load**. |
| 39 | + |
| 40 | + :::image type="content" source="media/create-dashboard/import-load.png" alt-text="Screenshot of the Grafana instance. Load dashboard to import."::: |
| 41 | + |
| 42 | + 1. Optionally update the dashboard name, folder and UID. |
| 43 | + 1. Select a datasource and select **Import**. |
| 44 | + 1. A new dashboard is displayed. |
| 45 | + 1. Review the visualizations displayed and edit the dashboard if necessary. |
| 46 | + |
| 47 | + ### [Azure CLI](#tab/azure-cli) |
| 48 | + |
| 49 | + 1. Open a CLI and run the `az login` command. |
| 50 | + 1. Run the [az grafana dashboard import](/cli/azure/grafana/dashboard#az-grafana-update)command and replace the placeholders `<AMG-name>`, `<AMG-resource-group>`, and `<dashboard-id>` with the name of the Azure Managed Grafana instance, its resource group, and the dashboard ID you copied earlier. |
| 51 | + |
| 52 | + ```azurecli |
| 53 | + az grafana dashboard import --name <AMG-name> --resource-group <AMG-resource-group> --definition <dashboard-id> |
| 54 | + ``` |
| 55 | +
|
| 56 | + --- |
| 57 | +
|
| 58 | +## Create a new Grafana dashboard |
| 59 | +
|
| 60 | +If none of the pre-configured dashboards listed on the Grafana Labs website fit your needs, create a new dashboard. |
| 61 | +
|
| 62 | +### [Portal](#tab/azure-portal) |
| 63 | +
|
| 64 | +1. In the Azure portal, open your Azure Managed Grafana workspace and select the **Endpoint** URL. |
| 65 | +1. In the Grafana portal, go to **Dashboards > New Dashboard**. |
| 66 | +1. Select one of the following options: |
| 67 | + - **Add a new panel**: instantly creates a dashboard from scratch with a first default panel. |
| 68 | + - **Add a new row**: instantly creates a dashboard with a new empty row. |
| 69 | + - **Add a panel from the panel library**: instantly creates a dashboard with an existing reusable panel from another instance you have access to. |
| 70 | +
|
| 71 | + :::image type="content" source="media/create-dashboard/from-scratch.png" alt-text="Screenshot of the Grafana instance. Create a new dashboard."::: |
| 72 | +
|
| 73 | +### [Azure CLI](#tab/azure-cli) |
| 74 | +
|
| 75 | +Run the [az grafana dashboard create](/cli/azure/grafana/dashboard#az-grafana-dashboard-create) command and replace the placeholders `<AMG-name>`, `<AMG-resource-group>`, `<title>`, and `<definition>` with the name of the Azure Managed Grafana instance, its resource group, a title and a definition for the new dashboard. The definition consists of a dashboard model in JSON string, a path or URL to a file with such content. |
| 76 | +
|
| 77 | +```azurecli |
| 78 | +az grafana dashboard create --name <AMG-name> --resource-group <AMG-resource-group> --title <title> --definition <definition> |
| 79 | +``` |
| 80 | + |
| 81 | +For example: |
| 82 | + |
| 83 | +```azurecli |
| 84 | +az grafana dashboard create --name myGrafana --resource-group myResourceGroup --title "My dashboard" --folder folder1 --definition '{ |
| 85 | + "dashboard": { |
| 86 | + "annotations": { |
| 87 | + ... |
| 88 | + }, |
| 89 | + "panels": { |
| 90 | + ... |
| 91 | + } |
| 92 | + }, |
| 93 | + "message": "Create a new test dashboard" |
| 94 | +}' |
| 95 | +``` |
| 96 | + |
| 97 | +--- |
| 98 | + |
| 99 | +## Duplicate a Grafana dashboard |
| 100 | + |
| 101 | +Duplicate a Grafana dashboard using your preferred method. |
| 102 | + |
| 103 | +### [Portal](#tab/azure-portal) |
| 104 | + |
| 105 | +To copy a Grafana dashboard: |
| 106 | + |
| 107 | +1. Open an existing dashboard in your Grafana instance |
| 108 | +1. Select **Dashboard settings** |
| 109 | +1. Select **Save as** |
| 110 | +1. Enter a new name and/or a new folder and select **Save** |
| 111 | + |
| 112 | + :::image type="content" source="media\create-dashboard\copy-dashboard.png" alt-text="Screenshot of the Grafana instance. Duplicate a dashboard."::: |
| 113 | + |
| 114 | +### [Azure CLI](#tab/azure-cli) |
| 115 | + |
| 116 | +1. Run the [az grafana dashboard show](/cli/azure/grafana/dashboard#az-grafana-dashboard-show) command to show the definition of the dashboard you want to duplicate, and copy the output. |
| 117 | + |
| 118 | + ```azurecli |
| 119 | + az grafana dashboard show --name <AMG-name> --resource-group <AMG-resource-group> --dashboard <dashboard-UID> |
| 120 | + ``` |
| 121 | +
|
| 122 | +1. Run the [az grafana dashboard create](/cli/azure/grafana/dashboard#az-grafana-dashboard-create) command and replace the placeholders `<AMG-name>`, `<AMG-resource-group>`, `<title>`, and `<dashboard-id>` with your own information. Replace `<definition>` with the output you copied in the previous step, and remove the `uid`and `id`. |
| 123 | +
|
| 124 | + ```azurecli |
| 125 | + az grafana dashboard create --name <AMG-name> --resource-group <AMG-resource-group> --title <title>--definition <definition> |
| 126 | + ``` |
| 127 | +
|
| 128 | + For example: |
| 129 | +
|
| 130 | + ```azurecli |
| 131 | + az grafana dashboard create --name myGrafana --resource-group myResourceGroup --title "My dashboard" --folder folder1 --definition '{ |
| 132 | + "dashboard": { |
| 133 | + "annotations": { |
| 134 | + ... |
| 135 | + }, |
| 136 | + "panels": { |
| 137 | + ... |
| 138 | + } |
| 139 | + }, |
| 140 | + "message": "Create a new test dashboard" |
| 141 | + }' |
| 142 | + ``` |
| 143 | +
|
| 144 | +--- |
| 145 | +
|
| 146 | +## Edit a dashboard panel |
| 147 | +
|
| 148 | +Edit a Grafana dashboard panel using your preferred method. |
| 149 | +
|
| 150 | +### [Portal](#tab/azure-portal) |
| 151 | +
|
| 152 | +To update a Grafana panel, follow the steps below. |
| 153 | +
|
| 154 | +1. Review the panel to check if you're satisfied with it or want to make some edits. |
| 155 | +
|
| 156 | + :::image type="content" source="media/create-dashboard/visualization.png" alt-text="Screenshot of the Grafana instance. Example of visualization."::: |
| 157 | +
|
| 158 | +1. In the lower part of the page: |
| 159 | + 1. **Query** tab: |
| 160 | + 1. Review the selected data source. If necessary, select the drop-down list to use another data source. |
| 161 | + 1. Update the query. Each data source has a specific query editor that provides different features and capabilities for that type of [data source](https://grafana.com/docs/grafana/v9.1/datasources/#querying). |
| 162 | + 1. Select **+ Query** or **+ Expression** to add a new query or expression. |
| 163 | +
|
| 164 | + :::image type="content" source="media/create-dashboard/edit-query.png" alt-text="Screenshot of the Grafana instance. Queries."::: |
| 165 | +
|
| 166 | + 1. **Transform** tab: filter data or queries, and organize or combine data before the data is visualized. |
| 167 | + 1. **Alert** tab: set alert rules and notifications. |
| 168 | +
|
| 169 | +1. At the top of the page: |
| 170 | + 1. Toggle **Table view** to display data as a table. |
| 171 | + 1. Switch between **Fill** and **Actual** to edit panel size |
| 172 | + 1. Select the time icon to update the time range |
| 173 | + 1. Select the visualization drop-down menu to choose a visualization type that best supports your use case. Go to [visualization](https://grafana.com/docs/grafana/latest/panels-visualizations/visualizations/) for more information. |
| 174 | +
|
| 175 | + :::image type="content" source="media/create-dashboard/panel-time-visualization-options.png" alt-text="Screenshot of the Grafana instance. Time, visualization and more options."::: |
| 176 | +
|
| 177 | +1. On the right hand side, select the **Panel options** icon to review and update various panel options. |
| 178 | +
|
| 179 | +## [Azure CLI](#tab/azure-cli) |
| 180 | +
|
| 181 | +Run the [az grafana dashboard update](/cli/azure/grafana/dashboard#az-grafana-dashboard-update) command and update the Grafana dashboard definition. |
| 182 | +
|
| 183 | +```azurecli |
| 184 | +az grafana dashboard update --name <AMG-name> --resource-group <AMG-resource-group> --definition <definition> |
| 185 | +``` |
| 186 | + |
| 187 | +--- |
| 188 | + |
| 189 | +## Next steps |
| 190 | + |
| 191 | +In this how-to guide, you learned how to create a Grafana dashboard. To learn how to manage your data sources, go to: |
| 192 | + |
| 193 | +> [!div class="nextstepaction"] |
| 194 | +> [Configure data sources](how-to-data-source-plugins-managed-identity.md) |
0 commit comments