Integrating ServiceNow OT Asset Workspaces with AWS IoT SiteWise Asset Fashions


In as we speak’s digital enterprise panorama, organizations more and more depend on asset administration options to streamline their operations. Corporations typically discover themselves managing the identical bodily property throughout a number of IT and operational expertise (OT) methods. One of many providers that assist IT groups observe and handle enterprise IT property is ServiceNow. This service handles every thing from {hardware} and software program stock to service requests, license compliance, and the entire lifecycle of expertise sources. For OT, AWS IoT SiteWise is a managed service that allows corporations to gather, manage, and analyze industrial gear knowledge at scale. This service supplies a unified repository of stay and historic operational knowledge, empowering organizations to make data-driven choices that improve manufacturing effectivity and optimize asset upkeep.

A standard problem that organizations face utilizing ServiceNow and AWS IoT SiteWise collectively is sustaining constant asset data throughout their methods. When an asset hierarchy is up to date in ServiceNow, operations groups should manually replicate these modifications in AWS IoT SiteWise, resulting in duplicate work and potential inconsistencies. This course of can be time-consuming, error-prone, and creates pointless overhead to handle the identical property in each environments.This weblog put up presents an method to synchronize asset knowledge between ServiceNow and AWS IoT SiteWise. By implementing this integration sample, you may eradicate guide updates, scale back errors, and preserve constant asset hierarchies throughout your IT and OT platforms.

Resolution overview

This answer makes use of AWS providers to create an automatic integration between ServiceNow and AWS IoT SiteWise. When modifications happen in ServiceNow’s asset administration system, they will robotically circulation via to AWS IoT SiteWise, guaranteeing each methods stay synchronized.

Architecture

Determine 1: Structure

Determine 1 reveals a two-phase knowledge circulation. Within the first section (Ingest), knowledge strikes from ServiceNow via Amazon AppFlow to in Amazon Easy Storage Service (Amazon S3). Within the second section (Import), the info flows via AWS Glue and again to Amazon S3 earlier than reaching AWS IoT SiteWise. Each phases serve totally different functions:

Ingest section:

  • Amazon AppFlow pulls asset knowledge from ServiceNow tables: Operations Know-how (OT), OT Entity, OT Entity Sort.
  • The info is then saved in Amazon S3 and in parquet format.

Import section:

  • AWS Glue transforms the parquet information to a JSON format that AWS IoT SiteWise can import.
  • Remodeled JSON information are saved in Amazon S3.
  • AWS IoT SiteWise imports the asset data to create or replace asset fashions and hierarchies.

Implementation overview

This put up presents the next phases to implement this integration:

  1. Configure the ServiceNow connector in Amazon AppFlow to ingest asset knowledge into Amazon S3.
  2. Create AWS Glue jobs to rework the info from parquet to JSON to match the required AWS IoT SiteWise import format.
  3. Arrange AWS IoT SiteWise asset import from Amazon S3.

Conditions

Earlier than implementing this answer, you’ll want:

  • A ServiceNow occasion with entry to your asset tables. On this instance, we use:
    • Operations Know-how (OT) (cmdb_ci_ot): Incorporates operational expertise system data from ServiceNow. These data embrace primary attributes like title, serial quantity, mannequin quantity, producer, and placement data.
    • OT Entity (cmdb_ot_entity): Incorporates data that outline the OT entity situations and their relationships. It additionally represents how gadgets join to one another within the operational hierarchy.
    • OT Entity Sort (cmdb_ot_entity_type): Incorporates data that outline the categories or classes of OT entities (akin to, Space, Course of Cell, Unit, and Tools Module). It additionally defines the allowed parent-child relationships within the operational hierarchy.
  • Three tables work collectively to supply an entire image of OT property:
    • cmdb_ci_ot handles the bodily system data (configuration Gadgets).
    • cmdb_ot_entity manages the situations and relationships of those gadgets.
    • cmdb_ot_entity_type defines the hierarchy construction guidelines and classes.
  • An AWS account with permissions to make use of Amazon AppFlow, Amazon S3, AWS Glue, and AWS IoT SiteWise.
  • ServiceNow credentials for a system-only consumer with permission to learn your asset tables.

