Skip to main content

For any users that may be looking to leverage a query to gather information on devices to compare with an existing CMDB inventory, or looking to import data into their existing CMDB to update inventory. Please checkout this NQE:

 

/**
* @intent Basic information about Network Devices for CMDB import/compare
*/
formatStatus(deviceSnapshotResult) =
when deviceSnapshotResult is
collectionFailed(collectionError) ->
"Collecting - " +
replace(toString(collectionError), "DeviceCollectionError.", "");
completed -> "Completed";
processingFailed(processingError) ->
"Processing - " +
replace(toString(processingError), "DeviceProcessingError.", "");
foreach device in network.devices
let platform = device.platform
let snapshotInfo = device.snapshotInfo
foreach component in platform.components
select {
Name: device.name,
Location: device.locationName,
Tags: device.tagNames,
Vendor: platform.vendor,
Model: platform.model,
"Part Serial Number": component.serialNumber,
"Interface Count": length(device.interfaces),
OS: platform.os,
"OS Version": platform.osVersion,
"Collection IP": snapshotInfo.collectionIp,
"Management IP(s)": platform.managementIps,
Status: formatStatus(device.snapshotInfo.result),
Type: platform.deviceType
}

It is easily customizable to add/remove fields.

Be the first to reply!

Reply