Hello...
I'd like to run a script that executes a command on all of the access ports on all the switches in my network. Is this possible with NCM?
If not, does anyone know of a technology that can do this?
-neo
I don't know of a way to do this directly within NCM (someone correct me if I'm wrong), but you might be able to do it in several steps:
1) Run a command script to identify all the access ports on the switch. On IOS-based Cisco switches, something like this should work:
show interface status | exclude trunk|routed
Have NCM save the results to files for each switch.
2) Use your favorite text parsing tool (shell, perl, Excel, etc) to extract the interface names from the output. In shell-speak, something like this:
awk '{print $1}' filename.txt
would extract the interface names from the "show interface status" output and get a list like:
Gi1/1
Gi1/2
etc.
3) Massage that into "interface range" commands, then execute a command script to make your changes:
interface range Gi1/1 , Gi1/2
spanning-tree portfast bpduguard enable
I think there is a limitation on how long an interface range command can be, but I'm not sure what it is.
jswan, you're correct and thanks for posting an alternative approach.
I do want to point out that we're working on making this much easier. As noted in this post, we're working on advanced scripting which will enable you to do the following: