[c-nsp] Extracting serial numbers from Show techs ?

Arnold Nipper arnold at nipper.de
Thu Sep 6 05:32:12 EDT 2007


On 06.09.2007 10:58 kevin gannon wrote

> Does anyone know of or have a script that will take in a "show tech"
> and extract the part numbers and serial numbers ?
> 
> I know Cisco works does this but I want an offline tool that can
> extract the information. That will handle things like seeing the
> chassis serial numbers and psu from 6500s.
> 

Wouldn't the output of "show inventory | incl PID" be more handy for
processing?

E.g.

sw001#show inventory | i PID
PID: WS-C6509-NEB-A    , VID:    , SN: FOX0721xxxx
PID: WS-C6K-VTT        , VID:    , SN: NWG0720xxxx
PID: WS-C6K-VTT        , VID:    , SN: NWG0718xxxx
PID: WS-C6K-VTT        , VID:    , SN: NWG0720xxxx
 ....
PID: WS-CAC-4000W-INT  , VID:    , SN: SON0511xxxx
PID: WS-CAC-4000W-INT  , VID:    , SN: SON0736xxxx


Piping this to "awk '{print $2, $7}'" would do what you need. Using
rancid (http://www.shrubbery.net/rancid/) you simply would say:


clogin -c"show inventory | i PID" sw001 | awk '/^PID:/ {print $2, $7}'



Arnold
-- 
Arnold Nipper / nIPper consulting, Sandhausen, Germany
email: arnold at nipper.de       phone: +49 6224 9259 299
mobile: +49 172 2650958         fax: +49 6224 9259 333


More information about the cisco-nsp mailing list