Name: servicenow-oneview
Owner: Hewlett Packard Enterprise
Description: null
Created: 2017-04-20 15:31:30.0
Updated: 2017-09-03 13:31:54.0
Pushed: 2017-12-07 10:38:34.0
Homepage:
null
Size: 616
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
Other Committers
User | Email | Most Recent Commit | # Commits |
README
HPE OneView to Service-Now Integration
The code within this repository builds an integration between HPE OneView and an instance of Service NOW.
The following use cases are supported by this integration.
Use case #1: Incident management
- Listen on alerts indentified by HPE OneView
- Filter alerts based on SNMP and post only specific alerts as either incidents or events in ServiceNow
- Update existing incidents as ongoing activities change status
- Close incident in ServiceNow to clear associated alerts in HPE OneView ( by directional integration )
Use case #2: Configuration management
- Update Configuration Items (CI) in ServiceNow
- Keep CI items in sync with periodic refresh using a scheduler of your choice
Use case #3: Service catalog offering
- Design and present an HPE Synergy service offering in the service catalog
- Provision bare metal server when requested from the service catalog.
Pre-requisites ( Software dependancies to run this integration )
- HPE OneView 3.0 or above ( tested on 3.0, it should work with 3.1 by passing correct X-API-Version )
- Service NOW - Helsinki or above version ( tested on Helsinki )
- VM ( tested on Linux flavor of VM ) to run the code. Need following packages on the VM
- ElasticSearch v2.4.3
- Install OneView Python Library (https://github.com/HewlettPackard/python-hpOneView)
- Node.js v5.11
- ServiceNow MID server for version Helsinki
- Java 1.8
- Python3 and pip3
- Rundeck ( job scheduler to sync servers inventory )
- For filtering the alerts ( for example : which one should go to incident table and which one should land on events table ), prepare
the trap list ( .csv file ). A sample filtered trap list file can be found at ./scripts/traps folder. This file is being load and read
by script during runtime.
Build Instructions (How to setup )
- clone the repo onto your PC or VM
- cd to servicenow-oneview directory
- run “npm install” command to install javascript dependent modules.
- If elasticsearch instance is running on localhost, no need to update the esPersistance.js else update the esPersistance.js for IP address/hostname of elasticsearch.
- configure MID server with your servicenow instance and start the service
- Define outbound REST message APIs on servicenow instance to communicate with integration pack instance. Here are the high level steps:
- login to your servicenow instance, then go to outbound REST message.
- Let us create 3 REST message APIs as shown in the below picture.
-
-POST :3000/arrow/v1/incident
sample playload and headers are in the below picture
![Sample POST /arrow/v1/incident](https://github.com/HewlettPackard/servicenow-oneview/blob/master/images/REST_POST_ALERT_%20ServiceNow.png)
-POST :3000/arrow/v1/login-sessionssample playload and headers are in the below picture
![Sample POST /arrow/v1/login-sessions](https://github.com/HewlettPackard/servicenow-oneview/blob/master/images/REST_POST_LOGIN-SESSIONS_%20ServiceNow.png)
-POST :3000/arrow/v1/provision-serversample playload and headers are in the below picture
![Sample POST /arrow/v1/provision-server](https://github.com/HewlettPackard/servicenow-oneview/blob/master/images/REST_POST_SERVER_PROVISION_%20ServiceNow.png)
- configure business rules on the incidents. You can copy business rule code from ServiceNow/incidents_business_rules.txt and edit IP address and MID server name. The rule will execute when user closes incident on server. This rule makes REST call to integration server and then active alert on oneview would get closed.
- create workflow design with custom run script. You can copy custom workflow runscript code from ServiceNow/workflow-script.txt and edit the IP address and MID server name. The sample workflow will get executed when requested service catalog item is approved. Here is sample workflow design.
- Edit servicenow-oneview/arguments.json with your servicenow instance credentials
How to run the application
- start the elasticsearch instance
- cd to servicenow-oneview, run “node server.js | ./node_modules/.bin/bunyan” command to start the nodejs server
- check the trap list file (.csv ) in in ./scripts/traps folder. This csv file is being read and alerts are filtered based on this list
- cd to servicenow-oneview/scripts and run scmb python script with below command
python3 ovincidents.py -i “path to arguments.json”
How to test and troubleshoot
Use Case #1
1. Simulate or generate "active" alert on oneview
2. You should see an new incidents on servicenow ( if incident already exists, it updated with new alert. One incident per server hardware ). Depending on the filtered trap list, you will alerts landing in Incident table or events table.
3. If you close an incident in servicenow, the alert will be cleared on oneview
4. Review arrow.log and OVSB.log for additional troubleshooting ( if you run into any issues )
Use Case #3
1. Request physical server service catalog from your request catalog
2. Approve the request
3. You should see bare metal server getting provisioned in OneView
Note: Before runnig this use case, you should configure REST message endpoints and should do basic testing to make sure your connections and endpoints are working
Use Case #2
1. For running configuration management use case, you should have prior knowledge of ServiceNow CDMB records and uploading CMDB records either using csv file or some othe mechanism.
2. run scripts/load_ci_items.py script to get servers list from OneView and store into csv file
3. Follow ServiceNow steps to load csv file onto CMDB records table
4. Run scripts/synchw.py through Run deck software or manually for ondemand sync'ing between OneView and CMDB records
5. After running the above scripts, records in CMDB should be updated. Script updates 'os_version' and 'os_domain' fields of CMDB CI table. This marks the server and becomes unavailable for service request
Assumptions
- Initial HPE servers records should be created in the ServiceNow CMDB
- Service catalog request offering should be created for running use case # 2
- Optionally configure the run deck to run the sync script automatically
- Image Streamer feature is used for OS provisioning