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 CloudMonix 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 CloudMonix – 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 CloudMonix 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 CloudMonix, users will get notified when any drives on their Azure VM drop below 1GB of free space. This alert, like everything else in CloudMonix, is fully configurable and adjustable.
Existing CloudMonix 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, CloudMonix 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, such action can also be run on a schedule at regular intervals.
Keep in mind that defining clean-up PowerShell script is users’ responsibility, but the script can be as simple as DEL C:\TEMP\*.log /Q
Learn about these and other features of the product by visiting CloudMonix website and signing up for a free trial.
Leave A Comment