VMware Cloud Community
Guv
Enthusiast
Enthusiast

Ventre Alarm list with noticiations

In Vsphere 4 ican i get list of all the alarms in virtual centre and more imprtantly can I include in the list the action and configuration,  I want to check for each alarm what the email notifications are and if they are correct.  Is that possible to do.

So Alarm name, action, confiiguartion.

Is this possible to do.

0 Kudos
2 Replies
LucD
Leadership
Leadership

Try something like this

Get-AlarmAction -ActionType SendEmail | 
Select
@{N="Alarm name";E={$_.AlarmDefinition.Name}},
@
{N="Email";E={[string]::Join(',',($_.To))}}

It will only list alarms that have an email action and display all email addresses.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
kattrap
Contributor
Contributor

Variation or b*stardization of LucD's (thank you thank you)

Errors on alarms not enabled I think (so pulling them out) and exporting the results to csv.

get-alarmdefinition -enabled $true | get-alarmaction -ActionType SendEmail | Select @{N="Alarm name";E={$_.AlarmDefinition.Name}}, @{N="Email";E={[string]::Join(',',($_.To))}} | export-csv c:\temp\alarms.csv

No issues with LucD's on a 5.1 VCSA or a 5.0 Win vCenter, but another 5.0 VCSA barfed on LucD's & worked with my script. Could be some other difference between the vCenters that caused it, but I'm going to assume it's all the disabled alarms from a 3rd party plugin.

Here's the error:

Get-AlarmAction : 3/8/2013 7:01:22 PM    Get-AlarmAction        Object reference not set to an instance of an object.
At line:1 char:16
+ Get-AlarmAction <<<<  -ActionType SendEmail | Select @{N="Alarm name";E={$_.AlarmDefinition.Name}}, @{N="Email";E={[string]::Join(',',($_.To))}}
    + CategoryInfo          : NotSpecified: (:) [Get-AlarmAction], ViError
    + FullyQualifiedErrorId : Client20_AlarmServiceImpl_GetAlarmAction_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.Alarm.GetAlarmAction

Message was edited by: kattrap - posted wrong error message the first time around

0 Kudos