Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

Extracting Cisco hardware data from Rancid

$
0
0

Hi all,

I have extracted data from RANCID using egrep across the CVS to provide information on the device FDQN, Chassis Type, Serial No and the part number and serial numbers of any cards or slots occuried.

My problem is having cleaned the data I have the output in a text file, I need to output this to csv to use either in Access or Excel.  However, each device maybe simple e.g. 2950  switch with 4 elements or a complex device e.g. 6509 with multiple slots occupied and various modules in the slots creating an unknown number of lines for the device.

My data runs to around 5 - 6,000 devices.  Normally I would create an PSObject and use that, but I can't see how to do this with data of variable lines output.

Any pointers will be welcomed and helpful.

Environment: XXX
Hostname: xxxx.xx
Chassis type: WS-CBS3020-HPQ - a WS-CBS3020-HPQ router
Processor ID: XXXX
Serial No: XXXX

AND

Environment: XXX
Hostname: XXXX
Chassis type: 1721 - a 1721 router
Processor ID: XXXXL
PID: 1721             
Serial No: XXXX
PID: 1700 Chassis Slot   
Serial No:           
PID: C1721 Mainboard  
Serial No: XXXX
PID: 1700 DaughterCard Slot  
Serial No: XXXX
PID: WAN Interface Card - Serial (1T)1.0
Serial No: XXXX
PID: PowerQUICC Serial   
Serial No: XXXX
PID: 1700 DaughterCard Slot  
Serial No: XXXX

AND

Environment: XXXX
Hostname: xxx.xxx
Chassis type: 2821 - a 2821 router
Processor ID: XXXX
Serial No: XXXX
Serial No: XXXX
Serial No: XXXX

Thank you


Viewing all articles
Browse latest Browse all 8583

Trending Articles