5.2 Reading and Mapping Ticket Templates

Table 5-1 illustrates the creation of a ticket using the default templates. This illustration will help you to read a ticket template. In the tables, * denotes a literal string and ** indicates whether the attribute applies.

Ticket creation mappings are the same for CASD_Default_Incident_AutoClose.xsl and CASD_Default_Incident.xsl.

Table 5-1 shows Service Desk ticket attributes and corresponding Enterprise Manager incident values for ticket creation mappings.

Table 5-1 Ticket Creation Mappings (for all templates)

Service Desk Ticket Attributes Enterprise Manager incident Attributes Value

Summary

Message

N/A

Description

For incidents:

EMUser - Notification rule owner when the ticket is created through auto-ticketing, and is the Enterprise Manager log-in user when the ticket is created through manual-ticketing.

Other Incident information includes:

Source Name

Source Owner - Example: Sysman

Source Type

Source SubType

Target Name

Target Type

Target URL

TargetProperties** - name:value pairs of defined target properties. For example:

Line of business:

Finance

Owner:

Finance-DB Team

Severity

Priority

Creation Date - Incident Creation Date

Last Updated Date

Owner - Incident Owner

Notification Rule Name

URL - URL to the metric details page in the context of the incident.

Incident Status

Incident Acknowledge Flag

Incident Auto Close

Incident Escalation Level

Values from incident context

Priority

Based on Severity Code

For metric incidents:

  • If severity is Fatal, set Priority to Medium-High (2).

  • If severity is Critical, set Priority to Medium (3).

  • If severity is Warning, set Priority to Medium-Low (4).

  • Otherwise, set Priority to Low (5).

Reported By

N/A

Administrator

Activity Log

Same content as the Description attribute.

See the Description attribute above.

z_em_connector_id (Custom field)

Connector GUID

Only set for the CASD Connector. This field is not set for the CASD No Publish Connector.

Table 5-2 shows Service Desk ticket attributes and corresponding Enterprise Manager alert incident attributes for ticket update mappings. The CASD_Default_Incident.xsl and CASD_Default_Incident_AutoClose.xsl mappings templates are almost identical. The only difference is in the status field. The AutoClose template sets it to CL, and the other template does not set the field. This difference is noted in the table.

Table 5-2 Ticket Updates (For All Templates)

Service Desk Ticket Attributes Enterprise Manager incident Attributes Value

Identifier

TicketID - Extracts only the internal identifier from the ticket id

N/A

Summary

Message

N/A

Description

Same content as the Description attribute for create transactions.

See Table 5-1.

Priority

Based on Severity code.

JobStatus - Applies to job status events

For metric incidents:

  • If severity is Fatal, set Priority to Medium-High (2).

  • If severity is Critical, set Priority to Medium (3).

  • If severity is Warning, set Priority to Medium-Low (4).

  • Otherwise, set Impact to Low (5).

Status

For metric incidents:

Grace Period

Severity

For metric incidents:

If Grace Period is set to "Yes" set Status to Open (OP).

If an Autoclose template and Severity is set to Clear, set Status to Close (CL).

Otherwise do not set Status.

Activity Log

Same content as the Description attribute.

See Table 5-1.

z_em_connector_id (Custom field)

Connector GUID

Only set for the CASD Connector. This field is not set for the CASD No Publish Connector.

Use the mapping tables (Table 5-1 and Table 5-2) as a reference to read the XSLT file in Example 5-1.

Example 5-1 CASD_Default_Incident_AutoClose.xsl Source Code with Annotations

<?xml version='1.0' encoding='UTF-8'?>
<xsl:stylesheet version="1.0" 
              xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
              xmlns:ns0="http://xmlns.oracle.com/sysman/connector">
 
  <!--
