Configuring OneClick Notifications for ServiceNow using MID Server

casp1041
Overview
ServiceNow can send notifications to OneClick when a ticket that is associated with OneClick alarm changes. These notifications update the alarm that is associated with a ticket in OneClick to reflect changes to the ticket. The ServiceNow integration can be configured to generate an automatic Ticket Closed notification that causes OneClick to clear the associated alarm when a ticket is closed. Similarly, when a ticket has been transferred, a Ticket Transfer notification causes OneClick to update the troubleshooter information for the associated alarm.
OneClick only clears an associated alarm when a ticket is closed/resolved in ServiceNow if the alarm is user-clearable.
These notifications use "keywords" which must match keywords that are set in the integration for OneClick. Keywords are case-sensitive.
By default, the keyword for the close action is "Closed", and the keyword for the transfer action is "Transfer" (in both ServiceNow and the
DX NetOps Spectrum
integration setup). These keywords can be customized in ServiceNow and in the
DX NetOps Spectrum
integration setup.
Configure ServiceNow to push notifications to OneClick
Follow these steps:
Before you configure ServiceNow and
DX NetOps Spectrum
to communicate with each other, download and install the integration components on your MID application server.  The Management, Instrumentation, and Discovery (MID) Server is a Java server that facilitates communication and movement of data between the ServiceNow platform and external applications, data sources, and services.
Download and Install Integration Components on the MID Server
  1. Download and install the MID server from ServiceNow (on the same server where
    DX NetOps Spectrum
    is installed or a different server). The Management, Instrumentation, and Discovery (MID) Server is a Java server that facilitates communication and movement of data between the ServiceNow platform and external applications, data sources, and services.
    Refer ServiceNow documentation for Installing MID
    Please keep handy the name you assign to the MID server during installation and configuration, for use during Creating Business Rules.
  2. Download and install integration components from the OneClick Server in the MID server installation directory.
    You can download the integration components on the same machine where the MID agent is installed.
    To achieve this use one of the following methods, depending on your operating systems.
    Please ensure that
    Polling
    is disabled from the
    OneClick Admin Pages
    >
    Service Desk Configuration
    >
    Integration Parameters
    before you initiate the OneClick notifications from ServiceNow..
  3. Navigate to your ServiceNow server instance and create the following Business Rules:
      • Update
      • Clear
    For more information, see Creating Business Rules. This example describes creating Business Rules for the Update and Close actions after you have completed and enabled the integration.
    Please refer ServiceNow™ documentation for information on:
MID Server and OneClick Web Server Use Different Operating Systems
Perform the following steps when your ServiceNow MID server uses a different operating system than the OneClick web server:
  1. Visit the Support website to locate a version of the integration components that are appropriate for your MID server.
  2. Download and save the appropriate version of the integration components for your operating system to the following directory on your MID server:
    MID Server_Installation_directory
  3. After you have saved the integration components to your MID server, follow the instructions for installing and configuring the integration components using the same operating system, beginning with Step 5.
MID server and OneClick Web Server Use the Same Operating System
Download the integration components from the OneClick web server and install them on the MID server.
Follow these steps:
  1. From your Service Desk server, navigate to the OneClick Administration pages.
    http://OneClick Web server/spectrum/admin/index.jsp
  2. Click the Service Desk Configuration link in the left panel of the Administration page.
    The Service Desk Configuration administration page opens in the right panel, as shown:
Service Desk_Configuration.png
  1. Click the Integration Components link to download the oc_components.exe file. This self-extracting archive file contains the executable programs to configure the Service Desk server.
  2. Save the oc_components.exe file to the directory on your MID server:
    MID Server_Installation_directory
  3. Log in to your MID server host computer and navigate to the
    MID_Server_Installation
    directory.
  4. Locate the oc_components.exe file you downloaded.
  5. Linux:
    Run the following command to make the oc_components.exe file executable:
    chmod 755 oc_components.exe
    Windows:
    Do not edit the permissions of the downloaded file for the file to be executable.
  6. Run the oc_components.exe file.
    The OneClickIntegrationSetup(.exe) file is extracted to the <
    MID Server_Installation_directory
    > directory.
  7. Run the MID Server
    _Installation_directory
    /OneClickIntegrationSetup(.exe) configuration program. At each prompt, enter the requested information and press Enter to continue. The following table describes each prompt and the required information:
