Skip to main content
Solved

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

  • January 9, 2025
  • 2 replies
  • 97 views
  • Translate

Forum|alt.badge.img+2

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

Best answer by Rich

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
}

 

View original
Did this topic help you find an answer to your question?

2 replies

Rich
Employee
  • Employee
  • 2 replies
  • Answer
  • January 9, 2025

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
}

 

Translate

Forum|alt.badge.img+2

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

Translate

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings