Receiving error when trying to insert CI's into SDM CMDB with GRLoader
<!--ERROR: INVALID AHD03075:Required attribute Configuration Item is missing from object Configuration Item -->
Passing name, class in the csv. Additionally, tried with all the OOTB required fields; we don't have any required custom fields.
I usually use objecttype=ci. I have also tried objecttype=nr. Previously objecttype=issnr was available but that gives an error now.
No changes have taken place in the environment.
Release : 17.3 and higher
Component : SDM - Configuration Management (CMDB/Visualizer/Grloader)
Used the following grloader command with the parameter "-T 10" to increase the logging and applying with load file ipad-3.csv:
grloader -u ServiceDesk -p XXXX -csvf .\ipad-3.csv -T 10 -a -n -E -P -nospinner -ad mdr_name=Maas -ad mdr_class=cmdbf -ad objecttype=ci
What I found was that the error shown below:
<!--ERROR: INVALID AHD03075:Required attribute Configuration Item is missing from object Configuration Item -->
The above error is because there is a required field for "name" that was being passed as null. This is because the load file being used was erroring trying to read the name attribute.
Logging in the GRLoader.log file shows:
10/27 19:29:45.893 INFO grCSVrdr 106 grCSVrdr1000 processing CSV filename.\ipad-3.csv
10/27 19:29:45.893 INFO grCSVrdr 271 grCSVrdr1100 reading file(.\ipad-3.csv) row(0)
10/27 19:29:45.893 INFO grCSVrdr 284 grCSVrdr1150 row contents 0 - (?name)
The first entry is "?name", which breaks the field specification entirely.
What ends up happening as a result was the CI name was being passed as "null" in the given load file:
10/27 19:29:46.109 INFO grCI 1198 Inserting CI name(null) class(iPad) Family(Hardware.Portable)
Being that the "name" field is required, the above error results.
The "?name" entry in the logs was caused by the ipad-3.csv having been saved with an encoding other than ANSI or UTF-8. Viewing the file and headers, the text will visually read as "name" but the extra "?" in the logging indicates file encoding issues.
To address the above, open the given ipad-3.csv file in Notepad, then saved the file as an ANSI or UTF-8 encoded file name, to remove any hidden characters in the file, saving it as "test-ansi.csv". The end result was this:
10/29 14:36:32.723 INFO grCSVrdr 106 grCSVrdr1000 processing CSV filename.\test-ansi.csv
10/29 14:36:32.723 INFO grCSVrdr 271 grCSVrdr1100 reading file(.\test-ansi.csv) row(0)
10/29 14:36:32.723 INFO grCSVrdr 284 grCSVrdr1150 row contents 0 - (name)
We then see:
10/29 14:36:32.908 INFO grCI 1198 Inserting CI name(iPad) class(iPad) Family(Hardware.Portable)
The resultant entry is successfully inserted.
10/29 14:36:33.367 INFO GRLoader 304 Results:
10/29 14:36:33.367 INFO GRLoader 304 Read Skipped Inserts Updates Errors Warnings
10/29 14:36:33.367 INFO GRLoader 304 CI 1 0 1 0 0 1
10/29 14:36:33.367 INFO GRLoader 304 Relation 0 0 0 0 0 0