Other Articles

Cosmos DB for PostgreSQL – Monitor CPU Utilization

This check ensures that CPU utilization is actively monitored for Azure Cosmos DB for PostgreSQL (Server Groups v2). Continuous monitoring helps maintain optimal database performance, supports capacity planning, and enables early detection of performance anomalies.

Check Details

  • Resource: Azure Cosmos DB for PostgreSQL
  • Check: Ensure CPU utilization Is Monitored
  • Risk: Without proper CPU monitoring, performance degradation, unexpected workload spikes, or resource exhaustion may go unnoticed, potentially leading to service disruption and reduced application availability.

Remediation via Azure Portal

  1. Log in to the Azure Portal. Azure Portal dashboard
  2. Navigate to Azure Cosmos DB for PostgreSQL and select the relevant server group. Azure Cosmos DB for PostgreSQL server groups
  3. Under Monitoring, select Metrics. Cosmos DB for PostgreSQL metrics blade
  4. From the metric drop-down menu, select CPU percent. Cosmos DB for PostgreSQL cpu utilization metrics
  5. Configure an Alert rule based on CPU utilization:
    • Click New alert rule.
    • Define an appropriate threshold (for example, greater than 80%).
    • Select an action group for notifications.
    Cosmos DB for PostgreSQL cpu utilization alerts
  6. Review and create the alert rule to enable proactive monitoring.

Remediation via Azure CLI

  1. Open Azure Cloud Shell or a local terminal with Azure CLI installed. Azure Cloud Shell
  2. Retrieve available CPU metrics for the server group:
    az monitor metrics list-definitions \
     --resource <resource-id> \
     --query "[?contains(name.value, 'cpu')]"
    
  3. Create a CPU utilization alert rule:
    az monitor metrics alert create \
     --name "HighCPUAlert" \
     --resource-group <resource-group> \
     --scopes <resource-id> \
     --condition "avg cpu_percent > 80" \
     --description "Alert when CPU utilization exceeds 80 percent" \
     --evaluation-frequency 5m \
     --window-size 5m
    
  4. Verify that the alert rule has been created:
    az monitor metrics alert list \
     --resource-group <resource-group> \
     --output table
    

Replace <resource-group> and <resource-id> with your actual values. The alert rule ensures CPU utilization is continuously monitored and appropriate action can be taken when thresholds are exceeded.