Implementation

Configure the ServiceNow connector

On this part, you’ll arrange Amazon AppFlow to tug knowledge from ServiceNow and configure AWS Glue to catalog the info.

Create a ServiceNow connection in Amazon AppFlow

  1. Navigate to the Amazon AppFlow console.
  2. Within the left menu, underneath Connections, select ServiceNow from the Connectors dropdown.
  3. Select Create connection.
  4. Within the Connect with ServiceNow pop up, see Determine 2, enter the next:
    1. Choose both Primary Auth or OAuth2 as wanted.
    2. Fill within the mandatory data in accordance with the consumer information.
      1. In case you select OAuth2 fill within the Shopper ID, Shopper secret and Occasion URL to your ServiceNow Occasion.
      2. In case you select Primary Auth fill within the Username, Password and Occasion URL to your ServiceNow Occasion.
    3. Click on join as soon as all data is stuffed in.

Connect to ServiceNow

Determine 2: Connect with ServiceNow

Create flows for every desk

  1. Navigate to the Amazon AppFlow console.
  2. Within the left menu, underneath Flows, select Create circulation.
  3. Enter a Movement Title (for instance: cmdb_ci_ot), see Determine 3, and choose Subsequent.

Create flow

Determine 3: Create circulation

  1. Within the Supply particulars dialog field, see Determine 4, enter the next:
    1. For Supply Title, choose ServiceNow.
    2. Ensure that the connection you created earlier is chosen underneath ServiceNow connection. The reference may have the title of your ServiceNow occasion, this instance makes use of “dev287617”.
    3. For ServiceNow object, choose Operational Know-how (OT).
  2. Navigate to the Vacation spot particulars dialog field, see Determine 4, and enter the next:
    1. For Vacation spot title, select Amazon S3.
    2. Underneath Bucket particulars, both select your vacation spot bucket or create one via the Amazon S3 console. This instance makes use of the bucket prefix cmdb_ci_ot.
  3. Select Subsequent.

Flow source and destination

Determine 4: Movement supply and vacation spot

  1. Within the Supply to vacation spot discipline mapping dialog field, see Determine 5, enter the next:
    1. Underneath Supply discipline title, select Map all fields straight.
    2. Select Subsequent after which select Subsequent once more.
    3. End by selecting Run circulation.

Run flow

Determine 5: Run circulation

Repeat the “Create flows for every desk” process to create a circulation for every of your tables to create connections with the opposite ServiceNow objects:

  1. Movement title and Amazon S3 prefix: cmdb_ot_entity, ServiceNow object: OT Asset.
  2. Movement title and Amazon S3 prefix: cmdb_ot_entity_type, ServiceNow object: OT Asset Sort.

Arrange and run AWS Glue Crawler to determine the schema

  1. Navigate to AWS Glue console.
  2. Within the left menu, underneath Knowledge Catalog, select Crawlers.
  3. Within the Crawlers dialog field, see Determine 6, select Create crawler.

AWS Glue crawlers

Determine 6: AWS Glue crawlers

  1. For Crawler title, use ServiceNow Crawler and select Subsequent.

Crawler properties

Determine 7: Crawler properties

  1. Select Add an information supply.
  2. Within the Add knowledge supply dialog field, see Determine 8, enter the next:
    1. For Knowledge supply, select S3.
    2. For S3 path, select <your_bucket_name>.
    3. Choose Add an S3 knowledge supply.

Crawler data source
Determine 8: Crawler knowledge supply

  1. Select Subsequent.
  2. Underneath IAM function, choose Create new IAM function, see Determine 9.

Crawler IAM Role

Determine 9: Crawler IAM Position

  1. Select a reputation for the function. On this instance, we use AWSGlueServiceRole-ServiceNowCrawler.
  2. Choose Subsequent.
  3. Underneath Goal database, select an AWS Glue Database. This instance makes use of the default database.

AWS Glue Database

