We have been asked on numerous occasions to show a demo of using the Skyline Insights API to send Proactive Findings data to Service Now. Before we can show this, please make sure you have read this article detailing how to get the findings to ensure you understand the basics. It is also a good idea to reference the Skyline API Guide.
Similar to previous demos, here is the example to get the findings from a CSV (with the $1 as the CSV input file). This CSV file can be exported from Skyline Advisor Pro.
1 2 3 4 5 6 7 8 |
FINDINGID=`cat $1 | grep -v Finding | sed s/" "/""/g | sed s/","/" "/g | awk '{print $1; exit}' | sed s/'"'/""/g` SOURCE=`cat $1 | grep -v Finding | sed s/" "/""/g | sed s/","/" "/g | awk '{print $6}' | sed s/'"'/""/g` HOST=`cat $1 | grep -v Finding | sed s/" "/""/g | sed s/","/" "/g | awk '{print $7}' | sed s/'"'/""/g` KB=`cat $1 | grep -v Finding | sed s/" "/""/g | sed s/","/" "/g | awk '{print $1}' | grep -v -e '^$' | awk 'END{print}' | sed s/'"'/""/g` |
For this particular example, we will send the result to a file called servicenow.json. The “watch_list” will need to be specific to you and your team. The example below was my “watch_list”.
1 |
echo '{"short_description": "'"$FINDINGID $SOURCE $HOST $KB"'", "urgency": "3", "impact": "3", "watch_list": "6816f79cc0a8016401c5a33be04be441"}' > servicenow.json |
Now, let’s send entry in file to ServiceNow. This server is my personal development ServiceNow server. Your ServiceNow destination server will differ.
1 |
curl -u admin -X POST --header 'Content-Type: application/json' https://dev86912.service-now.com/api/now/table/incident --data @servicenow.json |
When done, you can remove the servicenow.json file using the following command.
1 |
rm servicenow.json |
Here is the video that will show this in action. If you did everything right, you should have the same result in your ServiceNow watch_list.
Comments