Hi Angelius,
To create an alert for RAM usage >= 90% for 5 minutes in Azure, use Log Analytics and Azure Monitor. Azure doesn’t provide RAM metrics out of the box, but the Azure Monitor Agent (AMA) and Log Analytics Workspace (LAW) can achieve this.
Steps to Create RAM Usage Alert:
- Collect RAM Metrics:
- Ensure the VM is onboarded to a Log Analytics Workspace via AMA.
- Confirm your Data Collection Rule (DCR) includes
Memory\% Committed Bytes In Use
.
- Query RAM Usage in Logs:
- Use this KQL query in Logs under Azure Monitor:
Perf | where ObjectName == "Memory" and CounterName == "% Committed Bytes In Use" | summarize AvgValue = avg(CounterValue) by bin(TimeGenerated, 5m) | where AvgValue >= 90
- This query identifies average memory usage >= 90% over 5-minute intervals.
- Use this KQL query in Logs under Azure Monitor:
- Create a Log Analytics Alert:
- Go to Alerts > New Alert Rule.
- Select your Log Analytics Workspace as the resource.
- Under Condition, use Custom log search with the above KQL query.
- Set the alert logic to trigger if the query returns any result.
- Configure an Action Group (AG) to send notifications.
- Insights, Metrics, and Logs Relationship:
- Insights shows an overview of data collected via AMA.
- Metrics doesn’t natively support RAM usage but offers basic CPU/memory stats.
- Logs allows granular queries via KQL for performance data.
References
If this resolves your question, please accept the answer.
Luis