Download PDF
Download page ServiceNow Integration.
ServiceNow Integration
ServiceNow® is an incident management tool to manage your IT services. The IT infrastructure can spread across various applications and grouping or correlating the IT incidents becomes challenging. Therefore, the Mean Time to Detect (MTTD) and Mean Time to Resolve (MTTR) increases for the IT issues. Cisco AIOps supports integrating ServiceNow instances to gain end-to-end visibility into your IT incidents, problems, and change requests. This integration requires changes in Cisco AIOps and the ServiceNow instance.
This integration fetches the IT services and correlates with the incidents, problems, and changes. Cisco AIOps provides a context-based view to monitor your IT incidents by using the IT Services categories that you have defined in ServiceNow. The IT Services categories include Organization, Products, Services, and Portfolios.
Prerequisites
Ensure you have the following:
- Administrator privileges for your ServiceNow instance.
- ServiceNow user account.
- OAuth 2.0 tokens for your Cisco Observability Platform tenant. To generate OAuth tokens, see Create Service Principal.
Configure the ServiceNow Instance in Cisco AIOps
Cisco AIOps uses this configuration to fetch the incidents, problems, or changes from your ServiceNow instance. Complete the following steps in Cisco AIOps to configure the ServiceNow instance:
Navigate to Configure > Integrations.
Click Create.
In Name, specify a name for the integration.
Select ServiceNow from the Integration Type list.
Select Sub Integration Type:
Incidents: It fetches the IT incidents from the ServiceNow instance to the Cisco Observability Platform. Also, it enables you to create an incident in ServiceNow from the Cisco Observability Platform.
Problems: Fetches the problems from the ServiceNow instance to the Cisco Observability Platform.
Changes: Fetches the change requests from the ServiceNow instance to the Cisco Observability Platform.
Specify Requested Parameters:
Request Type: Select the method from the list you want to perform with the ServiceNow instance.
Raw URL: Specify the ServiceNow instance URL
Encoding Type: Specify the encoding type. Example: UTF-8.
In Authentication, select the authentication type:
Basic: Specify the credentials of your ServiceNow user account.
Token: Specify the bearer token you generated for the ServiceNow instance.
OAuth: Specify the OAuth details of the ServiceNow instance.
Saml: Specify the required SAML details of the ServiceNow instance.
APIkey: Specify the API key and its value of the ServiceNow instance.
(Optional) Specify the custom headers and variables if any.
(Optional) Specify the response handling criteria with the status codes for success and failure.
This configuration enables Cisco AIOps to connect with the ServiceNow instance.
Integrate the Cisco AIOps in the ServiceNow Instance
Cisco AIOps provides an endpoint to receive the updates from your ServiceNow instance.
https://<tenant-url>/rest/aiopsservices/webhook/api/v1/events
Configure this endpoint in the ServiceNow instance to integrate with Cisco AIOps as follows:
Create an Application Registry
An Application Registry lists the OAuth profiles in ServiceNow. You can use the OAuth profile to connect with the Cisco Observability Platform.
- Log in to your ServiceNow instance.
- Navigate to All > System OAuth > Application Registry.
- Click New to set up an OAuth profile.
- Specify the OAuth token details of your Cisco Observability Platform tenant. To generate OAuth tokens, see Create Service Principal.
- Client ID
- Client Secret
- Token URL
- Click Submit.
ServiceNow uses this profile to securely send the updates on incidents, problems, or changes to Cisco AIOps. For more information, see Configure Application Registry on the ServiceNow instance.
Create a REST Message
- Log in to your ServiceNow instance.
- Navigate to All > System Web Services > REST Message.
- Click New to integrate Cisco AIOps with the ServiceNow instance.
- Specify the following details:
- Name: A descriptive name to identify the REST message.
- Endpoint: Tenant URL of the Cisco AIOps. Example:
https://cisco-observe.appdynamics.com
- Authentication: Uses OAuth 2.0 authentication type with the profile created in Application Registry.
- Click Submit.
For more information, see Create a REST message.
Define a REST Endpoint
You must access the Cisco AIOps endpoint with the REST message to push the updates of incidents, problems, and changes in ServiceNow.
- Log in to your ServiceNow instance.
- Navigate to All > System Web Services > Outbound > REST Message.
- Select the REST message that you created for Cisco AIOps. See Create a REST Message.
- In HTTP Methods, click New specify the following:
- Name: A name to identify the HTTP method.
- HTTP Method: Select the POST method from the list.
Endpoint: The endpoint path of Cisco AIOps:
https://<tenant-url>/rest/aiopsservices/webhook/api/v1/events
CODE
Click Save.
For more information, see Define a REST message HTTP method.
Set up a Business Rule
Set up a business rule to push the updates of the tables such as Incidents, Problems, and Change Requests.
- Log in to your ServiceNow instance.
- Navigate to All > System Definition > Business Rules.
- Click New and specify the following:
- Name: A name of the business rule.
- Table: You can select the Incident, Problem, or Change Requests tables from the list. Therefore, the business rule can pick the updates from the selected table.
- Active: This option enables the business rule.
- Advanced: This option provides an advanced version of the form so that you can compose scripts.
- When to run: Specifies when to run the business rule. You can select the database actions such as Insert, Update, Delete, and Query. This business rule pushes the data only for the selected database actions.
In Advanced, specify the REST message name and the Endpoint in the script.
Use the sample scripts for the selected table option in the previous step.
(function executeRule(current, previous /*null when async*/ ) { // Create an empty object to hold the attribute-value pairs var incidentAttributes = {}; // Iterating over all fields in the current incident for (var attribute in current) { if (current.hasOwnProperty(attribute)) { // Adding each attribute and its value to the object incidentAttributes[attribute] = current[attribute].toString(); gs.info(attribute); gs.info(current[attribute]); gs.info(current[attribute].toString()); } } incidentAttributes["short_description"] = "Sent from trigger"; // Convert the object to a JSON string var jsonString = JSON.stringify(incidentAttributes); // Log the JSON string gs.info(jsonString); //var r = new sn_ws.RESTMessageV2('FSO-AIOPS-Integrations', 'eventWebhook'); //updating for alameda tenant testing var r = new sn_ws.RESTMessageV2('FSO-AIOPS-Integrations', 'eventWebhook'); r.setRequestHeader("route", "major_incident"); r.setRequestBody(jsonString); var response = r.execute(); var responseBody = response.getBody(); gs.info(responseBody); var httpStatus = response.getStatusCode(); gs.info(httpStatus); gs.info("AIOPS TEAM INCIDENT Creation -- END"); })(current, previous);
JSON(function executeRule(current, previous /*null when async*/ ) { // Create an empty object to hold the attribute-value pairs var incidentAttributes = {}; // Iterating over all fields in the current incident for (var attribute in current) { if (current.hasOwnProperty(attribute)) { // Adding each attribute and its value to the object incidentAttributes[attribute] = current[attribute].toString(); gs.info(attribute); gs.info(current[attribute]); gs.info(current[attribute].toString()); } } incidentAttributes["short_description"] = "Sent from trigger"; // Convert the object to a JSON string var jsonString = JSON.stringify(incidentAttributes); // Log the JSON string gs.info(jsonString); //var r = new sn_ws.RESTMessageV2('FSO-AIOPS-Integrations', 'eventWebhook'); //updating for alameda tenant testing var r = new sn_ws.RESTMessageV2('FSO-AIOPS-Integrations', 'eventWebhook'); r.setRequestHeader("route", "problem"); r.setRequestBody(jsonString); var response = r.execute(); var responseBody = response.getBody(); gs.info(responseBody); var httpStatus = response.getStatusCode(); gs.info(httpStatus); gs.info("AIOPS TEAM INCIDENT Creation -- END"); })(current, previous);
CODE(function executeRule(current, previous /*null when async*/ ) { // Create an empty object to hold the attribute-value pairs var incidentAttributes = {}; // Iterating over all fields in the current incident for (var attribute in current) { if (current.hasOwnProperty(attribute)) { // Adding each attribute and its value to the object incidentAttributes[attribute] = current[attribute].toString(); gs.info(attribute); gs.info(current[attribute]); gs.info(current[attribute].toString()); } } incidentAttributes["short_description"] = "Sent from trigger"; // Convert the object to a JSON string var jsonString = JSON.stringify(incidentAttributes); // Log the JSON string gs.info(jsonString); //var r = new sn_ws.RESTMessageV2('FSO-AIOPS-Integrations', 'eventWebhook'); //updating for alameda tenant testing var r = new sn_ws.RESTMessageV2('FSO-AIOPS-Integrations', 'eventWebhook'); r.setRequestHeader("route", "change"); r.setRequestBody(jsonString); var response = r.execute(); var responseBody = response.getBody(); gs.info(responseBody); var httpStatus = response.getStatusCode(); gs.info(httpStatus); gs.info("AIOPS TEAM INCIDENT Creation -- END"); })(current, previous);
CODE- Click Save.
For more information, see Classic Business Rules.
Run Script Actions
Verify your script that is added in the business rule.
- Log in to your ServiceNow instance.
- Navigate to Script Actions.
- Copy the script from the business rule to Run script.
- Click Run script.
Debug and verify whether your script is running as expected. For more information, see Script Actions.
Next Steps
After the successful integration, the Observe page segregates the incidents, problems, and change requests under IT Service Management and correlates with IT Services. See Monitor Entities.
Third party names, logos, marks, and general references used in these materials are the property of their respective owners or their affiliates in the United States and/or other countries. Inclusion of such references are for informational purposes only and are not intended to promote or otherwise suggest a relationship between Cisco AppDynamics and the third party.