Automation

 View Only
  • 1.  Alarm for VM Free space metric

    Posted Dec 07, 2010 12:51 PM

    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



  • 2.  RE: Alarm for VM Free space metric

    Posted Dec 07, 2010 07:14 PM

    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



  • 3.  RE: Alarm for VM Free space metric

    Posted Dec 07, 2010 08:08 PM

    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



  • 4.  RE: Alarm for VM Free space metric

    Posted Dec 07, 2010 08:42 PM

    Sorry, not sure I understand that question about reading the data.

    Can you elaborate ?

    ____________

    Blog: LucD notes

    Twitter: lucd22



  • 5.  RE: Alarm for VM Free space metric

    Posted Dec 07, 2010 10:04 PM

    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



  • 6.  RE: Alarm for VM Free space metric
    Best Answer

    Posted Dec 07, 2010 10:51 PM
      |   view attached

    Try the attached script.

    ____________

    Blog: LucD notes

    Twitter: lucd22

    Attachment(s)



  • 7.  RE: Alarm for VM Free space metric

    Posted Dec 08, 2010 09:28 AM

    thats awesome - thank you vewry much



  • 8.  RE: Alarm for VM Free space metric

    Posted Mar 22, 2012 01:28 PM

    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%)



  • 9.  RE: Alarm for VM Free space metric

    Posted Mar 22, 2012 03:02 PM

    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.



  • 10.  RE: Alarm for VM Free space metric

    Posted Mar 24, 2012 12:06 PM

    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 :smileyhappy: