Will Hallam
ServiceNow Employee
ServiceNow Employee

With ServiceNow's ability to list the packages in a container image, we have all the pieces in the CMDB to answer questions like "what software is this App Service using?" and "which App Services have this software?".  The piece that requires a bit of customization is getting that information directly, vs. having to pull it together each time.  Here's an example of using a custom table and no code subflow to have that data at your fingertips for tag-based application services created using Kubernetes metadata.

 

NOTE: the content in this example comes with no support or warranty, explicit or implied.

 

Subflow

 

The core of this example is the subflow "App Service Software Packages"; it takes an Application Service reference as input and performs the following steps:

 

- look up cmdb_rel_ci records with the app service as parent and relationship "Depends on::Used by"

- for each record found, look up cmdb_rel_ci records with the previous child as the parent and relationship "Depends on::Used by"

- for each record found, look up cmdb_rel_ci records with the previous child as the parent,  relationship "Instantiates::Instantiated by", and class Kubernetes Pod

- for each record found, look up cmdb_rel_ci records with the previous child as the parent, and class Docker Image

- for each record found, look up sn_itom_pattern_container_image_os_packages records with the previous child as the image

- for each record found, create a record in the custom table with the app service set to the subflow input and the package referencing the current record

Flow

 

I created a flow which could be used to trigger the subflow on the desired basis, such as an App Service record being modified, or a scheduled basis.  For some reason I haven't yet figured out, I'm not seeing consistent triggering when an App Service is updated, which prompted me to also create a UI action.

 

UI Action

 

Using the "Code Snippet" functionality of the subflow editor, I also generated a UI action for the App Service table (cmdb_ci_service_by_tags), named "Update Software Inventory".

 

The example scoped app I created is included as an attachment here.  Feel free to browse it for further insight and ideas.

 

Comments
Will Hallam
ServiceNow Employee
ServiceNow Employee

P.S., one change I would make if I were to put this in production is I'd clean out old app service package records when refreshing the data.

Jacques Clement
Kilo Sage
Kilo Sage

Hello @Will Hallam --

 

Just a thought, could you not simply use table svc_ci_assoc to get all the dependencies for a given Application Service?

 

This is what APM is using to build the Technology Portfolio (and it particular spot the software product lifecycle risks). Unfortunately, it is only considering in what is linked to cmdb_ci_server and below, and not what could be in Docker Images. That's what I was interested in your post, as a way to overcome this limitation.

 

Any thoughts?

Will Hallam
ServiceNow Employee
ServiceNow Employee

Yes! That would streamline things nicely! Great suggestion!

 

Best,

 

Will

Version history
Last update:
‎04-08-2024 12:30 PM
Updated by:
Contributors