Search the VMware Knowledge Base (KB)
View by Article ID

Using Custom Email Templates in vRealize Operations Manager 6.x (2125759)

  • 41 Ratings

Purpose

This article provide steps to create a custom email template to be used with alerts delivered through SMTP. It also provides command to view/delete the email templates.

Resolution

To create a custom email template:
  1. Navigate to Administration > Outbound Alert Settings, and verify that an outbound SMTP alert handler is created.
  2. Navigate to Content > Notifications, and verify that at least one notification rule is created that uses an outbound SMTP alert handler.
  3. Create a new email template by running a command similar to this on the Master node:
Note: In this example, the only change made from the default email template is that the subject has been changed to Email Template 1. Any of the parameters between {{}} can be changed. The name of the email template is set to Email Template 1 in this example, but can be set to any text string.

curl -k -X POST -i -H "X-vRealizeOps-API-use-unsupported: true" -H "Content-Type: application/json; charset=UTF-8" -u admin -d '{
"id" : null,
"name" : "Email Template 1",
"html" : true,
"template" : "$$Subject=[Email Template 1 Subject] State:{{AlertCriticality}}, Name:{{AffectedResourceName}} \n\n New alert was generated at: {{AlertGenerateTime}} Info: {{AffectedResourceName}} {{AffectedResourceKind}}<br> Alert Definition Name: {{AlertDefinitionName}} <br>Alert Definition Description: {{AlertDefinitionDesc}} <br>Object Name : {{AffectedResourceName}} <br>Object Type : {{AffectedResourceKind}} <br>Alert Impact: {{AlertImpact}} <br>Alert State : {{AlertCriticality}} <br>Alert Type : {{AlertType}} <br>Alert Sub-Type : {{AlertSubType}} <br>Object Health State: {{ResourceHealthState}} <br>Object Risk State: {{ResourceRiskState}} <br>Object Efficiency State: {{ResourceEfficiencyState}} <br>Symptoms:<br>{{Anomalies}} Recommendations: {{AlertRecommendation}} vROps Server - {{vcopsServerName}} <a href={{AlertSummaryLink}}>Alert details</a><br>",
"others" : [ ],
"otherAttributes" : {}
}' https://IP_Address/suite-api/api/notifications/email/templates


Note: Replace IP_Address with the IP address of the Master node.

You see output similar to:

HTTP/1.1 201 Created
Date: Thu, 16 Jul 2015 15:17:07 GMT
Server: Apache
X-Request-ID: H4TwONz7szSaDW9xFKG1aWYmQY2KdV8H
Transfer-Encoding: chunked
Content-Type: application/xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ops:email-template xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ops="http://webservice.vmware.com/vRealizeOpsMgr/1.0/" id="a573a29e-b06f-4fce-978c-b829fa3e0175" html="true"><ops:name>Email Template 1</ops:name><ops:template>$$Subject=[Email Template 1] State:{{AlertCriticality}}, Name:{{AffectedResourceName}}

New alert was generated at: {{AlertGenerateTime}} Info: {{AffectedResourceName}} {{AffectedResourceKind}}&lt;br&gt; Alert Definition Name: {{AlertDefinitionName}} &lt;br&gt;Alert Definition Description: {{AlertDefinitionDesc}} &lt;br&gt;Object Name : {{AffectedResourceName}} &lt;br&gt;Object Type : {{AffectedResourceKind}} &lt;br&gt;Alert Impact: {{AlertImpact}} &lt;br&gt;Alert State : {{AlertCriticality}} &lt;br&gt;Alert Type : {{AlertType}} &lt;br&gt;Alert Sub-Type : {{AlertSubType}} &lt;br&gt;Object Health State: {{ResourceHealthState}} &lt;br&gt;Object Risk State: {{ResourceRiskState}} &lt;br&gt;Object Efficiency State: {{ResourceEfficiencyState}} &lt;br&gt;Symptoms:&lt;br&gt;{{Anomalies}} Recommendations: {{AlertRecommendation}} vROps Server - {{vcopsServerName}} &lt;a href={{AlertSummaryLink}}&gt;Alert details&lt;/a&gt;&lt;br&gt;</ops:template></ops:email-template>