Determine 10: AWS Glue Database Choice

  1. Select Subsequent.
  2. Select Create.
  3. Run the crawler. It ought to take round two minutes to finish.

The ServiceNow parquet knowledge has now been efficiently imported into Amazon S3.

Remodel the JSON information

On this part, you’ll arrange the AWS Glue job to rework the parquet information to JSON format appropriate for AWS IoT SiteWise and import the info into AWS IoT SiteWise.

Create AWS Glue Job

  1. Navigate to AWS Glue console.
  2. Within the menu to the left, underneath ETL Jobs, select Visible ETL.
  3. In Create Job, choose Visible ETL.

AWS Glue studio

Determine 11: AWS Glue studio

  1. Create a Supply node. Choose the blue plus (+) button, see Determine 12, and choose Amazon S3.

Visual ETL

Determine 12: Visible ETL

  1. For Title, select any title for the node, see Determine 13. On this instance, we are going to use cmdb_ot_entity.
  2. For S3 supply kind, choose Knowledge Catalog desk.
  3. For Database, select the goal database you beforehand chosen when organising your AWS Glue Crawler.
  4. For Desk, select the primary desk cmbd_ot_entity. Repeat this step for every of the tables: cmdb_ci_ot and cmdb_ot_entity_type.

Adding source node

Determine 13: Including supply node

Map property to the AWS IoT SiteWise import format

  1. Create a brand new Supply node by deciding on the blue “+” button as proven in Determine 12.
  2. Add a Remodel node and choose SQL Question.
  3. For Title, use “property”.
  4. For Node dad and mom, select the supply nodes cmdb_ot_entity and cmdb_ci_ot.
  5. For Enter sources and SQL Aliases, select cmdb_ot_entity and cmdb_ci_ot for every, as proven in Determine 14.

assets transform

Determine 14: property remodel

  1. For SQL Question, copy and paste the next question:
SELECT DISTINCT
    mother or father.sys_id as assetExternalId,
    mother or father.title as assetName,
    mother or father.ot_asset_type as assetModelExternalId,
    COLLECT_LIST(
        CASE 
            WHEN baby.sys_id IS NOT NULL THEN 
                STRUCT(
                    array_join(array(mother or father.ot_asset_type, baby.ot_asset_type), '-') as externalId,
                    baby.sys_id as childAssetExternalId
                )
        END
    ) as assetHierarchies,
    (
        CASE 
            WHEN ot.sys_id IS NOT NULL THEN 
                array(
                    STRUCT('title' as externalId, ot.title as attributeValue),
                    STRUCT('serial_number' as externalId, ot.serial_number as attributeValue),
                    STRUCT('producer' as externalId, ot.producer as attributeValue),
                    STRUCT('model_number' as externalId, ot.model_number as attributeValue),
                    STRUCT('firmware_version' as externalId, ot.firmware_version as attributeValue),
                    STRUCT('hardware_version' as externalId, ot.hardware_version as attributeValue),
                    STRUCT('asset_tag' as externalId, ot.asset_tag as attributeValue),
                    STRUCT('class' as externalId, ot.class as attributeValue),
                    STRUCT('atmosphere' as externalId, ot.atmosphere as attributeValue),
                    STRUCT('short_description' as externalId, ot.short_description as attributeValue)
                )
            ELSE array()
        END
    ) as assetProperties
FROM cmdb_ot_entity as mother or father
LEFT JOIN cmdb_ci_ot as ot
    ON mother or father.ot_asset = ot.sys_id
LEFT JOIN cmdb_ot_entity as baby
    ON mother or father.sys_id = baby.mother or father
GROUP BY mother or father.sys_id, mother or father.title, mother or father.ot_asset_type, ot.sys_id, ot.title, ot.serial_number, ot.producer, ot.model_number, ot.firmware_version, ot.hardware_version, ot.asset_tag, ot.class, ot.atmosphere, ot.short_description

