Skip to content

Latest commit

 

History

History
86 lines (65 loc) · 6.45 KB

monitor-accounts.md

File metadata and controls

86 lines (65 loc) · 6.45 KB
title description services documentationcenter author manager editor ms.assetid ms.service ms.workload ms.tgt_pltfrm ms.devlang ms.topic ms.date ms.author
Monitor Azure Cosmos DB requests and storage | Microsoft Docs
Learn how to monitor your Azure Cosmos DB account for performance metrics, such as requests and server errors, and usage metrics, such as storage consumption.
cosmos-db
mimig1
jhubbard
cgronlun
4c6a2e6f-6e78-48e3-8dc6-f4498b235a9e
cosmos-db
data-services
na
na
article
09/19/2017
mimig

Monitor Azure Cosmos DB

You can monitor your Azure Cosmos DB accounts in the Azure portal. For each Azure Cosmos DB account, a full suite of metrics is available to monitor throughput, storage, availability, latency, and consistency.

Metrics can be reviewed on the Account page, the new Metrics page, or in Azure Monitor.

View performance metrics on the Metrics page

  1. In the Azure portal, click More Services, scroll to Databases, click Azure Cosmos DB, and then click the name of the Azure Cosmos DB account for which you would like to view performance metrics.

  2. When the new page loads, in the resource menu, under Monitoring, click Metrics.

  3. When the Metrics page opens, select the collection to review from the Collection(s) drop-down.

    The Azure portal displays the suite of collection metrics available. Note that throughput, storage, availability, latency, and consistency metrics are provided on separate tabs. To get additional detail on the metrics provided, click on the double-arrow in the top right of each metrics pane.

    Screen shot of the Monitoring lens that shows the metrics suite

View performance metrics by using Azure Monitoring

  1. In the Azure portal, click Monitor on the left bar.
  2. In the resource menu, click Metrics.
  3. In the Monitor - Metrics window, in the Resource group drop-down menu, select the resource group associated with the Azure Cosmos DB account that you'd like to monitor.
  4. In the Resource drop-down menu, select the database account to monitor.
  5. In the list of Available metrics, select the metrics to display. Use the CTRL button to multi-select.

View performance metrics on the account page

  1. In the Azure portal, click More Services, scroll to Databases, click Azure Cosmos DB, and then click the name of the Azure Cosmos DB account for which you would like to view performance metrics.

  2. The Monitoring lens displays the following tiles by default:

    • Total requests for the current day.
    • Storage used.

    Screen shot of the Monitoring lens that shows the requests and the storage usage

  3. Clicking on the double-arrow in the top-right of the Requests tile opens a detailed Metric page.

  4. The Metric page shows you details about the total requests.

Set up alerts in the portal

  1. In the Azure portal, click More Services, click Azure Cosmos DB, and then click the name of the Azure Cosmos DB account for which you would like to set up performance metric alerts.

  2. In the resource menu, click Alert Rules to open the Alert rules page.
    Screen shot of the Alert rules part selected

  3. In the Alert rules page, click Add alert.
    Screenshot of the Alert Rules page, with the Add Alert button highlighted

  4. In the Add an alert rule page, specify:

    • The name of the alert rule you are setting up.
    • A description of the new alert rule.
    • The metric for the alert rule.
    • The condition, threshold, and period that determine when the alert activates. For example, a server error count greater than 5 over the last 15 minutes.
    • Whether the service administrator and coadministrators are emailed when the alert fires.
    • Additional email addresses for alert notifications.
      Screen shot of the Add an alert rule page

Monitor Azure Cosmos DB programmatically

The account level metrics available in the portal, such as account storage usage and total requests, are not available via the DocumentDB APIs. However, you can retrieve usage data at the collection level by using the DocumentDB APIs. To retrieve collection level data, do the following:

To access additional metrics, use the Azure Monitor SDK. Available metric definitions can be retrieved by calling:

https://management.azure.com/subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroup}/providers/Microsoft.DocumentDb/databaseAccounts/{DocumentDBAccountName}/metricDefinitions?api-version=2015-04-08

Queries to retrieve individual metrics use the following format:

https://management.azure.com/subscriptions/{SubecriptionId}/resourceGroups/{ResourceGroup}/providers/Microsoft.DocumentDb/databaseAccounts/{DocumentDBAccountName}/metrics?api-version=2015-04-08&$filter=%28name.value%20eq%20%27Total%20Requests%27%29%20and%20timeGrain%20eq%20duration%27PT5M%27%20and%20startTime%20eq%202016-06-03T03%3A26%3A00.0000000Z%20and%20endTime%20eq%202016-06-10T03%3A26%3A00.0000000Z

For more information, see Retrieving Resource Metrics via the Azure Monitor REST API. Note that "Azure Insights" was renamed "Azure Monitor". This blog entry refers to the older name.

Next steps

To learn more about Azure Cosmos DB capacity planning, see the Azure Cosmos DB capacity planner calculator.