This template creates an incident type ticket within CA Service Desk with default settings. On update, the ticket summary is updated with the latest event message and priority information as an activity log entry. 
  
  -->
  
  <xsl:template match="ns0:EMIncident">
    <xsl:choose>
      <xsl:when test="normalize-space(ns0:TicketID) = ''">
        <!-- EDIT THE TAG VALUES BELOW TO CHANGE HOW A CASD INCIDENT IS FILLED
              DURING INCIDENT CREATION -->    
        <iwaveaf:create xmlns:iwaveaf=
         "http://iwavesoftware.com/services/adapter-framework">
          <incident>
 
            <!-- Set the CASD Incident Priority-->
            <!--     Possible values for priority: -->
            <!--       1 = High                    -->
            <!--       2 = Medium-High             -->
            <!--       3 = Medium                  -->
            <!--       4 = Medium-Low              -->
            <!--       5 = Low                     -->
            <!--       None                        -->
            <xsl:choose>
              <xsl:when test="ns0:SystemAttributes/ns0:SeverityCode = 'FATAL'">  
                <priority>2</priority> <!-- CASD Medium-High -->
              </xsl:when>
              <xsl:when test="ns0:SystemAttributes/ns0:SeverityCode = 'CRITICAL'">  
                <priority>3</priority> <!-- CASD Medium -->
              </xsl:when>
              <xsl:when test="ns0:SystemAttributes/ns0:SeverityCode = 'WARNING'">  
                <priority>4</priority>  <!-- CASD Medium-Low -->
              </xsl:when>
              <xsl:otherwise>
                <priority>5</priority> <!-- CASD Low -->
              </xsl:otherwise>
            </xsl:choose>
 
            <!-- Set the CASD Incident Description -->
            <description>
              <xsl:call-template name="getDescription">
                      <xsl:with-param name="message">Incident created by Oracle Enterprise
                Manager CA Service Desk Connector</xsl:with-param>    
                <xsl:with-param name="addHref">true</xsl:with-param>    
              </xsl:call-template>
            </description>
 
            <!-- Set the CASD Incident Reported By -->
            <!-- This field is defaulted to Administrator but can be changed to
              any to any valid -->
            <!-- CASD account. A lookup will be performed based on the first, 
              middle and last names. -->
            <customer>
              <firstName></firstName>
              <middleName></middleName>
              <lastName>Administrator</lastName>
            </customer>

            <!-- Set the CASD Incident Priority-->
            <!--     Possible values for priority: -->
            <!--       1 = High                    -->
            <!--       2 = Medium-High             -->
            <!--       3 = Medium                  -->
            <!--       4 = Medium-Low              -->
            <!--       5 = Low                     -->
            <!--       None                        -->
            <xsl:choose>
              <xsl:when test="ns0:SystemAttributes/ns0:SeverityCode = 'FATAL'">  
                <priority>2</priority> <!-- CASD Medium-High -->
              </xsl:when>
              <xsl:when test="ns0:SystemAttributes/ns0:SeverityCode = 'CRITICAL'">  
                <priority>3</priority> <!-- CASD Medium -->
              </xsl:when>
              <xsl:when test="ns0:SystemAttributes/ns0:SeverityCode = 'WARNING'">  
                <priority>4</priority>  <!-- CASD Medium-Low -->
              </xsl:when>
              <xsl:otherwise>
                <priority>5</priority> <!-- CASD Low -->
              </xsl:otherwise>
            </xsl:choose>
 
            <!-- Set the CASD Incident Description -->
            <description>
              <xsl:call-template name="getDescription">
                      <xsl:with-param name="message">Incident created by Oracle Enterprise
                 Manager CA Service Desk Connector</xsl:with-param>    
                <xsl:with-param name="addHref">true</xsl:with-param>    
              </xsl:call-template>
            </description>
 
            <!-- Set the CASD Incident Reported By -->
            <!-- This field is defaulted to Administrator but can be changed to
              any to any valid -->
            <!-- CASD account. A lookup will be performed based on the first,
              middle and last names. -->
            <customer>
              <firstName></firstName>
              <middleName></middleName>
              <lastName>Administrator</lastName>
            </customer>
 
            <!-- Set the CASD Incident Summary -->
            <summary><xsl:value-of
              select="ns0:SystemAttributes/ns0:Summary"/></summary>
 
            <!-- Add a CASD Activity log entry -->
            <logs>
              <log>
                <description>
                  <xsl:call-template name="getDescription">
                    <xsl:with-param name="message">Incident created by Oracle
                     Enterprise Manager CA Service Desk Connector</xsl:with-param>
                    <xsl:with-param name="addHref">false</xsl:with-param>    
                  </xsl:call-template>
                </description>
              </log>
            </logs>
 
