Description
In this article, we will see how to setup metrics alerts for BigAnimal clusters at Azure and metrics are forwarded to Azure Log Analytics.
Setup metrics alerts
1. First we can refer to document to get the available metrics and the database cluster ID. The document shows how to get the database cluster ID.
2. Next is to create the Azure Alert rule from the Azure Alert rules , as the BigAnimal instances collects a variety of metrics and makes the metrics available at your Azure subscription. You will see the page as shown below:
3. Click on the + Create option to create new alert rule as shown from above, which would bring up a new page as shown below:
4. Click on the Select resource to select the resource as the Log Analytics workspace, and filter by the location which the database cluster is at.
5. Next is to configure the condition when the alert rule should trigger. Click on the Add condition then choose Custom log search as shown below:
6. After click the Custom log search, it will bring up the new page of Configure signal logic:
7. You can design the alert logic based on Number of results or Metrics measurement, the document has more information.
Below shows an query example of metrics for a database cluster, "p-gjlmcos8n7" is the database cluster ID, "cnp_collector_up" is the metrics name.
DpMetrics_CL
| where Message has "cnp_collector_up"
| extend m = todynamic(Message)
| where m.labels.role == "primary" and m.labels.postgresql == "p-gjlmcos8n7"
Set the Azure alert logic as Number of results Equal to 0, it means if there is no metrics of "cnp_collector_up" for the database cluster, the alert will be triggered. It can indicate the monitoring problem or database cluster is unavailable which is critical.
8. Configure the Actions and following steps by following instructions shown at document.
Note
Above sample shows the alert based on no monitoring metrics for the database cluster, you can define alert logic based on metrics measurements, BigAnimal provides a wide set of metrics about Postgres instances as shown at the document.