OneClick Integration Setup Prompt
Description
OneClick Server name?>
Enter the hostname of your OneClick Web server.
OneClick Server port?>
Enter the port of the OneClick Web server.
OneClick Homepage path [default="spectrum"]?>
If your OneClick home page URL uses the default value of http://<
oc> Web server
/spectrum, press Enter to accept it.
Otherwise, enter the correct home page path portion of the OneClick home page URL at this prompt.
This home page path value is <path>, as in the example http://
OneClick Web server
>/
path
. The default value in OneClick is “spectrum.”
Username?>
Enter the username of the OneClick Administrator. This name is the
DX NetOps Spectrum
"super user" who installed the OneClick Web server.
Password?>
Enter the password of the OneClick Administrator.
Confirm password?>
Re-type the password of the OneClick Administrator and press Enter.
Enable logging? [yes|no]>
Type
yes
to enable logging or type
no
to disable logging and press Enter. We recommend enabling logging only when you are troubleshooting an integration problem. An active integration can create a large log file.
When logging is enabled, the integration creates a file named oc-notification.log in the
Service_Desk_Installation_directory
/bin directory.
When enabled, logging writes information about Service Desk notifications to this log file. Information is logged each time the
DX NetOps Spectrum
notification occurs and includes the type of activity and whether or not it was a success. In the case of a failed notification, this log file may contain a possible solution such as an invalid port or that the OneClick web server is unavailable.
Enable SSL? [yes|no]>
Type
yes
to enable SSL or type
no
to disable SSL and press Enter.
To enable SSL in
DX NetOps Spectrum
Tomcat, install OneClick and see . To enable SSL in CA Service Desk Tomcat, see Service Desk Administration.
Path to the JRE root installation directory?>
Type the JRE root installation directory path and press Enter. Specify the JRE root installation directory so that appending "bin/java - version" becomes a successful command.
Java 2 Runtime Environment (JRE) version 1.8.0 or later is required.
Close keyword [default="Closed"]?>
To use default values press Enter at the prompt without specifying a keyword.
Leave the line blank and press Enter.
Transfer keyword [default="Transfer"]?>
To use default values press Enter at the prompt without specifying a keyword.
Leave the line blank and press Enter.
The OneClick Integration Setup program creates a file named NotifyOneClick(.bat or .sh, depending on the operating system), in the
MID Server_Installation_directory
.
To reconfigure this information later, run the OneClickIntegrationSetup program again or manually edit values in the M
ID Server_Installation_directory
/oc-integration.cfg configuration file. Any changes that are made to this file take effect immediately. No additional restart is required.
Creating Business Rules
  1. Navigate to
    Business Rules
    (under
    System Definition
    tab) and click
    New
    to create a new rule.
  2. Provide a relevant name to the Business Rule, for e.g. 'Update'.
  3. Select
    “Incident”
    from the
    Table
    drop down.
  4. Check
    “Active”
    and
    “Advanced”
    check box(es).
  5. In the
    When to run
    section, do the following:
    1. Select “after” from the
      When
      drop down
    2. Enter 100” in the the
      Order
      field for update rule.
    3. Check the
      “Update”
      checkbox.
    4. Add filter conditions.
      For
      Update
      rule :
