Highlighted
Outstanding Contributor.
Outstanding Contributor.
189 views

CP 18 AM Push adapter fails for non-Windows computers

Jump to solution

The Asset Manager push adapter fails for non-Windows computers because the error:

Failed executing <target_mapping name="OSServiceLevel"> <target_ci_type name="amComputer"> script [AMPushFunctions.checkWindows(Root['nt_servicepack'],Root['host_osrelease'],ClassModel,Root['os_family'])], Root cmdbId [null]
Failed executing <target_mapping name="Workgroup">  <target_ci_type name="amComputer"> script [AMPushFunctions.checkWindows(Root['nt_workgroup'],Root['primary_dns_name'],ClassModel,Root['os_family'])], Root cmdbId [null]


The TQL AM Computer Push.xml only provides elements nt_servicepack and nt_workgroup for Windows CIs.

0 Likes
1 Solution

Accepted Solutions
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: CP 18 AM Push adapter fails for non-Windows computers

Jump to solution

I have fixed the issue by not using the function checkWindows(). This function fails because for non-Windows CIs the attributes nt_servicepack and nt_workgroup are not in the TQL results. I have included below the fix for this issue. You must find the following lines in the file pushMappingAMComputer.xml and change the lines:
BEFORE

<target_mapping datatype="STRING" name="OSServiceLevel" value="AMPushFunctions.checkWindows(Root['nt_servicepack'],Root['host_osrelease'],ClassModel,Root['os_family'])"/>

AFTER

<target_mapping datatype="STRING" name="OSServiceLevel" value="(AMPushFunctions.getEnumValueByKey(ClassModel,Root['os_family'],'os_family_enum')=='windows') ? Root['nt_servicepack'] : Root['host_osrelease']"/>

BEFORE

<target_mapping datatype="STRING" name="OSBuildNumber" value="AMPushFunctions.checkWindows(Root['host_osrelease'],'',ClassModel,Root['os_family'])"/>

AFTER

<target_mapping datatype="STRING" name="OSBuildNumber" value="(AMPushFunctions.getEnumValueByKey(ClassModel,Root['os_family'],'os_family_enum')=='windows') ? Root['host_osrelease'] : null"/>

BEFORE

<target_mapping datatype="STRING" name="Workgroup" value="AMPushFunctions.checkWindows(Root['nt_workgroup'],Root['primary_dns_name'],ClassModel,Root['os_family'])"/>

AFTER

<target_mapping datatype="STRING" name="Workgroup" value="(AMPushFunctions.getEnumValueByKey(ClassModel,Root['os_family'],'os_family_enum')=='windows') ? Root['nt_workgroup'] : Root['primary_dns_name']"/>

View solution in original post

0 Likes
3 Replies
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: CP 18 AM Push adapter fails for non-Windows computers

Jump to solution

Prior to upgrading to Content Pack 18 I was using CP 14 with 10.11. We used the following mappings for the fields in Asset Manager:

<variable name="vWorkGroup"  datatype="STRING" value="AMPushFunctions.fEDDIGetDomainNameEx(Root['primary_dns_name'], Root['domain_name'])"/>
<target_mapping name="OSBuildNumber" datatype="STRING" value="Root['host_osrelease']"/>
<target_mapping name="OSServiceLevel" datatype="STRING" value="Root['discovered_os_version']"/>
<target_mapping name="Workgroup" datatype="STRING" value="vWorkGroup"/>

In my opinion HP should not have changed the mapping for amComputer OSBuildNumber as the value of host_osrelease worked well for Windows and the other operating systems. I also found that the number of systems in my UCMDB that had nt_workgroup populated was far lower then primary_dns_name or domain_name. I feel that the mapping change for amComputer OSServiceLevel to nt_servicepack is a good one but it should be NULL for the other operating systems.

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: CP 18 AM Push adapter fails for non-Windows computers

Jump to solution

I have fixed the issue by not using the function checkWindows(). This function fails because for non-Windows CIs the attributes nt_servicepack and nt_workgroup are not in the TQL results. I have included below the fix for this issue. You must find the following lines in the file pushMappingAMComputer.xml and change the lines:
BEFORE

<target_mapping datatype="STRING" name="OSServiceLevel" value="AMPushFunctions.checkWindows(Root['nt_servicepack'],Root['host_osrelease'],ClassModel,Root['os_family'])"/>

AFTER

<target_mapping datatype="STRING" name="OSServiceLevel" value="(AMPushFunctions.getEnumValueByKey(ClassModel,Root['os_family'],'os_family_enum')=='windows') ? Root['nt_servicepack'] : Root['host_osrelease']"/>

BEFORE

<target_mapping datatype="STRING" name="OSBuildNumber" value="AMPushFunctions.checkWindows(Root['host_osrelease'],'',ClassModel,Root['os_family'])"/>

AFTER

<target_mapping datatype="STRING" name="OSBuildNumber" value="(AMPushFunctions.getEnumValueByKey(ClassModel,Root['os_family'],'os_family_enum')=='windows') ? Root['host_osrelease'] : null"/>

BEFORE

<target_mapping datatype="STRING" name="Workgroup" value="AMPushFunctions.checkWindows(Root['nt_workgroup'],Root['primary_dns_name'],ClassModel,Root['os_family'])"/>

AFTER

<target_mapping datatype="STRING" name="Workgroup" value="(AMPushFunctions.getEnumValueByKey(ClassModel,Root['os_family'],'os_family_enum')=='windows') ? Root['nt_workgroup'] : Root['primary_dns_name']"/>

View solution in original post

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: CP 18 AM Push adapter fails for non-Windows computers

Jump to solution

After evaluating and fixing the code from CP 18 for pushMappingAMComputer.xml I went with the following for our AM Mapping:

<variable name="vWorkGroup"  datatype="STRING" value="AMPushFunctions.fEDDIGetDomainNameEx(Root['primary_dns_name'], Root['domain_name'])"/>
<target_mapping name="OSBuildNumber" datatype="STRING" value="Root['host_osrelease']"/>
<target_mapping name="OSServiceLevel" datatype="STRING" value="(AMPushFunctions.getEnumValueByKey(ClassModel,Root['os_family'],'os_family_enum')=='windows') ? Root['nt_servicepack'] : null"/>
<target_mapping name="Workgroup" datatype="STRING" value="vWorkGroup"/>

Hope that someone else finds this information useful and solves your issue. If you like this post please click the KUDOS button below to say thanks.

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.