Note: Make a note of the id= value (for example, a573a29e-b06f-4fce-978c-b829fa3e0175).
  1. Get the alert types and sub-types by running this command on the Master node:
curl -k -X GET -i -H "Content-type: application/json" -H "X-vRealizeOps-API-use-unsupported: true" -u admin https://IP_Address/suite-api/api/alerts/types?ignoreLegacy=true

Note: Replace IP_Address with the IP address of the Master node.

You see output similar to:

HTTP/1.1 200 OK
Date: Thu, 16 Jul 2015 15:25:30 GMT
Server: Apache
X-Request-ID: tFrLAJ5Z3S5vJadHgNuqUgZYBFPHW8kT
Transfer-Encoding: chunked
Content-Type: application/xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ops:alert-types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ops="http://webservice.vmware.com/vRealizeOpsMgr/1.0/"><ops:alert-type id="15"><ops:name>Application Alerts</ops:name><ops:description>Application Alerts description</ops:description><ops:subTypes id="18"><ops:name>Availability</ops:name><ops:description>Availability description</ops:description></ops:subTypes><ops:subTypes id="19"><ops:name>Performance</ops:name><ops:description>Performance description</ops:description></ops:subTypes><ops:subTypes id="20"><ops:name>Capacity</ops:name><ops:description>Capacity description</ops:description></ops:subTypes><ops:subTypes id="21"><ops:name>Compliance</ops:name><ops:description>Compliance description</ops:description></ops:subTypes><ops:subTypes id="22"><ops:name>Configuration</ops:name><ops:description>Configuration description</ops:description></ops:subTypes></ops:alert-type><ops:alert-type id="16"><ops:name>Virtualization/Hypervisor Alerts</ops:name><ops:description>Virtualization/Hypervisor Alerts description</ops:description><ops:subTypes id="18"><ops:name>Availability</ops:name><ops:description>Availability description</ops:description></ops:subTypes><ops:subTypes id="19"><ops:name>Performance</ops:name><ops:description>Performance description</ops:description></ops:subTypes><ops:subTypes id="20"><ops:name>Capacity</ops:name><ops:description>Capacity description</ops:description></ops:subTypes><ops:subTypes id="21"><ops:name>Compliance</ops:name><ops:description>Compliance description</ops:description></ops:subTypes><ops:subTypes id="22"><ops:name>Configuration</ops:name><ops:description>Configuration description</ops:description></ops:subTypes></ops:alert-type><ops:alert-type id="17"><ops:name>Hardware (OSI) Alerts</ops:name><ops:description>Hardware (OSI) Alerts description</ops:description><ops:subTypes id="18"><ops:name>Availability</ops:name><ops:description>Availability description</ops:description></ops:subTypes><ops:subTypes id="19"><ops:name>Performance</ops:name><ops:description>Performance description</ops:description></ops:subTypes><ops:subTypes id="20"><ops:name>Capacity</ops:name><ops:description>Capacity description</ops:description></ops:subTypes><ops:subTypes id="21"><ops:name>Compliance</ops:name><ops:description>Compliance description</ops:description></ops:subTypes><ops:subTypes id="22"><ops:name>Configuration</ops:name><ops:description>Configuration description</ops:description></ops:subTypes></ops:alert-type><ops:alert-type id="18"><ops:name>Storage Alerts</ops:name><ops:description>Storage Alerts description</ops:description><ops:subTypes id="18"><ops:name>Availability</ops:name><ops:description>Availability description</ops:description></ops:subTypes><ops:subTypes id="19"><ops:name>Performance</ops:name><ops:description>Performance description</ops:description></ops:subTypes><ops:subTypes id="20"><ops:name>Capacity</ops:name><ops:description>Capacity description</ops:description></ops:subTypes><ops:subTypes id="21"><ops:name>Compliance</ops:name><ops:description>Compliance description</ops:description></ops:subTypes><ops:subTypes id="22"><ops:name>Configuration</ops:name><ops:description>Configuration description</ops:description></ops:subTypes></ops:alert-type><ops:alert-type id="19"><ops:name>Network Alerts</ops:name><ops:description>Network Alerts description</ops:description><ops:subTypes id="18"><ops:name>Availability</ops:name><ops:description>Availability description</ops:description></ops:subTypes><ops:subTypes id="19"><ops:name>Performance</ops:name><ops:description>Performance description</ops:description></ops:subTypes><ops:subTypes id="20"><ops:name>Capacity</ops:name><ops:description>Capacity description</ops:description></ops:subTypes><ops:subTypes id="21"><ops:name>Compliance</ops:name><ops:description>Compliance description</ops:description></ops:subTypes><ops:subTypes id="22"><ops:name>Configuration</ops:name><ops:description>Configuration description</ops:description></ops:subTypes></ops:alert-type></ops:alert-types>

