Jump to content

Asset Import - Utility unexpectedly inserts a new record instead of updating an existing one


Recommended Posts

The Asset Import utility v1.9.0 was executed to test the removal of values for a specific field using the '__clear__' as clearcolumn in the SQL statement within the config file but it does seem that the utility inserts a new duplicate record  for each asset record instead of updating the existing asset by clearing the value in the existing field.

Link to comment
Share on other sites

Hi Izu,

 thanks for your post.

To get the the root of this issue it's worth revisiting how the asset import utility operates (the same principle can actually be applied across the range of Hornbill's data import utilities).

If the utility recognises a record already exists in Hornbill, it will update that record. If the utility determines that a record does not exist, it will create a new record.

So the focus of the investigation should be on what the utility uses to determine if a record already exists in Hornbill or not.

Considering the database asset import specifically, this is achieved through the "Asset identifier" configuration that exists for each asset type you define in your conf.json file. This involves specifying a "DBColumn", "Entity", and "EntityColumn" which can be described as follows:

  • DBColumn - the unique column that exists in your data source (i.e. where the records are being imported from) and is included in the database query
  • Entity - the Hornbill entity where data is stored. Now this one is a bit Hornbilly. Basically its a round about way of referring to the table where the unique column exists in Hornbill.
  • EntityColumn - specifies the unique identifier column from the Hornbill entity - i.e. the actual column name that exists in the Hornbill table - lets call it the "Hornbill identifier column"

Below is an example from our wiki showing the configuration of the asset identifier for records being imported as Laptop-type assets (https://wiki.hornbill.com/index.php/Database_Asset_Import)

{
       "AssetType": "Laptop",
       "Query": "xxxxxxxxxxxxxxx",
       "AssetIdentifier": {
           "DBColumn": "MachineName",
           "Entity": "Asset",
           "EntityColumn": "h_name"
       }
   },

I appreciate that the concept of an entity is something that is explained very often and can be the most common stumbling block if you're new to Hornbill. Here are the guidelines to follow when doing an asset import:

If the unique Hornbill identifier column (EntityColumn) you're using exists in the table h_cmdb_assets, then the Entity will be "Assets"

If the unique Hornbill identifier column exists in the table h_cmdb_assets_computer, then the Entity will be "AssetsComputer"

If the unique Hornbill identifier column exists in the table h_cmdb_assets_computer_peripheral then the Entity will be "AssetsComputerPeripheral"

If the unique Hornbill identifier column exists in the table h_cmdb_assets_mobile_device then the Entity will be "AssetsMobileDevice"

If the unique Hornbill identifier column exists in the table h_cmdb_assets_network_device then the Entity will be "AssetsNetworkDevice"

If the unique Hornbill identifier column exists in the table h_cmdb_assets_printer then the Entity will be "AssetsPrinter"

If the unique Hornbill identifier column exists in the table h_cmdb_assets_software then the Entity will be "AssetsSoftware"

If the unique Hornbill identifier column exists in the table h_cmdb_assets_telecoms then the Entity will be "AssetsTelecoms"

 

So, assuming the entity and Hornbill identifier column are specified correctly, if new records are still being created unexpectedly, I'd check the value contained in your unique DB column in your source data. perhaps this has changed and therefore no longer matches any record previously imported.

I hope that helps,

Dan

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...