Skip to main content

How can i get the config register value for cisco devices ?

Here are two NQEs that will return what you are looking for.

This version will show all of the output from the ‘show version’ command and only looks at Cisco devices running IOS, IOS XE, and IOS XR.

/**
* @intent Find Configuration register in Cisco devices
* @description Find the Configuration register line from the 'show version' command
*/

foreach device in network.devices
where device.platform.vendor == Vendor.CISCO
where device.platform.os == OS.IOS || device.platform.os == OS.IOS_XE ||
device.platform.os == OS.IOS_XR

let platform = device.platform
let outputs = device.outputs
foreach line in outputs.commands

where matches(line.response, "*Configuration register*")
select{
name: device.name,
match: line.response
}

This NQE will look at all Cisco devices and search through the output from the ‘show version’ command and returns just the Configuration Register Value.

/**
* @intent Checks configuration register value for Cisco devices
* @description Outputs Configuration Register value
*/

foreach device in network.devices
where device.platform.vendor == Vendor.CISCO
foreach command in device.outputs.commands
where command.commandType == CommandType.VERSION
let lines = parseConfigBlocks(OS.UNKNOWN, command.response)
foreach line in lines
where matches(line.text, "*Configuration register*")
let output = substring(line.text, 26, length(line.text))

select {
device: device.name,
"Configuration Register Value": output
}

 


Thanks ​@Rich  , really helpful , its work for me.


Reply