Forum Discussion

Ramanan16's avatar
Ramanan16
Copper Contributor
Jan 24, 2021

How to Monitoring RAM Size

Hi Team, 

I want to monitoring VM RAM size. So that if the RAM size got increased i will be notified. Is it possible?

4 Replies

  • ibnmbodji's avatar
    ibnmbodji
    Iron Contributor

    Ramanan16 

     

    Hi 

    You can display, monitor and configuring alerts by using VM Insights 

     

    First of all you will need a log analytics workspace  . 

    Once you have deployed the log analytics resource . 

    Go to your VM blade  in Monitoring click on Insights then enable

    Next select the log analytics you just create and click on  enable 

    Once your VM is connected you will be able to do some queries . 

    You can select default queries for virtual machines and run it .

    Once the query is completed you can see +New alert rule  button . 

    CLick on it and you will able to configure the condition and the actions ( send to email sms ...)

    Health (preview)  feature which is also interesting since you can enable directly alerts status.

    All of the steps can be automated with powershell 

    https://github.com/infeeny/VMInsights/blob/master/VMInsights.ps1

    Log search Example : 

    // Virtual Machine available memory 
    // Chart the VM's available memory over time. 
    // To create an alert for this query, click '+ New alert rule'
    Perf
    where ObjectName == "Memory" and
    (CounterName == "Available MBytes Memory" or // the name used in Linux records
    CounterName == "Available MBytes") // the name used in Windows records
    |  summarize avg(CounterValue) by bin(TimeGenerated, 15min), Computer, _ResourceId // bin is used to set the time grain to 15 minutes
    render timechart

     

    https://docs.microsoft.com/en-us/azure/azure-monitor/insights/vminsights-configure-workspace

    https://docs.microsoft.com/en-us/azure/azure-monitor/insights/vminsights-health-overview

    • Ramanan16's avatar
      Ramanan16
      Copper Contributor

      ibnmbodji 

      Thanks for your time and the details. But, the "Available Memory" metrics will show only the remaining unused Memory on the VM. It will not show the Total Memory on that VM. All i need is if the VM has 16GB RAM, i need to monitor it and should get the alert if the RAM size get upgraded or downgraded. 

      • ibnmbodji's avatar
        ibnmbodji
        Iron Contributor

        Ramanan16 

        Hi

        You cannot upgrade the memory without picking a new size for the VM . In this case you can use  native administrative signal logic and have condition like this to trigger an alert : 

        Whenever the Activity Log has an event with Category='Administrative', Signal name='Create or Update Virtual Machine (Microsoft.Compute/virtualMachines)'

        With Application Change analysis you can preview and see what was the old and new value for the size 

Resources