cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post

How to built a Report or SWQL query /job to do some work and then display contents of directories and lines of configuration in Cisco switches?

I recently upgraded switches hosting over 17,000 switchports successfully with NCM's Job function.  (It's not as big a job as you think--it took NCM 15 minutes to do the job for me, across 42 Cisco 4510 chassis switches)

I also have built scripts to push out to the switches via NCM to remove obsolete boot variables, and to delete unused files in bootflash: and slavebootflash:   Again, not too tough with NCM pushing it all out to groups of switches.  The problem becomes having to review each one's status/details by manually going into NCM Transfer Status and opening every single switch's details.  It's pretty tedious, and computers should be able to do the job more efficiently--if only I knew how to make this so.

Finally I created a script to verify all of the above steps completed successfully.  But I'm not satisfied with doing it this way--for the same reasons stated above.  Checking/confirming successful operation of each step is tediously maual.  I'd like to learn if and how some or all of this can be done with better automation, delivering better information.  Specifically:

(I've omitted the step of pushing or pulling the new IOS to the bootflash and slavebootflash for simplicity--this is complicated enough already)

  1. Confirm the config-register on each switch reads 0x2102.
    1. If not, issue these commands
      1. config t
      2. config-register 0x2102
      3. end
      4. write memory
  2. Confirm 0x2102 is going to be applied to them on the next reboot:
    1. show bootvariable | in 0x2102
  3. Confirm the correct version of IOS is present in bootflash and in slavebootflash:
    1. dir bootflash:*03.08.09*
    2. dir slavebootflash:*03.08.09*
  4. Set the boot variable to remove the old boot variable lines and install new ones:
    1. conf t
    2. no boot system flash bootflash:cat4500es8-universalk9.SPA.03.08.01.E.152-4.E1.bin
    3. boot system flash bootflash:cat4500es8-universalk9.SPA.03.08.09.E.152-4.E1.bin
    4. boot system flash bootflash:cat4500es8-universalk9.SPA.03.08.01.E.152-4.E1.bin
    5. end
    6. wr

After the upgrade is complete:

  1. sho ver | in 03.08.09
    1. If the above is true, proceed. 
    2. If the above is not true, stop and request help
  2. Remove the old code from bootflash and slavebootflash
    1. delete bootflash:[old IOS code version .bin|
    2. delete slavebootflash:[old IOS code version .bin|
  3. Confirm only the desired IOS version is present in bootflash and slavebootflash:
    1. dir bootflash:*4500*
    2. dir slavebootflash:*4500*

Finally, I want a report with nicely-aligned columns that gives the equivalent output of these commands:

  • sho ver | in 03.08.09
  • sho run | in bootfl
  • sho bootvar

I know how to do all these in simple groups of commands pushed by NCM into groups of switches, but not how to do it all in a single operation, nor how to even get it working in a nice report that doesn't require me to open the NCM Transfer Status > individual-switch-outputs of "Show Script Results"

Is it possible?  Feasible?

Which SWQL (or other) Master can teach me some new Net-Fu?

0 Kudos