0

I am trying to get the details for Data Disk attached to the particular VM. The Main purpose is to get notified when the disk space is highly utilized.

I can get the names of Data disks attached to the VM using below command, but not getting the details like Disk Size,Space allocated/Remaining disk space etc.

((get-azurermvm -resourcegroupname $vm.resourcegroupname -name $vm.name).StorageProfile).DataDisks

There is New-Azurermvmdatadisk, Set-Azurermvmdatadisk, but not something like Get-Azurermvmdatadisk

Can anyone help please how i can get the data disk details.

1

The existing cmdlets for Azure Compute will retrieve the MAX size of the data disk, but not the ACTUAL used size. I had raised a case with Microsoft and learned that this feature is not available yet. This is why we use monitoring solutions like OMS, datadog etc, that deploy their agents inside the Virtual Machine to pull detailed information like the one you asked.

0

This information is not available outside the VM; the hypervisor just doesn't have any way to know how many space the VM is actually using of the allocated disk size. This is BTW true for any hypervisor, be it Hyper-V (on which Azure is based), VMware or anything else.

In order to know how much space is actually used or free, you need to look inside the VM; you can use monitoring agents (such as those included in Azure), or even run a script which calls the PowerShell cmdlet Get-Volume.

There are several ways to run scripts inside an Azure VM, of which the easiest is probably Invoke-AzVMRunCommand in Azure PowerShell.

0

For Azure alert - we can setup log query based alerts. Run the query and then from there choose the option to configure alerts.

the below link talks about pulling data for all servers. http://winplat.in/azure/azure-log-query-to-find-disk-space-on-virtual-machine/

you can insert another line to filter for server

| where Computer contains "*SERVERNAME*"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.