Skip to content

Commit 65bcf38

Browse files
authored
Merge pull request #224249 from EdB-MSFT/prometheus-workbooks
Prometheus workbooks
2 parents c03334b + bd8d56c commit 65bcf38

File tree

8 files changed

+85
-0
lines changed

8 files changed

+85
-0
lines changed
74.8 KB
Loading
89.5 KB
Loading
124 KB
Loading
71.4 KB
Loading
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
title: Query Prometheus metrics using Azure workbooks (preview)
3+
description: Query Prometheus metrics in the portal using Azure Workbooks.
4+
author: EdB-MSFT
5+
ms.topic: conceptual
6+
ms.date: 01/18/2023
7+
ms.author: edbaynash
8+
---
9+
10+
# Query Prometheus metrics using Azure workbooks (preview)
11+
12+
Create dashboards powered by Azure Monitor managed service for Prometheus using [Azure Workbooks](../visualize/workbooks-overview.md).
13+
This article introduces workbooks for Azure Monitor workspaces and shows you how to query Prometheus metrics using Azure workbooks and PromQL query language.
14+
15+
## Pre-requisites
16+
To query Prometheus metrics from an Azure Monitor workspace you need the following:
17+
- An Azure Monitor workspace. To create an Azure Monitor workspace see [Create an Azure Monitor Workspace](./azure-monitor-workspace-overview.md?tabs=azure-portal.md).
18+
- Your Azure Monitor workspace must be [collecting Prometheus metrics](./prometheus-metrics-enable.md) from an AKS cluster.
19+
- You have the **Monitoring Data Reader** role assigned for the Azure Monitor workspace.
20+
21+
> [!NOTE]
22+
> Querying data from an Azure Monitor workspace is a data plane operation. Even if you are an owner or have elevated control plane access, you still need to assign the Monitoring Data Reader role. For more information, see [Azure control and data plane](../../azure-resource-manager/management/control-plane-and-data-plane.md).
23+
24+
## Prometheus Explorer workbook
25+
Azure Monitor workspaces include an exploration workbook to query your Prometheus metrics.
26+
27+
1. From the Azure Monitor workspace overview page, select **Workbooks**
28+
29+
1. In the Azure Monitor workspace gallery, select the **Prometheus Explorer** workbook tile.
30+
31+
![Screenshot that shows Azure Monitor workspace gallery.](./media/prometheus-workbooks/prometheus-gallery.png)
32+
33+
A workbook has the following input options:
34+
- **Time Range**. Select the period of time that you want to include in your query. Select **Custom** to set a start and end time.
35+
- **PromQL**. Enter the PromQL query to retrieve your data. For more information about PromQL, see [Querying Prometheus](https://prometheus.io/docs/prometheus/latest/querying/basics/#querying-prometheus).
36+
- **Graph**, **Grid**, and **Dimensions** tabs. Switch between a graphic, tabular and dimensional view of the query output.
37+
38+
![Screenshot that shows PromQL explorer.](./media/prometheus-workbooks/prometheus-explorer.png)
39+
40+
## Create a Prometheus workbook
41+
42+
Workbooks supports many visualizations and Azure integrations. For more information about Azure Workbooks, see [Creating an Azure Workbook](../visualize/workbooks-create-workbook.md).
43+
44+
45+
46+
1. From your Azure Monitor workspace select **Workbooks**.
47+
48+
1. Select **New**.
49+
1. In the new workbook, select **Add**, and select **Add query** from the dropdown.
50+
:::image type="content" source="./media/prometheus-workbooks/prometheus-workspace-add-query.png" alt-text="A screenshot showing the add content dropdown in a blank workspace.":::
51+
1. Azure Workbooks use [data sources](../visualize/workbooks-data-sources.md#prometheus-preview) to set the source scope the data they present. To query Prometheus metrics, select the **Data source** dropdown, and choose **Prometheus (preview)** .
52+
1. From the **Azure Monitor workspace** dropdown, select your workspace.
53+
1. Select your query type from **Prometheus query type** dropdown.
54+
1. Write your PromQL query in the **Prometheus Query** field.
55+
1. Select **Run Query** button.
56+
1. Select the **Done Editing** at the bottom of the section and save your work
57+
58+
![Screenshot that shows sample PromQL query.](./media/prometheus-workbooks/prometheus-query.png)
59+
60+
## Troubleshooting
61+
62+
If your workbook query does not return data:
63+
64+
- Check that you have Monitoring Data Reader role permissions assigned through Access Control (IAM) in your Azure Monitor workspace
65+
- Verify that you have turned on metrics collection in the Monitored clusters blade of your Azure Monitor workspace.
66+
67+
68+
## Next steps
69+
* [Collect Prometheus metrics from AKS cluster (preview)](./prometheus-metrics-enable.md)
70+
* [Azure Monitor workspace (preview)](./azure-monitor-workspace-overview.md)
71+
* [Use Azure Monitor managed service for Prometheus (preview) as data source for Grafana using managed system identity](./prometheus-grafana.md)

articles/azure-monitor/toc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,9 @@ items:
405405
- name: Rule groups
406406
displayName: Prometheus
407407
href: essentials/prometheus-rule-groups.md
408+
- name: Query Prometheus metrics in workbooks
409+
displayName: Prometheus
410+
href: essentials/prometheus-workbooks.md
408411
- name: Remote-write
409412
items:
410413
- name: Overview
102 KB
Loading

articles/azure-monitor/visualize/workbooks-data-sources.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Workbooks can extract data from these data sources:
2525
- [Azure resource health](#azure-resource-health)
2626
- [Azure RBAC](#azure-rbac)
2727
- [Change Analysis (preview)](#change-analysis-preview)
28+
- [Prometheus (preview)](#prometheus-preview)
2829

2930
## Logs
3031

@@ -173,6 +174,16 @@ To make a query control that uses [Application Change Analysis](../app/change-an
173174
> [!div class="mx-imgBorder"]
174175
> ![A screenshot that shows a workbook with Change Analysis.](./media/workbooks-data-sources/change-analysis-data-source.png)
175176
177+
178+
## Prometheus (preview)
179+
180+
With [Azure Monitor managed service for Prometheus](../essentials/prometheus-metrics-overview.md), you can collect Prometheus metrics for your Kubernetes clusters. To query Prometheus metrics, select **Prometheus** from the data source dropdown, followed by where the metrics are stored in [Azure Monitor workspace](../essentials/azure-monitor-workspace-overview.md) and the [Prometheus query type](https://prometheus.io/docs/prometheus/latest/querying/api/) for the PromQL query.
181+
![Screenshot that shows sample PromQL query.](./media/workbooks-data-sources/prometheus-query.png)
182+
183+
> [!NOTE]
184+
> Querying from an Azure Monitor workspace is a data plane action and requires an explicit role assignment of Monitoring Data Reader, which is not assigned by default
185+
> Learn more about [Azure control and data plane](../../azure-resource-manager/management/control-plane-and-data-plane.md)
186+
176187
## Next steps
177188

178189
- [Get started with Azure Workbooks](workbooks-getting-started.md)

0 commit comments

Comments
 (0)