Assigned to + Changes AND
Description + contains +
“This ticket has been created by OneClick”
.
The following image displays how Filter Conditions show up for this Business Rule in ServiceNow
ServiceNow_Business Rule Filter Conditions_Transfer.png
Update Business Rules
In In the
Advanced
section at the bottom of the page give the below script for
Update
by changing the relevant details.
See comments in the script below:
function onBefore(current, previous) { //This function will be automatically called when this rule is processed. myFunction();} //Update function myFunction() { //Set the path of the OCNotify.jar var jarLocation = "C:\\MID_Server\\OCNotify.jar";//OCNotifier.jar"; \\example: "C:\\Users\\abcuser\\Desktop\\OCNotifier.jar"; //change the name of the spectrum_mid to be the name of your midserver you specified during mid server configuration/installation var midHost = "mid.server.spectrum_mid"; var ecc = new GlideRecord('ecc_queue'); ecc.initialize(); ecc.agent = midHost; ecc.topic = "Command"; ecc.queue = "output"; var description = current.description; var re = new RegExp("Alarm ID: ((\\w+)(-\\w+){4})"); var expResult = re.exec(description); var assignee = current.assigned_to.getDisplayValue(); var cmd = "java -jar " + jarLocation + " " + "update " + expResult [1] + " " + encodeURI(assignee); ecc.payload='<parameters><parameter name="name" value="'+cmd+'"/></parameters>'; ecc.insert(); }
Update Script for New York Version
Use the following script for the New York version.
(function executeRule(current, previous) { //This function will be automatically called when this rule is processed. myFunction(); })(current, previous); //Update function myFunction() { gs.log('in function'+current.number); //Set the path of the OCNotify.jar var jarLocation = "D:\\SNMidServer\\MidServer01\\agent\\OCNotify.jar"; //change the name of the MidServer01 to be the name of your midserver you specified during mid server configuration/installatio var midHost = "mid.server.MidServer01"; var ecc = new GlideRecord('ecc_queue'); ecc.initialize(); ecc.agent = midHost; ecc.topic = "Command"; ecc.queue = "output"; var description = current.description; var re = new RegExp("Alarm ID: ((\\w+)(-\\w+){4})"); var expResult = re.exec(description); var assignee = current.assigned_to.getDisplayValue(); var cmd = "java -jar " + jarLocation + " " + "update " + expResult [1] + " " + encodeURI(assignee); gs.log('in function cmd' +cmd); ecc.payload='<parameters><parameter name="name" value="'+cmd+'"/></parameters>'; gs.log('in function payload' + ecc.payload); ecc.insert(); gs.log('in function inserted'); }
Close Business Rules
For creating the
Close
rule, follow the steps mentioned for Creating Business Rules,
In step 5 b. enter “200” as the value in the
Order
field, and in step 5d. add the following filter conditions for
Close
rule:
State + is + Closed AND
Description + Contains +
“This ticket has been created by OneClick”
AND
State + Changes
Click ‘Add “OR” Clause’ button and add another filter as:
State + is + Resolved AND
Description + Contains + “
This ticket has been created by OneClick
” AND
State + Changes
The following image displays how Filter Conditions show up for this Business Rule in ServiceNow
ServiceNow_Business Rule Filter Conditions_Close.png
In the
Advanced
section at the bottom of the page give the below script for Close by changing the relevant details.
See comments in the script, below
function onBefore(current, previous) { //This function will be automatically called when this rule is processed. myFunction();} //Clear function myFunction() { //Set the path of the OCNotify.jar var jarLocation = "C:\\MID_server\\OCNotify.jar"; //change the name of the spectrum_mid to be the name of your midserver you specified during mid server configuration/installation var midHost = "mid.server.spectrum_mid"; var ecc = new GlideRecord('ecc_queue'); ecc.initialize(); ecc.agent = midHost; ecc.topic = "Command"; ecc.queue = "output"; var description = current.description; var re = new RegExp("Alarm ID: ((\\w+)(-\\w+){4})"); var expResult = re.exec(description); var status = current.state.getDisplayValue(); var cmd = "java -jar " + jarLocation + " " + "clear " + expResult [1] + " " + encodeURI(status); ecc.payload='<parameters><parameter name="name" value="'+cmd+'"/></parameters>'; ecc.insert(); }
Clsoe Script for New York Version
Use the following script for the New York version.
(function executeRule(current, previous) { //This function will be automatically called when this rule is processed. myFunction(); })(current, previous); //Clear function myFunction() { //Set the path of the OCNotify.jar var jarLocation = "D:\\SNMidServer\\MidServer01\\agent\\OCNotify.jar"; //change the name of the MidServer01 to be the name of your midserver you specified during mid server configuration/installation var midHost = "mid.server.MidServer01"; var ecc = new GlideRecord('ecc_queue'); ecc.initialize(); ecc.agent = midHost; ecc.topic = "Command"; ecc.queue = "output"; var description = current.description; var re = new RegExp("Alarm ID: ((\\w+)(-\\w+){4})"); var expResult = re.exec(description); var status = current.state.getDisplayValue(); var cmd = "java -jar " + jarLocation + " " + "clear " + expResult [1] + " " + encodeURI(status); ecc.payload='<parameters><parameter name="name" value="'+cmd+'"/></parameters>'; ecc.insert(); }
The setup is now complete.
For updates made to tickets in ServiceNow, you should see the changes being reflected in the associated alarms in OneClick Console, after the changes made to the ticket are completed on the ServiceNow side .
To disable OneClick notifications from ServiceNow to OneClick, go to the Business Rule, clear the
“Active”
checkbox for both the Business Rules (Update and Clear) and click
Save.