I have scripted out setting all of our relevant alerts for trigger actions to email my distribution list but it doesn't seem to do anything in terms of Reset actions. I have looked through the commands and whenever I do Get-AlarmAction, it will show the SendEmail for the alert but not for the reset rule. Does anyone know how I can see the Reset Rules to add email notifications? Thanks in advance
I was able to configure the reset action using these commands:
Get-AlarmDefinition $alert | New-AlarmAction -Email -To $email -Subject $resolvedsub | New-AlarmActionTrigger -StartStatus Yellow -EndStatus Green
It would get the definition for the alarm, create a new email action for the alarm, and set it to the trigger of yellow back to green. I have verified within the Web console that the Reset Rule 1 now has the email configured in it on 6.7.
---------------------------------------------------------------------------------------------------------
Was it helpful? Let us know by completing this short survey here.
Could you post (a section of) your script?
Sure
#Connect to vCenter
Connect-VIServer $vcenter
#Gather list of alerts I want to configure and exclude vSAN, etc.
$novsanorimprove = Get-AlarmDefinition | where{($_.name -notlike "*vsan*") -and ($_.name -notlike "*virtual disk infrastructure namespace*") -and ($_.name -notlike "*virtual machine cpu usage*") -and ($_.name -notlike "*virtual machine memory usage*")}
#Loop through alerts and configure email action
foreach ($alert in $novsanorimprove)
{
$subject = $alert.name;
Get-AlarmDefinition $alert | New-AlarmAction -Email -To $emailaddress -Subject $subject
}
#Disconnect
Disconnect-VIServer -Force -Confirm:$false
Thanks for the script. But now I'm kinda confused about your initial question. You create a new alarm action with the email action and now you want to check your work? What about "Get-AlarmAction -ActionType SendEmail"?
No I do not need to check my work. The script only creates the email action for the alert trigger and does not do anything for the reset action. I would like to configure emailing during a reset action as well, like when the alarm conditions are no longer true indicating that the alert is resolved. Right now we only get the email for when an issue is detected, not resolved.
Ah I see... I'm afraid that is not possible. At least I don't think it's possible.
I was able to configure the reset action using these commands:
Get-AlarmDefinition $alert | New-AlarmAction -Email -To $email -Subject $resolvedsub | New-AlarmActionTrigger -StartStatus Yellow -EndStatus Green
It would get the definition for the alarm, create a new email action for the alarm, and set it to the trigger of yellow back to green. I have verified within the Web console that the Reset Rule 1 now has the email configured in it on 6.7.
---------------------------------------------------------------------------------------------------------
Was it helpful? Let us know by completing this short survey here.