i have a script that will show me the free space on the VM Guest OS disk
Get-VM | Where { $_.PowerState -eq "PoweredOn" } | Get-VMGuest | Select VMName -ExpandProperty Disks | Select VMName, Path, @{Name="DiskFreeGB";Expression={[math]::Round((($_.FreeSpace)/1GB),2)}}
I have seen that you can set up alarms though PCLI and was wondering if any has had a go at it with something like the above.
I don't really know where to start with it so any help would be great
chris
Try the attached script.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The triggers that are available to fire an alarm are either a performance metric, an event or a state.
See AlarmExpression.
Afaik none of these has an option to use the free disk space from a guest as a trigger.
But you can always run your script on a scheduler and send an email when the free space percentage exceeds a threshold.
You only will not be using the vCenter Alarms.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thanks for that - was hoping i had missed something
so scheduled task to run script
any advice on getting it to read the data rather than output to a file?
cheers
Chris
Sorry, not sure I understand that question about reading the data.
Can you elaborate ?
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
the current script outputs to a CSV file
i am not sure how to get the script to look at the data in that script and find those with free space under a threshold and send an email
cheers
chris
Try the attached script.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thats awesome - thank you vewry much
This subject is always interesting - servers running out of disk space. For a couple of weeks my collegue and I have been looking for at way to trigger an event in Virtual Center when one of the dearly beloved virtual machines runs low on free space.
This mail thread seems to show that this is not possible through Virtual Center - at least not in december 2010.
Now were running 5.0 so the question is if anything has changed here? Could it be that a new event has arrived saying "fireTriggerWhenVMisAbove80percent" so we can see it in Virtual Center as well as send a trap to HPO ?
We're looking at this from two different angles:
1) Fire an event (hopefully an snmp trap) when free space falls below an absolute value (say: 1 Gb)
2) Fire an event (again, in best case an snmp trap) when space falls below a relative value (say: 80%)
Afaik, vSphere 5 didn't bring any new triggers to do what you're looking at.
I think you could have better luck writing something in your monitor (HPO), that monitors the values you want to check regularly (with PowerCLI) and then raises an alarm in HPO.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
A speedy answer as always. Thank you.
We can get HPO to do it I am sure and we will be looking in that direction now.
The challenge of bending Virtual Center to my will and get the complete status of hosts and VMs in one view through VC must wait to another time