In my previous post, I talked about how we can enable and configure the ServiceNow connector in Oracle Enterprise Manager Cloud Control 13c and setup integration between the two. In this post, let us take a look at how to enable OEMCC to automatically create, update and resolve/ close tickets (incidents) in ServiceNow.

Pre-requisite

If not already, please ensure that the ServiceNow connector is enabled and functioning properly in OEM. You can refer to this post for a step-by-step instructions on how to set it up. You must also ensure that a list of all the required fields for the incident in ServiceNow is readily available.

Ticket Templates

The ServiceNow connector in OEMCC, comes with the following set of default inbound and outbound ticket templates which follows the eXtensible Stylesheet Language format to map fields and values between the two systems:

  • Create Ticket Response – Inbound
  • Get Ticket – Inbound
  • ServiceNow Create and Update – Outbound
  • ServiceNow Create, Update, and Close – Outbound
  • ServiceNow Create, Update, and Resolve – Outbound

Though Oracle has done a fantastic job with details in these templates, they must be modified or, at least updated for successful ticketing in ServiceNow. If your ServiceNow instance is not customized, you probably are going to be fine by just uncommenting the required fields and defining the corresponding values. For example, to add a caller, you can simply uncomment the following line in the template and provide the name of the user:

From:
 <!-- <caller_id>sample.user</caller_id> -->
To:
  <caller_id>itnoesis</caller_id>

Now, there are very high chances that your instance of ServiceNow is customized to a certain degree due to various organizational requirements and you will end up in creating your own ticket template.

Creating a customized ticket template

Though the default templates can be easily modified, it is strongly recommended to create a new one by taking an existing template as reference. Once a template is created, it must be registered with OEM using “emctl register_template connector” command.

Login to OEMCC and navigate to Setup –> Extensibility –> Management Connectors.

On the resultant page, from the list of configured connectors, click on the name of the ServiceNow Connector and on the “Configure Management Connector” page, click on “template” tab. For this post, we will be working with the template which enables creation, update and resolution of incidents. Click on the template named “ServiceNow Create, Update, and Resolve”, copy the contents of the template and paste into your favorite text editor. Alternatively, you can also export all the template to your workstation by navigating to Setup –> Extensibility –> Self Update –> Management Connector –> Open –> Actions –> Export to –> Your Workstation.

Based on the required incident fields in ServiceNow, uncomment the parameters and update with appropriate values. Typically, I have seen the following fields being updated for new as well as tickets which needs to be updated or, resolved. You might have to update additional fields based on your instance of ServiceNow.

<!-- <category>EM Incident</category> -->
<!-- <assigned_to>sample.user</assigned_to> -->
<!-- <assignment_group>EMSampleGroup</assignment_group> -->
<!-- <caller_id>sample.user</caller_id> -->
<!-- <location>Sample City</location> -->
<state>6</state>
<incident_state>6</incident_state>

Assigning tickets to different assignment_groups

Now, there can be multiple teams managing the environment and you might want to assign incidents to different groups within ServiceNow instead of sending all the incidents to a single assignment_group / queue.

A simple way to achieve this is by creating a sub-template for determining an assignment group in ServiceNow based on OEM target type. Below is the same code (modify based on your requirements) which can be added at the bottom of the ticket template and called during incident assignment instead of hard-coding the value.

<!-- Customized assignment group template -->

