PeetersOnline.nl
Report vSphere Alarms with Powershell
Wow, vSphere vCenter Server has a lot of new alarms! Great for monitoring your environment. But a pain when it comes to documenting it. Thank God VMware for the PowerCLI! Just a few lines of code can do the documentation for you.
Here’s how:
# Report vSphere Alarms # by Hugo Peeters # www.peetersonline.nl #Region Variables $VCServer = "myVCServer" $Outfile = "D:\scripts\Alarms.txt" Connect-VIServer $VCServer $SI = Get-View ServiceInstance $AM = Get-View $SI.Content.AlarmManager $myCol = @() ForEach ($Folder in (Get-Folder)) { ForEach ($Alarm in ($AM.GetAlarm(($Folder|Get-View).MoRef))) { $Alarm = Get-View $Alarm $myObj = "" | Select Folder, Name, Description, Enabled, Summary $myObj.Folder = $Folder.Name $myObj.Name = $Alarm.Info.Name $myObj.Description = $Alarm.Info.Description $myObj.Enabled = $Alarm.Info.Enabled $myObj.Summary = $Alarm.Info.Expression.Expression | Out-String $myObj $myCol += $myObj } } $myCol | Where {$_.Enabled} | Out-File $Outfile ii $Outfile |
4 Responses to Report vSphere Alarms with Powershell
Tags
Active Directory API bind order cleanup cluster CPU Custom Fields datastores description device management directory tree errors Event Log file name filter Fun function HA IT known issues License Server LUN multipath NIC objects Oneliner portgroups PowerCLI PowerShell profile recursive Registry Scripts security session share snapshots SQL Stat VI Toolkit VMware vSphere WMI WSUS ZenArchives
- July 2012
- July 2011
- February 2011
- January 2011
- December 2010
- May 2010
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008





This is one of the features I have already included in the next version of my Daily Report, nice to see you posting again
Oops, sorry Alan, for not checking out your fantastic reporting scripts.
Not at all mate, its in V3 which is due to be released in the next couple of days, its all fair game, nice script !
Peeters..looks like this is the script I want but how do I execute it?
Sorry but new to powercli and I need to pull a reports of all the alarm definitions in vsphere vcenter server.
thanks