Map the asset mannequin

  1. Create a brand new Supply node by deciding on the blue “+” button as proven in Determine 12.
  2. Add a brand new Remodel node and choose SQL Question.
  3. For Title, use “assetModels”.
  4. For Node Dad and mom, select the supply node cmdb_ot_entity_type.
  5. For Enter sources and SQL Aliases, use cmdb_ot_entity_type for every, as proven in Determine 15.

assetModel transform

Determine 15: assetModel remodel

  1. For SQL Question, copy and paste the next question:
SELECT DISTINCT
    mother or father.sys_id as assetModelExternalId,
    mother or father.label as assetModelName,
    (
        CASE 
            WHEN mother or father.ot_table IS NOT NULL THEN 
                from_json(
                '[{"dataType":"STRING","externalId":"name","name":"Name","type":{"attribute":{"defaultValue":"-"}},"unit":"-"},{"dataType":"STRING","externalId":"serial_number","name":"Serial Number","type":{"attribute":{"defaultValue":"-"}},"unit":"-"},{"dataType":"STRING","externalId":"manufacturer","name":"Manufacturer","type":{"attribute":{"defaultValue":"-"}},"unit":"-"},{"dataType":"STRING","externalId":"model_number","name":"Model Number","type":{"attribute":{"defaultValue":"-"}},"unit":"-"},{"dataType":"STRING","externalId":"firmware_version","name":"Firmware Version","type":{"attribute":{"defaultValue":"-"}},"unit":"-"},{"dataType":"STRING","externalId":"hardware_version","name":"Hardware Version","type":{"attribute":{"defaultValue":"-"}},"unit":"-"},{"dataType":"STRING","externalId":"asset_tag","name":"Asset Tag","type":{"attribute":{"defaultValue":"-"}},"unit":"-"},{"dataType":"STRING","externalId":"category","name":"Category","type":{"attribute":{"defaultValue":"-"}},"unit":"-"},{"dataType":"STRING","externalId":"environment","name":"Environment","type":{"attribute":{"defaultValue":"-"}},"unit":"-"},{"dataType":"STRING","externalId":"short_description","name":"Short Description","type":{"attribute":{"defaultValue":"-"}},"unit":"-"}]',
                    'array&amp;lt;struct&amp;lt;dataType:string,externalId:string,title:string,kind:struct&amp;lt;attribute:struct&amp;lt;defaultValue:string&amp;gt;&amp;gt;,unit:string&amp;gt;&amp;gt;'
                )
            ELSE array()
        END
    ) as assetModelProperties,
    COLLECT_LIST(
        CASE 
            WHEN baby.sys_id IS NOT NULL THEN 
                STRUCT(
                    array_join(array(mother or father.sys_id, baby.sys_id), '-') as externalId,
                    baby.title as title,
                    baby.sys_id as childAssetModelExternalId
                )
        END
    ) as assetModelHierarchies
FROM cmdb_ot_entity_type as mother or father
LEFT JOIN cmdb_ot_entity_type as baby
    ON mother or father.sys_id = baby.parent_type
GROUP BY mother or father.sys_id, mother or father.title, mother or father.label, mother or father.ot_table

Mix the property and assetModels

  1. Create a brand new Supply node by deciding on the blue “+” button as proven in Determine 12.
  2. Add a brand new node Remodel and choose SQL Question.
  3. For Title, use “assetModelHierarchy”.
  4. For Node dad and mom, select the supply nodes property and assetModels.
  5. For Enter sources and SQL aliases, use property and assetModels for every, as proven in Determine 16.

assetModelHierarchy transform

Determine 16: assetModelHierarchy remodel

  1. For SQL Question, copy and paste the next question:
SELECT (
    SELECT COLLECT_LIST(STRUCT(assetModels.*)) as assetModels
    FROM assetModels
) as assetModels,
(
    SELECT COLLECT_LIST(STRUCT(property.*)) as property
    FROM property
) as property

Now, add the goal of the remodel so you may retailer the results of our AWS Glue Job for use for importing into AWS IoT SiteWise.