<xsl:template name="setAssignmentGroup">
        <xsl:choose>
          <xsl:when test="normalize-space(ns0:SystemAttributes/ns0:SourceInfo/ns0:TargetInfo/ns0:TargetType) = 'oracle_database'">
     	      <assignment_group>DBA-TEAM</assignment_group>
     	  </xsl:when>
          <xsl:when test="normalize-space(ns0:SystemAttributes/ns0:SourceInfo/ns0:TargetInfo/ns0:TargetType) = 'oracle_listener'">
     	     <assignment_group>DBA-TEAM</assignment_group>
          </xsl:when>
          <xsl:when test="normalize-space(ns0:SystemAttributes/ns0:SourceInfo/ns0:TargetInfo/ns0:TargetType) = 'cluster'">
            <assignment_group>DBA-TEAM</assignment_group>
          </xsl:when>
          <xsl:when test="normalize-space(ns0:SystemAttributes/ns0:SourceInfo/ns0:TargetInfo/ns0:TargetType) = 'has'">
            <assignment_group>DBA-TEAM</assignment_group>
          </xsl:when>
          <xsl:when test="normalize-space(ns0:SystemAttributes/ns0:SourceInfo/ns0:TargetInfo/ns0:TargetType) = 'oracle_dbmachine'">
            <assignment_group>DBA-TEAM</assignment_group>
          </xsl:when>
          <xsl:when test="normalize-space(ns0:SystemAttributes/ns0:SourceInfo/ns0:TargetInfo/ns0:TargetType) = 'oracle_dbsys'">
            <assignment_group>DBA-TEAM</assignment_group>
          </xsl:when>
          <xsl:when test="normalize-space(ns0:SystemAttributes/ns0:SourceInfo/ns0:TargetInfo/ns0:TargetType) = 'oracle_emrep'">
            <assignment_group>DBA-TEAM</assignment_group>
          </xsl:when>
          <xsl:when test="normalize-space(ns0:SystemAttributes/ns0:SourceInfo/ns0:TargetInfo/ns0:TargetType) = 'oracle_emsvrs_sys'">
            <assignment_group>DBA-TEAM</assignment_group>
          </xsl:when>
          <xsl:when test="normalize-space(ns0:SystemAttributes/ns0:SourceInfo/ns0:TargetInfo/ns0:TargetType) = 'oracle_exadata'">
            <assignment_group>DBA-TEAM</assignment_group>
          </xsl:when>
          <xsl:when test="normalize-space(ns0:SystemAttributes/ns0:SourceInfo/ns0:TargetInfo/ns0:TargetType) = 'oracle_exadata_dbsys'">
            <assignment_group>DBA-TEAM</assignment_group>
          </xsl:when>
          <xsl:when test="normalize-space(ns0:SystemAttributes/ns0:SourceInfo/ns0:TargetInfo/ns0:TargetType) = 'oracle_exadata_grid'">
            <assignment_group>DBA-TEAM</assignment_group>
          </xsl:when>
          <xsl:when test="normalize-space(ns0:SystemAttributes/ns0:SourceInfo/ns0:TargetInfo/ns0:TargetType) = 'oracle_oms'">
            <assignment_group>DBA-TEAM</assignment_group>
          </xsl:when>
          <xsl:when test="normalize-space(ns0:SystemAttributes/ns0:SourceInfo/ns0:TargetInfo/ns0:TargetType) = 'oracle_oms_console'">
            <assignment_group>DBA-TEAM</assignment_group>
          </xsl:when>
          <xsl:when test="normalize-space(ns0:SystemAttributes/ns0:SourceInfo/ns0:TargetInfo/ns0:TargetType) = 'oracle_oms_pbs'">
            <assignment_group>DBA-TEAM</assignment_group>
          </xsl:when>
          <xsl:when test="normalize-space(ns0:SystemAttributes/ns0:SourceInfo/ns0:TargetInfo/ns0:TargetType) = 'oracle_si_fabric'">
            <assignment_group>DBA-TEAM</assignment_group>
          </xsl:when>
          <xsl:when test="normalize-space(ns0:SystemAttributes/ns0:SourceInfo/ns0:TargetInfo/ns0:TargetType) = 'oracle_si_netswitch'">
            <assignment_group>DBA-TEAM</assignment_group>
          </xsl:when>
          <xsl:when test="normalize-space(ns0:SystemAttributes/ns0:SourceInfo/ns0:TargetInfo/ns0:TargetType) = 'oracle_si_pdu'">
            <assignment_group>DBA-TEAM</assignment_group>
          </xsl:when>
          <xsl:when test="normalize-space(ns0:SystemAttributes/ns0:SourceInfo/ns0:TargetInfo/ns0:TargetType) = 'oracle_vca_opus'">
            <assignment_group>DBA-TEAM</assignment_group>
          </xsl:when>
          <xsl:when test="normalize-space(ns0:SystemAttributes/ns0:SourceInfo/ns0:TargetInfo/ns0:TargetType) = 'osm_cluster'">
            <assignment_group>DBA-TEAM</assignment_group>
          </xsl:when>
          <xsl:when test="normalize-space(ns0:SystemAttributes/ns0:SourceInfo/ns0:TargetInfo/ns0:TargetType) = 'osm_instance'">
            <assignment_group>DBA-TEAM</assignment_group>
     		  </xsl:when>
          <xsl:otherwise>
            <assignment_group>Linux-Team</assignment_group>
          </xsl:otherwise>
        </xsl:choose>
</xsl:template>
<xsl:call-template name="setAssignmentGroup"></xsl:call-template>
<!-- <assigned_to>sample.user</assigned_to> -->

Registering a template

Once all the required changes have been made to the template, it is time to register the template in OEMCC. Login to OEM server, transfer the customized template file to the server, navigate to OMS_HOME and register the new template with the desired name using the command below:

./emctl register_template connector -t <template_file_path.xsl> -repos_pwd <sysman_password> -cname <Connector_Name> -iname <Internal_Name> -tname <Desired_Template_Name> -ttype 2 -d <description>

Once the template it registered, you can test if it is functioning properly by manually generating a ticket in ServiceNow via OEM for an incident. Login to OEMCC and navigate to Enterprise –> Monitoring –> Incident Manager.

If there are any open incidents in OEM, click on the incident –> More –> Generate ticket. On the resultant pop-up window, select the newly registered template and click on OK. If all the required fields are mapped correctly and appropriate values are assigned in the template, you should see a message confirming that a ticket has been successfully created in ServiceNow.

Let me know in the comments section in case you encounter any issues or, if there are any comments or, suggestions!