<!-- Set the z_em_connector_id custom field in CASD to the EM event identifier. The custom field is required for the publishTicket operation and must be added by an CASD administrator -->
<!-- If the publishTicket operation is not going to be used, this code can be commented out. -->
            <extended-fields>
              <string-field name="z_em_connector_id"><xsl:value-of
                select="ns0:ConnectorGUID"/></string-field>
            </extended-fields>
 
        <!--  UNCOMMENT THE TAGS YOU WISH TO HAVE MODIFIED WHENEVER   -->
        <!--  THE INCIDENT IS CREATED, AND GIVE THEM DESIRED VALUES   --> 
 
            <!-- <status></status> -->
            <!--     Possible values for status: -->
            <!--         ACK (Acknowledged) -->
            <!--         CL (Closed) -->
            <!--         OP (Open) -->
            <!--         WIP (Work In Progress) -->
            <!--         AVOID (Avoided) -->
            <!--         FIP (Fix in Progress) -->
            <!--         CLREQ (Close Requested) -->
            <!--         KE (Known Error) -->
            <!--         CNCL (Cancelled) -->
            <!--         HOLD (Hold) -->
            <!--         CLUNRSLV (Closed-Unresolved) -->
            <!--         PRBAPP (Problem-Approved) -->
            <!--         PC (Problem-Closed) -->
            <!--         PF (Problem-Fixed) -->
            <!--         PRBANCOMP (Problem-Analysis Complete) -->
            <!--         PO (Problem-Open) -->
            <!--         RSCH (Researching) -->
            <!--         RE (Resolved) -->
            <!--         PRBREJ (Problem-Rejected) -->
 
            <!-- <impact></impact> -->
            <!--     Possible values for impact: -->
            <!--         1-Entire Organization -->
            <!--         2-Multiple Groups -->
            <!--         3-Single Group -->
            <!--         4-Small Group -->
            <!--         5-One person -->
            <!--         None -->
 
            <!-- <urgency></urgency> -->
            <!--     Possible values for urgency: -->
            <!--         1-As Possible -->
            <!--         2-Soon -->
            <!--         3-Quickly -->
            <!--         4-Very Quickly -->
            <!--         5-Immediate -->
 
            <!-- <severity></severity> -->
            <!--     Possible values for severity: -->
            <!--         1-Escalated -->
            <!--         2-Superviser Escal. -->
            <!--         3-Mgr Escal. -->
            <!--         4-HD Mgr Escalation -->
            <!--         5-All Hands Escalation -->
 
          </incident>
        </iwaveaf:create>
      </xsl:when>
      <xsl:otherwise>
        <iwaveaf:update xmlns:
          iwaveaf="http://iwavesoftware.com/services/adapter-framework">
          <incident>
            <identifier><xsl:value-of select=
              "normalize-space(substring-before(substring-after(ns0:TicketID,
                '('), ')'))"/></identifier>

            <!-- Set the CASD Incident Summary -->
            <summary><xsl:value-of select=
              "ns0:SystemAttributes/ns0:Summary"/></summary>
 
            <!-- Set the CASD Incident Description -->
            <description>
              <xsl:call-template name="getDescription">
                <xsl:with-param name="message">Incident updated by Oracle
                 Enterprise Manager CA Service Desk Connector</xsl:with-param>
                <xsl:with-param name="addHref">true</xsl:with-param>    
              </xsl:call-template>
            </description>
 
            <!-- Set the CASD Incident Priority-->
            <!--     Possible values for priority: -->
            <!--       1 = High                    -->
            <!--       2 = Medium-High             -->
            <!--       3 = Medium                  -->
            <!--       4 = Medium-Low              -->
            <!--       5 = Low                     -->
            <!--       None                        -->
            <xsl:choose>
              <xsl:when test="ns0:SystemAttributes/ns0:SeverityCode = 'FATAL'">  
                <priority>2</priority> <!-- CASD Medium-High -->
              </xsl:when>
              <xsl:when test="ns0:SystemAttributes/ns0:SeverityCode = 'CRITICAL'">  
                <priority>3</priority> <!-- CASD Medium -->
              </xsl:when>
              <xsl:when test="ns0:SystemAttributes/ns0:SeverityCode = 'WARNING'">  
                <priority>4</priority>  <!-- CASD Medium-Low -->
              </xsl:when>
              <xsl:otherwise>
                <priority>5</priority>  <!-- CASD Low -->
              </xsl:otherwise>
            </xsl:choose>
 
 
        <!--  UNCOMMENT THE TAGS YOU WISH TO HAVE MODIFIED WHENEVER   -->
        <!--  THE INCIDENT IS UPDATED, AND GIVE THEM DESIRED VALUES   --> 
 
            <!-- <status></status> -->
            <!--     Possible values for status: -->
            <!--         ACK (Acknowledged) -->
            <!--         CL (Closed) -->
            <!--         OP (Open) -->
            <!--         WIP (Work In Progress) -->
            <!--         AVOID (Avoided) -->
            <!--         FIP (Fix in Progress) -->
            <!--         CLREQ (Close Requested) -->
            <!--         KE (Known Error) -->
            <!--         CNCL (Cancelled) -->
            <!--         HOLD (Hold) -->
            <!--         CLUNRSLV (Closed-Unresolved) -->
            <!--         PRBAPP (Problem-Approved) -->
            <!--         PC (Problem-Closed) -->
            <!--         PF (Problem-Fixed) -->
            <!--         PRBANCOMP (Problem-Analysis Complete) -->
            <!--         PO (Problem-Open) -->
            <!--         RSCH (Researching) -->
            <!--         RE (Resolved) -->
            <!--         PRBREJ (Problem-Rejected) -->
 
            <!-- <impact></impact> -->
            <!--     Possible values for impact: -->
            <!--         1-Entire Organization -->
            <!--         2-Multiple Groups -->
            <!--         3-Single Group -->
            <!--         4-Small Group -->
            <!--         5-One person -->
            <!--         None -->
 
            <!-- <urgency></urgency> -->
            <!--     Possible values for urgency: -->
            <!--         1-As Possible -->
            <!--         2-Soon -->
            <!--         3-Quickly -->
            <!--         4-Very Quickly -->
            <!--         5-Immediate -->
 
            <!-- <severity></severity> -->
            <!--     Possible values for severity: -->
            <!--         1-Escalated -->
            <!--         2-Superviser Escal. -->
            <!--         3-Mgr Escal. -->
            <!--         4-HD Mgr Escalation -->
            <!--         5-All Hands Escalation -->
 
            <!-- <resolution>
                   <resolutionDate></resolutionDate>
                 </resolution> -->
            <!-- Resolution date must be formatted using the ISO 8601 format code.
                   -->
            <!--     Sample format: 2009-11-24T09:57:01Z -->
            <!--     Sample format: 2009-11-24T03:57:01-06:00 -->
 
            <xsl:choose>
              <xsl:when test="ns0:ReopenTicket = 'Yes'">
                <!-- Set the CASD Incident Status back to Open -->
                <status>OP</status>
 
                <!-- Add a CASD Activity log entry -->
                <logs>
                  <log>
                    <description>
                      <xsl:call-template name="getDescription">
                        <xsl:with-param name="message">Incident reopened by Oracle
                    Enterprise Manager CA Service Desk Connector</xsl:with-param>
                        <xsl:with-param name="addHref">false</xsl:with-param>    
                      </xsl:call-template>
                    </description>
                  </log>
                </logs>
              </xsl:when>
 
              <!-- Close the incident if the EM Severity is set to Clear. -->
              <xsl:when test="ns0:SystemAttributes/ns0:SeverityCode = 'CLEAR'">
                <!-- Set the CASD Incident Status to Closed -->
                <status>CL</status>
 
                <!-- Add a CASD Activity log entry -->
                <logs>
                  <log>
                    <description>
                      <xsl:call-template name="getDescription">
                        <xsl:with-param name="message">Incident closed by Oracle
                  Enterprise Manager CA Service Desk Connector</xsl:with-param>
                        <xsl:with-param name="addHref">false</xsl:with-param>    
                      </xsl:call-template>
                    </description>
                  </log>
                </logs>
              </xsl:when>
              
              <xsl:otherwise>
                <!-- Add activity log entry with a standard update message since
                   this is not a reopen.-->
                <logs>
                  <log>
                    <description>
                      <xsl:call-template name="getDescription">
                        <xsl:with-param name="message">Incident updated by Oracle
                   Enterprise Manager CA Service Desk Connector</xsl:with-param>
                        <xsl:with-param name="addHref">false</xsl:with-param>    
                      </xsl:call-template>
                    </description>
                  </log>
                </logs>
              </xsl:otherwise>
            </xsl:choose>
          </incident>
        </iwaveaf:update>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
 
  <xsl:template name="getDescription">
    <xsl:param name="message"/>
    <xsl:param name="addHref"/>
    
    <xsl:variable name="msg">
      <xsl:choose>
        <xsl:when test="normalize-space(ns0:SystemAttributes/ns0:UpdatedAttributes) != ''">
