Fewer false alerts: the VM status trigger understands planned operations, and the disk trigger thresholds are macros. Thanks to @pefol for both suggestions.
⚠️ Upgrading
Re-import both templates, Template_Windows_Hyper-V_VM_Guest_2.yaml first, then Template_Windows_Hyper-V_Host2.yaml. The script hyper-v-monitoring2.ps1 is unchanged, nothing has to be redeployed to the Hyper-V hosts.
Read "Behaviour changes" below before upgrading, three defaults changed.
Changed
VM status is not normal no longer fires during planned operations (#67). Hyper-V reports backups, checkpoint handling, storage migration, export, import and move in the VM status, so nightly backups raised a problem for every VM. Statuses matching the new macro {$VM.STATUS.IGNORE}, a regular expression, are ignored. The status also has to stay abnormal for {$VM.STATUS.DELAY} before the trigger fires.
Disk trigger thresholds are macros (#65). Latency, fragmentation and dynamic disk allocation were fixed in the trigger expressions and could not be tuned per host. The trigger names now show the configured threshold.
Odd poll intervals. The VM details interval defaults to 29 minutes instead of 10, and items polled every 5 minutes are polled every 7. An odd interval drifts against jobs on a fixed schedule, such as hourly backups or 5 minute replication, instead of always coinciding with them. On a host with 20 VMs the old 10 minute default started a PowerShell every 30 seconds.
Behaviour changes
- A real VM status fault alerts one poll later. With the default 45m delay and 29m interval the trigger needs two abnormal polls in a row. Set
{$VM.STATUS.DELAY}to1mto alert on the first abnormal poll, as before. - VM details refresh every 29 minutes instead of 10. This covers VM state, configuration, checkpoints and replication age on the VM hosts. Set
{$VM.DETAILS.INTERVAL}back to10mif you need the faster refresh. - Renamed triggers. Actions that filter on the old names of the latency, fragmentation or allocation triggers need adjusting.
Dynamic disk ... 100% allocatedbecameDynamic disk ... over 99% allocated. {$VM.STATUS.IGNORE}covers English status texts only. On a Hyper-V host in another language, look up the wording in the itemVM status (host language)while such an operation runs and add it to the macro. Never set the macro to an empty value, that matches everything and silences the trigger; use^$to ignore nothing.
New macros
| Macro | Default | Purpose |
|---|---|---|
{$VM.STATUS.IGNORE}
| planned operations | Regular expression for VM statuses the status trigger ignores. |
{$VM.STATUS.DELAY}
| 45m
| How long the status has to stay abnormal before the trigger fires. |
{$VM.DISK.LATENCY.CHECK}
| 1
| Set to 0 to switch off both disk latency triggers.
|
{$VM.DISK.LATENCY.WARN}
| 0.015
| Latency in seconds for the warning trigger. |
{$VM.DISK.LATENCY.HIGH}
| 0.025
| Latency in seconds for the higher severity trigger. |
{$VM.DISK.FRAGMENTATION.WARN}
| 20
| Fragmentation in percent, warning. |
{$VM.DISK.FRAGMENTATION.AVERAGE}
| 50
| Fragmentation in percent, average. |
{$VM.DISK.FRAGMENTATION.HIGH}
| 80
| Fragmentation in percent, highest tier. |
{$VM.DISK.ALLOCATED.WARN}
| 80
| Dynamic disk allocation in percent, warning. |
{$VM.DISK.ALLOCATED.FULL}
| 99
| Dynamic disk allocation in percent, counts as full. |
The discovered VM hosts do not inherit macros from the Hyper-V host. Set a macro on a single VM host, or on the VM host prototype of a Hyper-V host's discovery rule for all its VMs.