Email Customization Reference
The following reference summarizes the semantics and component syntax of the pseudo-language used to define emails. The pseudo-language provides you with a simple, yet flexible way to customize email notifications. The following is a summary of pseudo-language conventions/limitations:
-
You can add comments (or any free-form text) using separate lines beginning with "--" or at end of lines.
-
You can use attributes.
-
You can use IF & ELSE & ENDIF control structures. You can also use multiple conditions using "AND" or "OR". Nested IF statements are not supported.
-
You can insert spaces for formatting purposes. Spaces at the beginning of a line will be ignored in the actual email. To insert spaces at the beginning of a line, use the [SP] attribute.
-
Use "/" to escape and "[" or "]" if you want to add attribute names, operators, or IF clauses to the actual email.
-
HTML is not supported.
Reserved Words and Operators
The following table lists all reserved words and operators used when modifying email scripts.
Table 6-1 Reserved Words and Operators
Reserved Word/Operator | Description |
---|---|
IF, ELSIF, ENDIF, ELSE |
Used in IF-ELSE constructs. |
AND, OR |
Boolean operators – used in IF-ELSE constructs only. |
NULL |
To check NULL value for attributes - used in IF-ELSE constructs only. |
| |
Pipe operator – used to show the first non-NULL value in a list of attributes. For example:
|
EQ, NEQ |
Equal and Not-Equal operators – applicable to NULL, STRING and NUMERIC values. |
/ |
Escape character – used to escape reserved words and operators. Escape characters signify that what follows the escape character takes an alternative interpretation. |
[ , ] |
Delimiters used to demarcate attribute names and IF clauses. |
Syntax Elements
Literal Text
You can specify any text as part of the email content. The text will be displayed in the email and will not be translated if the Oracle Management Services (OMS) language setting is changed. For example, ‘my Oracle Home' appears as ‘my Oracle Home' in the generated email.
Predefined Attributes
Predefined attributes/labels will be substituted with actual values in a specific context. To specify a predefined attribute/label, use the following syntax:
[PREDEFINED_ATTR]
Attribute names can be in either UPPER or LOWER case. The parsing process is case-insensitive.
A pair of square brackets is used to distinguish predefined attributes from literal text. For example, for a job email notification, the actual job name will be substituted for [EXECUTION_STATUS]
. For a metric alert notification, the actual metric column name will be substituted for [METIRC_COLUMN]
.
You can use the escape character “/" to specify words and not have them interpreted as predefined labels/attributes. For example, "/[NEW/]
" will not be considered as the predefined attribute [NEW]
when parsed.
Operators
EQ, NEQ
– for text and numeric values
NULL
- for text and numeric values
GT, LT, GE, LE
– for numeric values
Control Structures
The following table lists acceptable script control structures.
Table 6-2 Control Structures
Control Structure | Description |
---|---|
Pipe "|" |
Two or more attributes can be separated by ‘|' character. For example, In this example, only the applicable attribute within the current alert context will be used (replaced by the actual value) in the email. If more than one attribute is applicable, only the left-most attribute is used. |
IF |
Allows you to make a block of text conditional. Only one level of IF and ELSIF is supported. Nested IF constructs are not supported. All attributes can be used in IF or ELSIF evaluation using EQ/NEQ operators on NULL values. Other operators are allowed for “SEVERITY" and “REPEAT_COUNT" only. Inside the IF block, the values need to be contained within quotation marks “ ". Enterprise Manager will extract the attribute name and its value based on the position of “EQ" and other key words such as “and", “or". For example, [IF REPEAT_COUNT EQ “1" AND SEVERITY EQ “CRITICAL" THEN] The statement above will be true when the attributes of the alert match the following condition:
Example IF Block: [IF EXECUTION_STATUS NEQ NULL] [JOB_NAME_LABEL]=[EXECUTION_STATUS] [JOB_OWNER_LABEL]=[JOB_OWNER] [ENDIF] [IF SEVERITY_CODE EQ CRITICAL ] [MTRIC_NAME_LABEL]=[METRIC_GROUP] [METRIC_VALUE_LABEL]=[METRIC_VALUE] [TARGET_NAME_LABEL]=[TARGET_NAME] [KEY_VALUES] [ENDIF] Example IF and ELSEIF Block: [IF SEVERITY_CODE EQ CRITICAL] statement1[ELSIF SEVERITY_CODE EQ WARNING] statement2[ELSIF SEVERITY_CODE EQ CLEAR] statement3[ELSE] statement4[ENDIF] |
Comments
You can add comments to your script by prefacing a single line of text with two hyphens "--". For example,
-- Code added on 8/3/2009 [IF REPEAT_COUNT NEQ NULL] . . .
Comments may also be placed at the end of a line of text.
[IF SEVERITY_SHORT EQ W] -- for Warning alert
HTML Tags in Customization Content
Use of HTML tags is not supported.
When Enterprise Manager parses the email script, it will convert the “<" and “>" characters of HTML tags into encoded format (< and >). This ensures that the HTML tag is not treated as HTML by the destination system.
Examples
Email customization template scripts support three main operators.
-
Comparison operators: EQ/NEQ/GT/LT/GE/LELogic operators: AND/ORPipeline operator: |