<xsl:value-of select="$message"/> for change in attributes : <xsl:value-of select="ns0:SystemAttributes/ns0:UpdatedAttributes"/>
        </xsl:when>
        <xsl:otherwise>
<xsl:value-of select="$message"/>
        </xsl:otherwise>
      </xsl:choose> 
    </xsl:variable>
    
<xsl:value-of select="$msg"/>.
-----------------------------------------------------------------------------------------
EM User: <xsl:value-of select="ns0:NotificationRuleOwner"/>
    
Incident Information:
<xsl:for-each select="ns0:SystemAttributes/ns0:SourceInfo"><xsl:text>&#xa;</xsl:text>    Source Name: <xsl:value-of select="./ns0:SourceObjInfo/ns0:ObjName" />
      <xsl:choose>
        <xsl:when test="normalize-space(./ns0:SourceObjInfo/ns0:ObjOwner) != ''">
    Source Owner: <xsl:value-of select="./ns0:SourceObjInfo/ns0:ObjOwner" />
        </xsl:when>
      </xsl:choose>
    Source Type: <xsl:value-of select="./ns0:SourceObjInfo/ns0:SourceObjType"/>
    Source SubType: <xsl:value-of select="./ns0:SourceObjInfo/ns0:SourceObjSubType"/>
    Target Name: <xsl:value-of select="./ns0:TargetInfo/ns0:TargetName"/>
    Target Type: <xsl:value-of select="./ns0:TargetInfo/ns0:TargetType"/>
    Target Type Label: <xsl:value-of select="./ns0:TargetInfo/ns0:TargetTypeLabel"/>
  <xsl:choose>
    <xsl:when test="$addHref = 'true' and ./ns0:TargetInfo/ns0:TargetURL != ''">
    Target URL: &lt;a href="<xsl:value-of select="./ns0:TargetInfo/ns0:TargetURL"/>" target="_blank"&gt;<xsl:value-of select="./ns0:TargetInfo/ns0:TargetURL"/>&lt;/a&gt;<xsl:text/>
    </xsl:when>
    <xsl:otherwise>
    Target URL: <xsl:value-of select="./ns0:TargetInfo/ns0:TargetURL"/>
    </xsl:otherwise>
  </xsl:choose> 
  <xsl:if test="position() &lt; last()">
    <xsl:text>&#xa;</xsl:text>
  </xsl:if>
