Service Now WebAPI and Linux / F5 / Apps / Database

I have successfully integrated ServiceNow using the WebAPI tile to grab Incidents, Change Tasks, and Problems for Microsoft Windows based computers.

I used the example from the Coffee Break video as follows:

sysparm_query cmdb_ci.name={{properties.netbiosComputerName}}

This does not work for non Microsoft Windows computer objects.

Does anyone have a solution that works for Linux Computers, F5 devices, Application CIs or Databases? I have created the perspective and targeted the “Object” class in the Perspective Settings.

I’d ultimately like to be able to drill down to any of these SCOM objects (i.e. Linux Computer) and hit the Service Now perspective and get data from Service Now based on the object type under current scope. But, If it’s not a Microsoft Windows computer, I get “Object reference not set to an instance of an object”.

2 Likes

You can do this a number of ways.

Simply searching for the object and looking at the monitored entity perspective for an object is by far the easiest – This will show all of the properties of the object:

2017-11-21-10_18_14-squp-opp-orc02.sales_.local-Squared-Up.jpg

You can also use PowerShell.

First, we get the correct class:

get-scomclass -DisplayName *linux* | select displayname,name | sort displayname
Which tells us that we are after Microsoft.Linux.Computer

I only have a handful of Linux machines, so the next bit is easy:

get-scomclass -Name Microsoft.Linux.Computer | Get-SCOMClassInstance | fl *

It’s likely that either of these will suffice:

2017-11-21-10_20_51-Windows-PowerShell-ISE.jpg

Either of these methods can be replicated to find the other objects properties.

If you prefer, you can also view the detail view of a state view in the SCOM console, selecting an object and looking there:

2017-11-21-10_23_55-Windows-Computers-squpscomgroup-Operations-Manager.jpg

2 Likes

If you’ve set the tableName for the server/F5/App then have you tried just using the Name as it appears in Service Now?

For example, for our Mobile Iron email solution – I found it in the SN CMDB under Applications which gave me the Table in the browser address bar, I then just copied the Name field and used:

/table/cmdb_ci_appl

sysparm_query name=MobileIron

sysparm_fields owned_by,name,short_description,managed_by,support_group,sys_id

sysparm_display_value True

 

That might not be much use for Perspectives, but it’s handy for when you just have a handful of objects you need to add SN info for. I used the above for CMDB information so the Ops Team can see who to contact when something is broken.

3 Likes

This was helpful. I also learned that I can create multiple different “ServiceNow” perspective, scoped to different classes. I needed to do this to target different attributes depending on the SCOM class. For example, I target netbiosComputerName for the Windows server. I then was able to clone the perspective and target the PrincipalName for the Unix Computer class. This way a different “ServiceNow” perspective is called up depending on the class of object under inspection and the ServiceNow queries are customized per class to target different attributes that are relevant to that object type. Next challenge is to get a non-Fully-Qualified hostname set in SCOM for the Unix Computer objects, so that I can match it to a ServiceNow Ticket CI.

Great information that may also come in handy for another use of ServiceNow data. Thank you.

More on perspectives (https://youtu.be/46SAevmaGtk). If they all share the same fully-qualified hostname, I think you can just append the query with that. i.e. {{PrincipleName}}.FQ.Hostname. Alternatively, if they do not, then you can create groups containing the servers with each and build the perspectives off of these instead of the class, targeting members of the groups.

In ServiceNow the CIs do not have the FQDN, but in SCOM all of the available fields do have FQDN. So, in order to search ServiceNow for the CI, I would have to have the ability to strip off the domain name to search for the CI. Is there a function or regular expression syntax that can be used to strip off a FQDN (.companyname.corp) while using the sysparm_query data field in the WebAPI tile? Or, is there a way to change the display name within SCOM to the hostname without the domain name, then I could use displayName attribute?

Take a look at the custom label article: https://support.squaredup.com/v3/Reference/Features/CustomLabelling - Specically, the Sample Custom Labels section, as this details the use of jquery. I’m not sure if you can use split/slice in the API query though. It’s worth having a tinker (I’ve not done anything with APIs yet!)