Monitoring disk usage is one of the most basic and critical tasks that Azure administrators should always be doing. Filled to capacity disks cause major outages.
This article will show how Netreo will notify users when their Windows servers run out of disk space. We will also discuss simple ways to automatically cleanup disks when space runs out.
New readers of this blog should familiarize themselves with Netreo – one of the best products dedicated to monitoring and automation of a vast variety of Azure services.
Alerting on low disk space
Latest versions of Netreo server monitoring profiles come pre-configured with a special metric called DiskFreeSpace. This is a special “collection” metric that tracks free space in megabytes for each individual drive.
When displayed on the dashboard, data looks similar to this
Alongside this metric, there is a pre-configured Low Disk Space alert that checks if any of the disks have less than 1024 MB of free space available. It is configured with a special expression that evaluates data in collection-based metrics: Any(DiskFreeSpace, “Value < 1024”). When this metric and alert are used by Netreo, users will get notified when any drives on their Azure VM drop below 1GB of free space. This alert, like everything else in Netreo, is fully configurable and adjustable.
Existing Netreo users can define this alert and metric as shown in the screenshots and replicate their definition to all VMs via the Template functionality
Cleaning up disks automatically
If you know specific folders that get filled up with unnecessary files, Netreo can be configured to automatically clean up such folders when disk space drops below a certain threshold. This is accomplished by defining a new Action that reacts to low disk space. Its expression can be something like Any(DiskFreeSpace, “Value < 1024 && Instance ==C:”””). This expression checks for C: drive being under 1GB of free space and should execute a clean-up PowerShell script on the VM. Alternatively