</xsl:for-each>
<xsl:for-each select="ns0:SystemAttributes/ns0:SourceInfo/ns0:TargetInfo/ns0:TargetProperty">
  <xsl:if test="position() = 1">
    <xsl:text>&#xa;&#xa;    Target Properties:&#xa;</xsl:text>
  </xsl:if>
  <xsl:text>        </xsl:text><xsl:value-of select="./ns0:Name"/>: <xsl:value-of select="./ns0:Value"/>
      <xsl:if test="position() &lt; last()">
        <xsl:text>&#xa;</xsl:text>
      </xsl:if>
    </xsl:for-each>
<!-- EDIT THE FOLLOWING CODE TO LIST A SPECIFIC TARGET PROPERTY, SUCH AS "Line of Business"
        <xsl:choose>
          <xsl:when test="ns0:SystemAttributes/ns0:SourceInfo/ns0:TargetInfo/ns0:TargetProperty/ns0:Name='Line of Business'">
            Line of Business: <xsl:value-of select="ns0:ns0:SystemAttributes/ns0:SourceInfo/ns0:TargetInfo/ns0:TargetProperty/ns0:value"/>
          </xsl:when>
        </xsl:choose>
-->
    Severity: <xsl:value-of select="ns0:SystemAttributes/ns0:Severity"/>
    Priority: <xsl:value-of select="ns0:SystemAttributes/ns0:Priority" />
    CreationDate: <xsl:value-of select="ns0:SystemAttributes/ns0:CreationDate"/>
    LastUpdatedDate: <xsl:value-of select="ns0:SystemAttributes/ns0:LastUpdatedDate"/>
    Owner: <xsl:value-of select="ns0:SystemAttributes/ns0:Owner" />
    <xsl:choose>
      <xsl:when test="normalize-space(ns0:NotificationRuleName) != ''">
    Notification Rule: <xsl:value-of select="ns0:NotificationRuleName"/>
      </xsl:when>
    </xsl:choose>  
    <xsl:choose>
      <xsl:when test="$addHref = 'true' and ns0:SystemAttributes/ns0:IncidentURL != ''">
    URL: &lt;a href="<xsl:value-of select="ns0:SystemAttributes/ns0:IncidentURL"/>" target="_blank"&gt;<xsl:value-of select="ns0:SystemAttributes/ns0:IncidentURL"/>&lt;/a&gt;<xsl:text/>
      </xsl:when>
      <xsl:otherwise>
    URL: <xsl:value-of select="ns0:SystemAttributes/ns0:IncidentURL"/>
      </xsl:otherwise>
    </xsl:choose> 
    
    EM Incident Status: <xsl:value-of select="ns0:SystemAttributes/ns0:ResolutionState"/>
    EM Acknowledge: <xsl:value-of select="ns0:SystemAttributes/ns0:Acknowledge"/>
    EM Auto Close: <xsl:value-of select="ns0:SystemAttributes/ns0:AutoClose"/>
    EM Escalation Level: <xsl:value-of select="ns0:SystemAttributes/ns0:EscalationLevel"/>
 
    <xsl:for-each select="ns0:SystemAttributes/ns0:AdditionalDetails">
      <xsl:text>&#xa;    </xsl:text><xsl:value-of select="./ns0:VariableName"/>: <xsl:value-of select="./ns0:VariableValue"/>
    </xsl:for-each>
  </xsl:template>
 
</xsl:stylesheet>