cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3874
Views
1
Helpful
5
Replies

Cisco IOS show commands output format/pattern

marcass2218
Level 1
Level 1

Hi, i am currently developing a java application to extract data from log files which captured from Cisco routers and switches. Those log files contains output of show commands like show version, show inventory, show process memory, show process cpu, show environment all, show tech-support, etc. To be able to extract the data, my app must be able to recognize the pattern or format of the output for all the Cisco routers and switches. Is there any references or example output of show commands for all the Cisco switches and router ? 

5 Replies 5

Leo Laohoo
Hall of Fame
Hall of Fame
Hi, i am currently developing a java application to extract data from log files which captured from Cisco routers and switches. 

Why don't you just get the output sent to your TFTP server.  For example, you can use the command "sh run | redirect tftp://<TFTP IP address>/filename.txt".

Thx for reply ! =) . Sorry I have made my question unclear to you. What I mean  is how to read the output in filename.txt. In order to able to analyst the output in filename.txt, what I am trying to do is by recognizing some keyword, for example to get the IOS version from the output of sh ver, I will try to find the line which contains the keyword "Cisco IOS Software" at front. So I need to know the format/pattern of the output in the filename.txt. Is there any references or example output of show commands for all the Cisco switches and router ? 

In order to able to analyst the output in filename.txt, what I am trying to do is by recognizing some keyword, for example to get the IOS version from the output of sh ver, I will try to find the line which contains the keyword "Cisco IOS Software" at front. 

Command:  sh version | include Cisco IOS Software

You can use the command references for each IOS and/or device where they give examples of outputs.

These can be found by a simple internet search eg "IOS and/or device command reference".

A lot of them will be the same but as there are variants of IOS and NXOS and different devices, especially relevant to switches, the output may differ.

In addition a lot of devices can use modules and so the output can differ greatly depending on what is and isn't installed.

In effect your application needs a sort of template which matches IOS or variant and model of device and then it imports this so it knows where to look in the output for the required commands.

It can be a trial and error procedure and when I was doing automation a tedious process. I often had to log into every different type of device and record where the fields were and what to look for and then, as I say, record all this in a template file that the script would load on startup.

However that was a while back so you may find standardised templates that have done all the hard work for you.

Or you may not :-)

Jon

TheSlyOne
Level 1
Level 1

A Bit Late for a reply, but others may have the same question as I did.

 

From https://www.cisco.com/c/en/us/td/docs/ios/fundamentals/command/reference/cf_book/cf_s4.html#wp1499591

 

Cisco IOS Software, <platform> Software (<image-id>), Version <software-version>,  
<software-type>
 Technical Support: http://www.cisco.com/techsupport
 Copyright (c) <date-range> by Cisco Systems, Inc.
 Compiled <day> <date> <time> by <compiler-id>

 ROM: System Bootstrap, Version <software-version>,  <software-type>
 BOOTLDR: <platform> Software (image-id), Version <software-version>,  <software-type>

 <router-name> uptime is <w> weeks, <d> days, <h> hours, <m> minutes
 System returned to ROM by reload at <time> <day> <date>
 System image file is "<filesystem-location>/<software-image-name>"
 Last reload reason: <reload-reason>

 Cisco <platform-processor-type> processor (revision <processor-revision-id>) with 
<free-DRAM-memory>K/<packet-memory>K bytes of memory.
 Processor board ID <ID-number>
 <CPU-type> CPU at <clock-speed>Mhz, Implementation <number>, Rev <Revision-number>, 
<kilobytes-Processor-Cache-Memory>KB <cache-Level> Cache