Add the goal of the remodel

  1. Create a brand new Supply node by deciding on the blue “+” button as proven in Determine 12.
  2. Add a brand new node Remodel and choose Amazon S3 from the targets.
  3. For Title, use something. This instance usesAmazon S3.
  4. For Node Dad and mom, select the supply node assetModelHierarchy.
  5. For Format, select JSON.
  6. For Compression Sort, select None.
  7. For S3 Goal Location, choose <your_destination_bucket>.

Adding target node

Determine 17: Including goal node

As soon as full, you must see the ETL that’s proven in Determine 18. Select Save.

Then choose Run and await it to complete.

Asset hierarchy

Determine 18: Asset hierarchy

Import into AWS IoT SiteWise

On this part, you’ll affirm the creation of the JSON file in Amazon S3 and import the ServiceNow property into AWS IoT SiteWise.

  1. First, affirm JSON file was created by doing the next:
    1. Open the Amazon S3 console.
    2. Choose <your_destination_bucket>.
    3. Choose the run-<timestamp>-part-r-00000 file, then select Actions.
    4. Choose Rename Object, then rename it to sitewise-import.json. With a purpose to import it to AWS IoT SiteWise, the item should have the json extension added to the title.
  2. To import into AWS IoT SiteWise, open the AWS IoT SiteWise console.
    1. Within the navigation pane, select Bulk Operations.
    2. Choose New ImportAWS IoT SiteWise bulk operations

      Determine 19: AWS IoT SiteWise bulk operations

    3. Within the Import metadata dialog field, for S3 URI, choose <your_destination_bucket> then the sitewise-import.json file.S3 import

      Determine 20: S3 import

    4. Choose Import and await the import to complete.

Validate your work

Now you can view the totally different fashions and mannequin properties as proven in Determine 21. It’s also possible to view the totally different property and asset properties as proven in Figures 22, 23, and 24. Your ServiceNow hierarchy is now efficiently replicated into AWS IoT SiteWise.

AWS IoT SiteWise models

Determine 21: AWS IoT SiteWise fashions

AWS IoT SiteWise model properties

Determine 22: AWS IoT SiteWise mannequin properties

AWS IoT SiteWise assets

Determine 23: AWS IoT SiteWise property

AWS IoT SiteWise asset properties

Determine 24: AWS IoT SiteWise asset properties

Cleanup

To wash up the work outlined on this weblog, navigate to the Amazon AppFlow console to delete the flows and ServiceNow connection. Delete any consumer and consumer credentials created for ServiceNow. In AWS Glue, delete the crawler, job, and tables from the AWS Glue Knowledge Catalog. Take away the property and asset fashions from AWS IoT SiteWise. Lastly, delete each the parquet and reworked JSON information out of your Amazon S3 buckets.

Conclusion

This weblog offered a course of to combine ServiceNow asset knowledge with AWS IoT SiteWise, a observe that permits organizations to keep up constant asset data throughout their IT and OT asset administration options. To totally automate this integration, schedule your Amazon AppFlow flows to run at common intervals and configure your AWS Glue job with a schedule set off. When organising the AWS Glue job, you can even add the ‘.json’ extension to the output file through the ETL script. Each options eradicate guide knowledge entry and guarantee consistency between IT and OT methods.

Strive implementing this answer and tell us about your expertise within the feedback part under. Wish to be taught extra about AWS IoT SiteWise? See the AWS IoT SiteWise Developer Information for extra data.


In regards to the authors

Integrating ServiceNow OT Asset Workspaces with AWS IoT SiteWise Asset Fashions 1
Maria El Khoury is a Options Architect at AWS supporting manufacturing clients of their digital transformation journey. With a background of constructing IoT and laptop imaginative and prescient options, Maria is very concerned with making use of AWS within the fields of Industrial IoT and provide chain.

Integrating ServiceNow OT Asset Workspaces with AWS IoT SiteWise Asset Fashions 2
Brent Van Wynsberge is a Options Architect at AWS supporting enterprise clients. He accelerates the cloud adoption journey for organizations by aligning technical aims to enterprise outcomes and strategic targets. Brent is an IoT fanatic, particularly within the utility of IoT in manufacturing, he’s additionally concerned with DevOps, knowledge analytics and containers.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles