Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 206069

Re: Customize email alarm subject lines in vCenter Server 5.1.0?

$
0
0

This question seems to float around on a semi-regular basis.  I was also very frustrated by the formatting of the subject lines, and spent way too much time digging through databases, vmsg files, and dark corners of Google.  But I think I have it now.  I'm sure others have solved it before too, and I've gleaned ideas from many sources.  Credit goes to the pros.

 

Using powercli, you can create an alarm email action and customize the subject (and the body if you want).  You'll obviously need to have PowerCLI up and running and be comfortable with it.  Better programmers than I could write more robust code, and you use it at your own risk.  I've only used it with ESXi 5.0 / Vcenter 5.  But this might get you started, though you'll need to customize it with the alarm you're actually trying to modify.  Note that the variables inside brackets are case sensitive.  You can use:

{targetName}

{newStatus}

{oldStatus}

{target}

{eventDescription}

{alarmName}

{triggeringSummary}

{declaringSummary}

 

 

#Remove the existing action, and create a new email action with a custom subject line

$alarm="Virtual machine memory usage"

Get-AlarmDefinition $alarm | Get-AlarmAction | Remove-AlarmAction -Confirm:$false

Get-AlarmDefinition $alarm | New-AlarmAction -Email -To 'name@domain.dom' -Subject "[vAlarm] {targetName} memory is {newStatus}"

Get-AlarmDefinition $alarm | Get-AlarmAction -ActionType SendEmail | New-AlarmActionTrigger -StartStatus "Green" -EndStatus "Yellow"

Get-AlarmDefinition $alarm | Get-AlarmAction -ActionType SendEmail | New-AlarmActionTrigger -StartStatus "Red" -EndStatus "Yellow"

Get-AlarmDefinition $alarm | Get-AlarmAction -ActionType SendEmail | New-AlarmActionTrigger -StartStatus "Yellow" -EndStatus "Green"


Viewing all articles
Browse latest Browse all 206069

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>