Note: Alerts of type Virtualization/Hypervisor Alerts and sub-type Capacity are used in this example.

Make a note of the id= values associated with this Type/Sub-Type pairing.

<ops:alert-type id="16"><ops:name>Virtualization/Hypervisor Alerts</ops:name><ops:description>
<ops:subTypes id="20"><ops:name>Capacity</ops:name>

  1. Create an email condition that matches at least one alert type/sub-type pairing. Alerts of Type Virtualization/Hypervisor Alerts and Sub-Type Capacity is matched in this example by running a command similar to this on the Master node:
curl -k -X POST -i -H "X-vRealizeOps-API-use-unsupported: true" -H "Content-Type: application/xml" -u admin -d "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>
<ops:email-template-condition xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:ops=\"http://webservice.vmware.com/vRealizeOpsMgr/1.0/\">
<ops:alertType>16</ops:alertType>
<ops:alertSubType>20</ops:alertSubType>
<ops:alertStatus>NEW</ops:alertStatus>
<ops:emailAddress>sender@domain.com</ops:emailAddress>
<ops:emailAddress>recipient@domain.com</ops:emailAddress>
</ops:email-template-condition>" https://IP_Address/suite-api/api/notifications/email/templates/a573a29e-b06f-4fce-978c-b829fa3e0175/conditions

Note: Replace sender@domain.com with the address of the sender and recipient@domain.com with the address of the recipient and replace IP_Address with the IP address of the Master node.

You see output similar to:

HTTP/1.1 201 Created
Date: Thu, 16 Jul 2015 15:40:12 GMT
Server: Apache
X-Request-ID: JXx3TJoCjt0pi7szEMobejCrWihY39K3
Transfer-Encoding: chunked
Content-Type: application/xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ops:email-template-condition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ops="http://webservice.vmware.com/vRealizeOpsMgr/1.0/"><ops:alertType>16</ops:alertType>
<ops:alertSubType>20</ops:alertSubType><ops:alertStatus>NEW</ops:alertStatus></ops:email-template-condition>



To delete email conditions associated with an email template:
To delete an email template, run this command:

curl -k -X DELETE -i -H "X-vRealizeOps-API-use-unsupported: true" -H "Content-Type: application/xml" -u admin https://<vrops-node-ip>/suite-api/api/notifications/email/templates/<templateid>


Viewing the Templates and Template IDs:

curl -X GET -u user:"password" "https://IP_Address/suite-api/api/notifications/email/templates/"  
 
Viewing an individual Template:

curl -X GET -u user:"password" "https://IP_Address/suite-api/api/notifications/email/templates/TemplateID/"

Notes
  • Replace IP_Address with the IP address of the Master node.
  • There is no way to view which email conditions are associated with an email template.

See Also

Update History

09/23/2015 - Added vRealize Operations Manager 6.1 to the product list.

Request a Product Feature

To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.

Feedback

  • 41 Ratings

Did this article help you?
This article resolved my issue.
This article did not resolve my issue.
This article helped but additional information was required to resolve my issue.

What can we do to improve this information? (4000 or fewer characters)




Please enter the Captcha code before clicking Submit.
  • 41 Ratings
Actions
KB: