# This routine parses "show inventory".
sub ShowInventory {
print STDERR " In ShowInventory: $_" if ($debug);
while (<INPUT>) {
tr/\015//d;
return if (/^\s*\^$/);
last if (/^$prompt/);
next if (/^(\s*|\s*$cmd\s*)$/);
return(1) if /Line has invalid autocommand /;
return(1) if /(Invalid input detected|Type help or )/;
return(-1) if (/command authorization failed/i);
# the pager can not be disabled per-session on the PIX
if (/^(<-+ More -+>)/) {
my($len) = length($1);
s/^$1\s{$len}//;
}
if (/^(NAME: "[^"]*",) (DESCR: "[^"]+")/) {
ProcessHistory("INVENTORY","","", sprintf("!%-30s %s\n", $1,
$2));
next;
}
# split PID/VID/SN line
if (/^PID: (\S*)\s*, VID: (\S*)\s*, SN: (\S*)\s*$/) {
my($entries) = "";
$entries .= "!PID: $1\n" if ($1);
$entries .= "!VID: $2\n" if ($2);
$entries .= "!SN: $3\n" if ($3);
ProcessHistory("INVENTORY","","", "$entries");
next;
}
ProcessHistory("INVENTORY","","","!$_");
}
ProcessHistory("INVENTORY","","","!\n");
return(0);
}
And add this to your command table:
@commandtable = (
{'show inventory raw' => 'ShowInventory'},
---
Andrew Elliott
XO Communications
desk: 989.758.6987
cell: 989.213.5794
________________________________
From: Yuval Ben Ari [mailto:***@gmail.com]
Sent: Sunday, March 02, 2008 9:13 AM
To: Elliott, Andrew
Cc: rancid-***@shrubbery.net
Subject: Re: [rancid] Re: GSR 12k - sho diag / missing subslot
spa info
I am also having the same problem, and I am also interested to
have the S/N of the SPA
Indeed "show inventory" seems the best way to do it.
has anyone added "show inventory" parser yet?
otherwise I can try to add it and post here.
Yuval
On Wed, Jun 27, 2007 at 10:50 PM, Elliott, Andrew
Post by Elliott, AndrewPost by Elliott, AndrewHello,
I have been recently asked that my router backups
include
Post by Elliott, Andrewthe SUBSLOT
Post by Elliott, Andrewline from 'sho diag' on the 12k's.
Here is an example (trimmed for brevity) of the
output I
Post by Elliott, Andrewwant rancid to
Post by Elliott, AndrewSLOT 1 (RP/LC 1 ): Modular SPA Interface Card (10G)
-snip-
subslot 1/0: SPA-10X1GE-V2 (0x508), status
is ok
Post by Elliott, AndrewPost by Elliott, Andrewsubslot 1/1: Empty
subslot 1/2: Empty
subslot 1/3: Empty
SUBSLOT 1/0 (SPA-10X1GE-V2): 10-port Gigabit
Ethernet Shared Port
Post by Elliott, AndrewPost by Elliott, AndrewAdapter
Product Identifier (PID) : SPA-10X1GE-V2
-snip-
This is a new card type that we have recently begun
deploying, and
Post by Elliott, AndrewPost by Elliott, Andrewcurrently all that is backed up is the main SPA IC
information, not the
Post by Elliott, Andrewinfo on the "SUBSLOT" or "SPA -> subslot" lines.
I'd need to have the complete output; I don't have
GSRs anymore.
CHR1.NYC-NY#sho diag 1
SLOT 1 (RP/LC 1 ): Modular SPA Interface Card (10G)
MAIN: type 149, 00-0000-00 rev A0
Deviation: D090170
HW config: 0x20 SW key: 00-00-00
PCA: 00-00000-00 rev A0 ver 4
Design Release 1.0 S/N SAD000000M0
MBUS: Embedded Agent
Test hist: 0x00 RMA#: 00-00-00 RMA hist:
0x00
DIAG: Test count: 0x00000000 Test results:
0x00000000
FRU: Linecard/Module: 12000-SIP-601=
Processor Memory: MEM-LC5-2048=(Non-Replaceable)
Packet Memory: MEM-LC5-PKT-256=(Non-Replaceable)
L3 Engine: 5 - ISE 10 Gbps
MBUS Agent Software version 2.51 (RAM) (ROM version is
3.50)
ROM Monitor version 17.1
Fabric Downloader version used 4.1 (ROM version is 4.1)
Primary clock is CSC 1
Board is analyzed
Board State is Line Card Enabled (IOS RUN )
Insertion time: 00:22:52 (2w4d ago)
Processor Memory size: 2147483648 bytes
TX Packet Memory size: 268435456 bytes, Packet Memory
pagesize: 32768
bytes
RX Packet Memory size: 268435456 bytes, Packet Memory
pagesize: 32768
bytes
0 crashes since restart
SPA Information:
subslot 1/0: SPA-10X1GE-V2 (0x508), status is ok
subslot 1/1: Empty
subslot 1/2: Empty
subslot 1/3: Empty
CHR1.NYC-NY#
Post by Elliott, AndrewPost by Elliott, AndrewIt is possible I am using a version of rancid that
needs to
Post by Elliott, Andrewbe upgraded
possibly. 'show inventory' has been added and that
ought to
Post by Elliott, Andrewinclude this
information...if cisco has gotten around to adding it
to this platform
Looks like this might be the best way to go.