Blog Post

Azure Database for PostgreSQL Blog
6 MIN READ

Scale Monitoring with Azure PostgreSQL Multi-Resource Alerts

varun-dhawan's avatar
varun-dhawan
Icon for Microsoft rankMicrosoft
Jul 06, 2023

Keeping an eye on the performance of your applications and services is paramount to ensuring their smooth operation, especially when these services are mission-critical and scale over time. Azure Database for PostgreSQL Flexible Server now supports multi-resource metric alerts in Azure Monitor, a feature that greatly assists in scaling your monitoring process. For a complete list of the metrics available for monitoring in Azure Database for PostgreSQL Flexible Server, you can refer to our Monitor Metrics documentation.

As your operations grow, managing individual alerts for each resource can be overwhelming. In response to this, we're excited to introduce our new feature - multi-resource metric alerts. This feature greatly streamlines alert management by enabling you to monitor multiple resources simultaneously – such as a list of Azure Database for Postgres Flexible Server instances in same Azure region.

 

What are Azure Monitor Alerts?

 

Azure monitor alerts are an integral part of Azure's comprehensive monitoring and diagnostics solution. They provide a crucial line of communication, promptly notifying administrators when issues arise that require attention. These alerts are set up to automatically respond when certain conditions, defined by the user, are met. These conditions can be derived from various data sources within Azure Monitor, including metrics and logs. When a condition is met - for example, a specific error log appears more than a certain number of times, or a metric like CPU usage exceeding a set threshold - an alert is triggered.

 

Once an alert is triggered, it can initiate several potential automated actions. It might send an email or text message to the responsible party, initiate an Azure Function, call a webhook, or even trigger an ITSM, Logic App, or runbook automation, allowing teams to respond promptly to the issues.

Azure's New Multi-Resource Metric Alert Functionality

 

The new multi-resource metric alert functionality is an enhancement of Azure Monitor alerts, expanding its capacity to handle larger scale operations more efficiently. This feature simplifies the monitoring process by enabling the simultaneous monitoring of multiple resources, reducing the overhead and complexity involved in managing individual alerts.

With this feature, users can monitor multiple resources - such as a list of Azure Postgres Flexible Server instances in the same Azure region. For a more in-depth understanding of Azure Monitor Alerts, you can refer to Azure Monitor Alerts overview.

 

Key Advantages of Multi-Resource Metric Alerts

 

  • Accelerated alerting coverage: With only a few rules, you can monitor all virtual machines within your subscription. This feature automatically includes any new virtual machines deployed within the same Azure region.
  • Reduced rule management: The need for individual metric alerts for each resource is eliminated, significantly reducing management overhead.
  • Resource-specific notifications: Despite the consolidation, granular notifications for each resource remain, providing crucial data for issue diagnosis.
  • Simplified large-scale operations: Dynamic Thresholds paired with multi-resource metric alerts eliminate manual threshold setting for each virtual machine. This feature uses advanced machine learning to identify patterns, anomalies, and establish custom thresholds.

 

View multiple resource metrics in the Azure metrics explorer.

 

  1. Access Azure Portal: Start by logging into your Azure portal.
  2. Navigate to Monitoring: From the left-side menu, select "Monitoring" or search for "Monitor" in the search bar at the top of the Azure portal.
  3. Open Metrics Explorer: In the Azure Monitor, find and click on "Metrics" in the left-hand menu.
  4. Add a new metric: Click on "+ Add metric" at the top of the Metrics Explorer page. This will open the "Configure chart" panel.
  5. Set the Scope: In the "Configure chart" panel, you will see the "Scope" section at the top.
    • In the new panel, click on "Subscription" and choose the relevant Azure subscription that contains your PostgreSQL servers.
    • Next, click on "Resource type". From the drop-down menu, select "Azure Database for PostgreSQL servers".
    • Now, select each of the PostgreSQL servers you want to monitor. You can do this by clicking on the server names in the "Resource" box. As you click each server, it will be added to the scope for the metric.
    • Once you have selected all the servers you want to monitor, click "Apply" at the bottom of the panel to close it.

 

 

Note: The resources you select must be within the same resource type, location, and subscription. 
Resources that do not fit these criteria are not selectable.

 

  1. Choose the Metric: In the "Metric Namespace" box, leave the default selection ("All metrics"). In the "Metric" box, select "CPU Percent". This is the metric that will be tracked for the selected PostgreSQL servers.
  2. Configure the Chart: Under the "Aggregation" drop-down, you can choose how the metric data is aggregated. Options include "Average", "Minimum", "Maximum", and "Sum". For CPU Percent, "Average" is a viable choice. Set the "Time range" to the period over which you want to monitor the metric.

Setting up a multi-resource metric alert rule

  1. Access Azure Portal: Start by logging into your Azure portal
  2. Navigate to Monitoring: From the left-side menu, select "Monitoring" or search for "Monitor" in the search bar at the top of the Azure portal.
  3. Create New Alert Rule: Click on "Alerts" in the Monitor overview page, then select "+ New alert rule".
  4. Select Scope: Click on the "Select scope" option. In the "Select scope" panel that opens, navigate to the resource type, which in this case is "PostgreSQL servers". Here you can select multiple PostgreSQL servers.

 

 

Note: The resources you select must be within the same resource type, location, and subscription. 
Resources that do not fit these criteria are not selectable.
  1. Condition Settings: After you have selected the scope, click on "Add" in the condition box. This will open the "Configure signal logic" window. Here, you need to select the metric you are interested in. Each PostgreSQL server has its own set of metrics you can choose from.
  2. Set Alert Details: After choosing your metrics, set your alert logic by choosing the operator and threshold values. You can also set the evaluation based on a count, such as the number of times the condition must be met within a time window.
  3. Define Alert Details: After setting the conditions, define the alert rule details. This includes giving the alert a name, description, and severity.
  4. Set Up Action Group: In the "Actions" section, you will set up an action group. This group will be notified when the alert is triggered. If you have already set up an action group, you can select it, or you can create a new one.
  5. Create Alert Rule: After all these steps, review your settings and click on "Create alert rule". The alert rule will then be created, and Azure will start evaluating it based on the conditions and scope you have specified.

 

 

Remember that it might take some time for the alert rule to propagate through Azure and start evaluating your resources. Once it is active, you will start getting notified when the alert condition is met.

You can also use Azure Resource Manager (ARM) templates to deploy multi-resource metric alerts. Learn more in our documentation, “What Are Azure Monitor Alerts?

 

Multi-resource metric alert considerations

 

  • You can only set up multi-resource alerts to monitor metrics for the same type of resources that exist in the same Azure region. Individual notifications are sent for each monitored resource.
  • You must have Monitoring Reader permission at the subscription level to visualize metrics across multiple resources, resource groups, or a subscription. For more information, see Assign Azure roles using the Azure portal.

 

Pricing

 

The pricing for metric alert rules depends on the number of metric timeseries monitored by an alert rule, and this remains consistent for multi-resource metric alert rules.

 

In Closing

 

As we wrap up, we are excited to roll out this functionality, which significantly streamlines the management of metric alerts on a larger scale. Your perspective is highly valuable to us. We encourage you to share your thoughts on this feature and any suggestions for future enhancements. Do not hesitate to reach out to us via email using Ask Azure DB for PostgreSQL.

Remember, with the combination of Azure Database for PostgreSQL Flexible Server and Azure Monitor, monitoring at a large scale does not have to be a daunting task. Utilize these tools to turn the complexity of scale into an opportunity for efficient management and superior performance.

Updated Jul 07, 2023
Version 3.0
No CommentsBe the first to comment