Fix script to invoke CMDB IRE rule to prevent duplicate ci record insert and update existing ci
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2023 09:26 AM
Hi,
i am unable to update the existing CI record when running the script :trying on to test on cmdb_ci_microsoft_iis_web_server table if Identification rule works or it creates duplicates. Anyone suggest please.Thnks
ERROR:
identification_engine : logId:[6edec5acdb18] MISSING_DEPENDENCY In payload no relations defined for dependent class [cmdb_ci_microsoft_iis_web_server] that matches any containment/hosting rules: [cmdb_ci_appl >> Runs on >> cmdb_ci_hardware]. Add appropriate relations in payload for '{"className":"cmdb_ci_microsoft_iis_web_server","values":{"name":"W22VM09","correlation_id":"AAD453","version":"10","sys_class_name":"cmdb_ci_microsoft_iis_web_server"},"internal_id":"eedec5ac96186d5001a6dd57e1e938ba","sys_object_source_info":{},"settings":{},"sys_ire_info":{},"display_values":{}}'
identification_engine : logId:[6edec5acdb18] Detected error while processing payload from ImportSet. Using options: {partial_payloads:false,partial_commits:false,deduplicate_payloads:false,generate_summary:false,dynamic_ire_engine:false}: no thrown error
identification_engine : logId:[6edec5acdb18] Input = {"items":[{"className":"cmdb_ci_microsoft_iis_web_server","values":{"name":"W22VM09","correlation_id":"AAD453","version":"10"},"sys_object_source_info":{},"sys_ire_info":{}}]}: no thrown error
identification_engine : logId:[6edec5acdb18] Output = {"items":[{"className":"cmdb_ci_microsoft_iis_web_server","sysId":"Unknown","identifierEntrySysId":"Unknown","errors":[{"error":"MISSING_DEPENDENCY","message":"In payload no relations defined for dependent class [cmdb_ci_microsoft_iis_web_server] that matches any containment/hosting rules: [cmdb_ci_appl >> Runs on >> cmdb_ci_hardware]. Add appropriate relations in payload for '{\"className\":\"cmdb_ci_microsoft_iis_web_server\",\"values\":{\"name\":\"W22VM09\",\"correlation_id\":\"AAD453\",\"version\":\"10\",\"sys_class_name\":\"cmdb_ci_microsoft_iis_web_server\"},\"internal_id\":\"eedec5ac96186d5001a6dd57e1e938ba\",\"sys_object_source_info\":{},\"settings\":{},\"sys_ire_info\":{},\"display_values\":{}}'"},{"error":"ABANDONED","message":"Too many other errors"}],"identificationAttempts":[{"info":"sys_object_source SKIPPED","attemptResult":"SKIPPED","identifierName":"","attributes":["source_name","source_native_key"],"searchOnTable":"sys_object_source","hybridEntryCiAttributes":[]}],"info":[],"errorCount":2,"markers":[],"inputIndices":[0],"mergedPayloadIds":[],"warningCount":0}],"additionalCommittedItems":[],"relations":[],"additionalCommittedRelations":[]}: no thrown error
*** Script: {"items":[{"className":"cmdb_ci_microsoft_iis_web_server","sysId":"Unknown","identifierEntrySysId":"Unknown","errors":[{"error":"MISSING_DEPENDENCY","message":"In payload no relations defined for dependent class [cmdb_ci_microsoft_iis_web_server] that matches any containment/hosting rules: [cmdb_ci_appl >> Runs on >> cmdb_ci_hardware]. Add appropriate relations in payload for '{\"className\":\"cmdb_ci_microsoft_iis_web_server\",\"values\":{\"name\":\"W22VM09\",\"correlation_id\":\"AAD453\",\"version\":\"10\",\"sys_class_name\":\"cmdb_ci_microsoft_iis_web_server\"},\"internal_id\":\"eedec5ac96186d5001a6dd57e1e938ba\",\"sys_object_source_info\":{},\"settings\":{},\"sys_ire_info\":{},\"display_values\":{}}'"},{"error":"ABANDONED","message":"Too many other errors"}],"identificationAttempts":[{"info":"sys_object_source SKIPPED","attemptResult":"SKIPPED","identifierName":"","attributes":["source_name","source_native_key"],"searchOnTable":"sys_object_source","hybridEntryCiAttributes":[]}],"info":[],"errorCount":2,"markers":[],"inputIndices":[0],"mergedPayloadIds":[],"warningCount":0}],"additionalCommittedItems":[],"relations":[],"additionalCommittedRelations":[],"hasError":true,"hasWarning":false,"logContextId":"62dec5acdb186d509ee932f6f49619bb"}
[0:00:00.019] Total Time
runCiIdentificationReconciliation();
function runCiIdentificationReconciliation() {
var payload = {"items":[{"className":"Microsoft iis Web Server","values":{"version":"10", "correlation_id":"AAD453","name":"W22VM09"}}]};
var input = new JSON().encode(payload);
var output = SNC.IdentificationEngineScriptableApi.createOrUpdateCI('ImportSet', input);
gs.print(output);
}
0 REPLIES 0