Does SCCM Integration populate the IP Address field on a Computer record?

Nikita Thomas2
Kilo Contributor

Hello,

Does SCCM Integration populate the IP Address field on a Computer record? If yes, please point me to the script/ transform map that does so.

My instance is on the NewYork version and we are using the OOB SCCM 2012 v2 Integration. No modifications have been made to the SQL queries.

I am aware that the IP Address is being pulled in through the data source for Network Adapters but I would like to know if and how this value flows to the Computer record associated with the Network Adapter. Currently, to achieve this requirement I have written a script on the Transform Map for Network Adapters, to populate the IP Address into the corresponding CI.

Please help me with any relevant information.

Thank You,

Nikita

1 ACCEPTED SOLUTION

Andrew Westerv4
Mega Guru

No, the SCCM integrations (up to and including 2016) do not synchronize the IP address from the SCCM Network import. I have also created an onComplete transform script to do the same thing to accomplish this.

 

 

var impSet = new GlideAggregate(import_set.table_name);
impSet.addQuery('sys_import_set', import_set.sys_id);
impSet.addQuery('sys_target_sys_id', '!=', 'NULL');
impSet.groupBy('sys_target_sys_id');
impSet.query();
while (impSet.next()) {
var nic = new GlideRecord('cmdb_ci_network_adapter');
if (nic.get(impSet.sys_target_sys_id)) {
syncIP(nic);
}
}

// Ensure that ip_address field on the base CI is set to one the IP addresses (from cmdb_ci_ip_address) on the NICs, or leave it alone if there were no IPs...
function syncIP(nic) {
//If the ip is already in one of the IPs, then don't go through the IP fix-up...
var IPs = [];
var parentIP = getParentIP(nic.cmdb_ci);
var gr = new GlideRecord('cmdb_ci_network_adapter');
gr.addQuery('cmdb_ci', nic.cmdb_ci);
gr.addQuery('install_status', '!=', 100);
gr.addQuery('ip_address' ,'!=', 'NULL');
gr.orderByDesc('last_discovered');
gr.orderBy('ip_address');
gr.query();
while (gr.next()) {
var ip = gr.ip_address + '';
if (ip == parentIP)
return;

IPs.push(ip);
}

// If there's no IPs, then nuthin' to do...
if (IPs.length == 0)
return;

// If we found a non-localhost IP, then we're done
for (var i = 0; i < IPs.length; i++) {
var nicIP;
try {
nicIP = new SNC.IPAddressV4(IPs[i]);
} catch (e) {
continue;
}

if (!nicIP.isLocalhost() && !nicIP.isLinkLocalAddress()) {
setParentIP(nic.cmdb_ci, nicIP.toString());
return;
}
}

//If we get here, then no good IP is available... so no need to update
}

function setParentIP(ci, ip) {
var gr = new GlideRecord('cmdb_ci_hardware');
if (gr.get(ci)) {
gr.ip_address = ip;
gr.update();
}
}

function getParentIP(ci) {
var gr = new GlideRecord('cmdb_ci_hardware');
if (gr.get(ci))
return gr.ip_address + '';
}

View solution in original post

5 REPLIES 5

KKrabbenhoft
Tera Guru

I am trying to use a robust transform in Integration Hub ETL. I want to go from the network transform column ip address and map this column to map this column to the cmdb_ci_computer table. 

If I look at the cmdb_ci_ip_address table I do see computer listed. I have tried using a basic relationship in IH-ETL but this does not produce the results I need. Is anyone else trying to get the ip address to populate in this way? 






@Nikita Thomas2 wrote:

Hello,

Does SCCM Integration populate the IP Address field on a Computer record? If yes, please point me to the script/ transform map that does so.

My instance is on the NewYork version and we are using the OOB SCCM 2012 v2 Integration. No modifications have been made to the SQL queries.

I am aware that the IP Address is being pulled in through the data source for Network Adapters but I would like to know if and how this value flows to the Computer record associated with the Network Adapter. Currently, to achieve this requirement I have written a script on the Transform Map for Network Adapters, to populate the IP Address into the corresponding CI.

Please help me with any relevant information.

Thank You,

Nikita



@Nikita Thomas2 wrote:

Hello,

Does SCCM Integration populate the IP Address field on a Computer record? If yes, please point me to the script/ transform map that does so.

My instance is on the NewYork version and we are using the OOB SCCM 2012 v2 Integration. No modifications have been made to the SQL queries.

I am aware that the IP Address is being pulled in through the data source for Network Adapters but I would like to know if and how this value flows to the Computer record associated with the Network Adapter. Currently, to achieve this requirement I have written a script on the Transform Map for Network Adapters, to populate the IP Address into the corresponding CI.

Please help me with any relevant information.

Thank You,

Nikita