How to setup azure alert when Disk Space is 90% for a windows VM

Xu, Bowen (Contractors) 20 Reputation points
2023-07-19T08:51:31.5466667+00:00

I'm trying to build an alert in Azure for my Windows VM.

How to set a warning alert mail in azure when the disk capacity reaches more than 90, I want to set this warning in each disk (C:,D:,E:.F: ) separately.

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

Accepted answer
  1. Monalla-MSFT 9,681 Reputation points
    2023-07-19T15:00:23.7666667+00:00

    @Xu, Bowen (Contractors) - Welcome to Microsoft Q&A and thanks for reaching out to us.

    With Azure Monitor for Virtual Machines, you can either do it in KQL with a query in the image and text below, using Azure Monitor for Virtual Machines Guest Health

    197823-diskfreespace.jpg

    InsightsMetrics
    | where Computer in (
    "DC10.na.contosohotels.com" // Windows
    )
    | where Namespace == "LogicalDisk"
    | where Name == "FreeSpacePercentage"
    | extend Disk=tostring(todynamic(Tags)["vm.azm.ms/mountId"])
    | summarize arg_max(TimeGenerated, *) by Disk, Computer
    | project TimeGenerated, Disk, Computer, Val
    | where Val > 90

    You can add more filters if needed and specify thresholds in Azure Monitor alerts rather than in KQL.

    Also there is another way to do it in portal using below:

    1. Portal -> Virtual Machines.
    2. Click on the "Disks" option in the left-hand menu.
    3. Select the disk you want to set the alert for.
    4. Click on the "Alerts" option and select New Alert.
    5. In the "Create rule" page, fill in the required info and under the "Condition" section, choose "Add metric condition and select the "Metric" you want to create an alert on. For example, select "Percentage used".
    6. Choose the appropriate "Aggregation type" and "Time window" for the metric.
    7. Set the "Threshold" type to "Static" and define a "Threshold value" of 90%.
    8. Click on the "Add action group" button to add an action group to the alert.
    9. Fill in the "Action group details"
    10. Configure an "Email/SMS/Push/Voice" action type.
    11. Click on the "Create alert rule" button to create the alert.

    Hope this helps.

    Hope this helps. and please feel free to reach out if you have any further questions.


    If the above response was helpful, please feel free to "Accept as Answer" and click "Yes" so it can be beneficial to the community.

    2 people found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful