Azure VM Monitoring Alert - When RAM 90% used

Angelius Mefyrx 20 Reputation points
2024-11-29T20:39:39.21+00:00

I'm trying to understand how to create an alert for a VM when the RAM is >= 90% used for 5 minutes to send to a group of people. Easy to say, easy to do using other monitoring tools but in Azure, this seem like mission impossible

In Monitoring you have the following sections: Insights, Alert, Metrics, Diagnostics Settings, Logs, Workbook

Just trying to understand how they tie together is something

The Metrics out of the box does not provide RAM usage %

I've created an MSVMI DCR tied to a LAW to gather some Insights on a VM. I can see the usage which is nice

I've created inside Alerts APR that triggers on warnings and AG to send to users. Now i need to create the Alerts that creates the warning for that RAM over used. Not sure how

I've created a Diagnostic Settings (not even sure its necessary sine MSVMI) tied to a storage to collect custom Metrics RAM which shows me the RAM too just like the DCR. It shows my Custom Metric under Guess (Classic) but therefor I cannot create an Alert based on this since it doesn't support Guess (Classic) Metrics

Now, there is that Logs menu that shows me a pile of query to poke the RAM using language KQL that i've never used but i'm assuming i have to use one of those templates there to try to create the alert of sort?

This is where i'm lost and the Microsoft support is of no use whatsoever

I'm trying to do something basic, can't even think when i'll try to monitor if an internal smtp is operational

Any guidance would be appreciate... i feel i'm missing a small thing there

Thanks in advance

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,658 questions
{count} votes

Accepted answer
  1. Luis Arias 8,621 Reputation points Volunteer Moderator
    2024-12-01T20:31:06.67+00:00

    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.
    • 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

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Angelius Mefyrx 20 Reputation points
    2024-12-03T19:56:34.73+00:00

    Hi, the command is now showing any result but i'll spend some time when i have some spare time to see how to resolve it, will come back here then Thank you Luis for the input so far

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.