Sometimes you just want to get the results of custom commands quickly.
Here is what the command group contains for collection:
show ip bgp summary
show environment
show interface status
show ip route
show port-channel summary
show lldp neighbors
show ip arp vrf all
show ip arp
show mac address-table
show inventory
show interfaces
show cdp neighbors
show ip ospf interface
show ip ospf neighbors
Here’s a template NXOS
/**
* @intent NX-OS Multi-Command
**/
getCommandResponse(device, commandText) =
max(foreach command in device.outputs.commands
where command.commandText == commandText
select command.response);
main =
foreach device in network.devices
where device.platform.vendor == Vendor.CISCO
where device.platform.os == OS.NXOS
where device.name == device.system.physicalName
let bgpSummary = getCommandResponse(device, "show ip bgp summary")
let environment = getCommandResponse(device, "show environment")
let interfaceStatus = getCommandResponse(device, "show interface status")
let ipRoute = getCommandResponse(device, "show ip route")
let portChannel = getCommandResponse(device, "show port-channel summary")
let lldpNeighbors = getCommandResponse(device, "show lldp neighbors")
let arpVrfAll = getCommandResponse(device, "show ip arp vrf all")
let arp = getCommandResponse(device, "show ip arp")
let macTable = getCommandResponse(device, "show mac address-table")
let inventory = getCommandResponse(device, "show inventory")
let interfaces = getCommandResponse(device, "show interfaces")
let cdpNeighbors = getCommandResponse(device, "show cdp neighbors")
let ospfInterfaces = getCommandResponse(device, "show ip ospf interface")
let ospfNeighbors = getCommandResponse(device, "show ip ospf neighbors")
select {
device: device.name,
ip: device.snapshotInfo.collectionIp,
model: device.platform.model,
os: device.platform.osVersion,
"BGP Summary": if isPresent(bgpSummary) then bgpSummary else "No Data",
"Environment": if isPresent(environment) then environment else "No Data",
"Interface Status": if isPresent(interfaceStatus) then interfaceStatus else "No Data",
"Interfaces": if isPresent(interfaces) then interfaces else "No Data",
"IP Route": if isPresent(ipRoute) then ipRoute else "No Data",
"Port-Channel": if isPresent(portChannel) then portChannel else "No Data",
"CDP Neighbors": if isPresent(cdpNeighbors) then cdpNeighbors else "No Data",
"LLDP Neighbors": if isPresent(lldpNeighbors) then lldpNeighbors else "No Data",
"OSPF Interfaces": if isPresent(ospfInterfaces) then ospfInterfaces else "No Data",
"OSPF Neighbors": if isPresent(ospfNeighbors) then ospfNeighbors else "No Data",
"ARP VRF All": if isPresent(arpVrfAll) then arpVrfAll else "No Data",
"ARP": if isPresent(arp) then arp else "No Data",
"MAC Table": if isPresent(macTable) then macTable else "No Data",
"Inventory": if isPresent(inventory) then inventory else "No Data",
};
main()




