Active IQ Unified Manager Discussions

Using Powershell and API to create ServiceNow ticket

moork
6,218 Views

Our goal here today is to automate the creation of a ServiceNow ticket for our offshore support teams.  

I have a json file from ServiceNow.

 

What I need is guidance on how to use the information I have to create an automated ServiceNow ticket.

 

Please let me know if you need anything attached to the post?

 

thank you

6 REPLIES 6

AlexDawson
6,158 Views

Hi there!

 

I think we need a bit more information here - would you like certain events inside ONTAP to create service-now INCs for the team to review and resolve?

MJDalton
6,127 Views

Thanks Kevin for submitting this question:

 

We've built a "Critical" alert policy. We would like alerts sent via this policy (Sent from AiQUM 9.7) to generate ServiceNow tickets. All the alerts represent a complete outage/failure, meaning data access is not available. The desire is to create INC tickets, these tickets will be managed by the Helpdesk during off-hours to call the On-Call Storage person.   If there is any API  samples, that would be great.

 

MJ

Michael J Dalton

MJDalton
6,110 Views

BTW @AlexDawson, I saw a previous thread you posted on regarding this.

https://community.netapp.com/t5/Data-Infrastructure-Management-Software-Discussions/integration-between-Unified-Manager-and-SNOW/m-p/158231

 

We don't have the SNMP module for SNOW and it's not in the budget to purchase.  We can however us API since all our sites are at 9.7P7

 

MJ

Michael J Dalton

AlexDawson
6,093 Views

Ah 🙂

 

This isn't something I'm personally familiar with, however I've gone through our documentation and found the following pointers, which will I'm pretty confident will help @moork and you to implement it.

 

Reviewing our documentation at https://library.netapp.com/ecm/ecm_download_file/ECMLP2862552 I look at page 50, which points out that a custom script can be executed to perform an action. 

 

I also review the section in the SNOW web docs at https://docs.servicenow.com/bundle/paris-it-operations-management/page/product/event-management/task/send-events-via-web-service.html regarding creating events via API.

 

So, next step is to take the script inputs and turn them into a JSON web event post to SNOW

 

I assume that since you're asking about PowerShell, you're running AIQUM on Windows. Page 322 of ECMLP2862552 begins the section on using Scripts and points out that PowerShell scripts are supported on the Windows platform only. You probably want to map our script argument eventSourceName to SNOW's "node" identifier for the event to be sent.

 

This page covers using command line arguments inside PowerShell - https://www.red-gate.com/simple-talk/sysadmin/powershell/how-to-use-parameters-in-powershell/ - and then this page covers creating and sending JSON inside PowerShell - https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-restmethod?view=powershell-7.1 

 

So, what you need to do is write a script that will be called by AIQUM when an event is created, that then maps the arguments provided by it into a JSON object that then gets posted to SNOW. 

 

Hope this helps!

 

Kevin, you are welcome to reach out to me internally if you have any feedback.

 

SCOTT_LINDLEY
6,047 Views

@AlexDawson wrote:

Ah 🙂

 

This isn't something I'm personally familiar with, however I've gone through our documentation and found the following pointers, which will I'm pretty confident will help @moork and you to implement it.

 

Reviewing our documentation at https://library.netapp.com/ecm/ecm_download_file/ECMLP2862552 I look at page 50, which points out that a custom script can be executed to perform an action. 

 

I also review the section in the SNOW web docs at https://docs.servicenow.com/bundle/paris-it-operations-management/page/product/event-management/task/send-events-via-web-service.html regarding creating events via API.

 

So, next step is to take the script inputs and turn them into a JSON web event post to SNOW

 

I assume that since you're asking about PowerShell, you're running AIQUM on Windows. Page 322 of ECMLP2862552 begins the section on using Scripts and points out that PowerShell scripts are supported on the Windows platform only. You probably want to map our script argument eventSourceName to SNOW's "node" identifier for the event to be sent.

 

This page covers using command line arguments inside PowerShell - https://www.red-gate.com/simple-talk/sysadmin/powershell/how-to-use-parameters-in-powershell/ - and then this page covers creating and sending JSON inside PowerShell - https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-restmethod?view=powershell-7.1 

 

So, what you need to do is write a script that will be called by AIQUM when an event is created, that then maps the arguments provided by it into a JSON object that then gets posted to SNOW. 

 

Hope this helps!

 

Kevin, you are welcome to reach out to me internally if you have any feedback.

 


We had similar requirements to create Remedy INCs from Unified Manager alerts. There are some differences - Remedy vs SNOW, our UM instance is on Linux so we were somewhat more flexible, and we're using Perl instead of PS.

Our UM instance calls an alerting script that takes the input parameters, determines how to re-format them to create the INC, then uses our simplified process to create the INC. Our Remedy and Control-M teams worked together to make the actual INC creation process simple. Once your code is written to create the INC, it can be used wherever it's needed. It's been a great solution. I also implemented event logging so we could check to make sure that it was working properly if needed.

In short, this is a great solution to your problem. Extract what you need from the command line parameters, cook up the appropriate JSON and ship it off to SNOW.

GidonMarcus
6,009 Views

Hi @AlexDawson , at the time (OCUM 7.2 I reckon) didn’t pass to powershell  the string parameters in quotes which prevents you to know the exact $args location to expect specific value, or better - to consume them as parm objects simple  as:

param ($cluster, $node)

Do you know if that changed or can be changed? (I guess it will introduce compatibility issue with existing scripts, but that can maybe get resolved with a “lagacy mode” tickbox. ), or perhaps I got that all wrong and there is a simple way that I miss? 

 

At the time I wrote that to parse the parameters into an easy to work with hashtable:

https://github.com/MGidi/Consume_parameters_from_OCUM_on_a_PowerShell_script_And_Create_Custom_Emails/blob/master/One_Line_Consume_parameters_from_OCU...

 

Gidi

Gidi Marcus (Linkedin) - Storage and Microsoft technologies consultant - Hydro IT LTD - UK
Public