06-28-2010 05:19 PM
Hello everyone.
I want to capture the output of 'show interface status' to text files for our +600 switches. Unfortunately, we have many old 2924's and other models running code prior to 12.0(21) that cannot support 'show command | redirect tftp....' My hope was to use this command set and run it in an Expect script to capture this information on a daily basis. Running the 'show interface status' in an Expect script is pretty easy, but I cannot see how to capture the show command output to a file for transfer to a server. Has anyone else faced this problem and found a solution?
Thanks,
06-29-2010 09:35 AM
I had the same problem. You may want to look into a perl script to output the information into a text file, and then use the same perl script to then transfer the text file to whereever you need it.
HTH,
John
06-29-2010 04:40 PM
Thanks John,
I may end up doing that but I've found an Expect script to open a text file and I'm seeing what I can do with it. Let's see how long it will take to run and open +600 files.
07-02-2010 07:00 AM
If you can, could you share the script location? It sounds like a handy one to have in the tool box.
07-02-2010 08:10 AM
To write the "show" commands output to a text file in Expect/Tcl:
set filename "/path/to/output.file"
exp_send "show running\r"
set var $expect_out(buffer);
set fid [open ${filname} w+]
put $fid $var
close ${fid}
Large "show" output can often exceed the default size of $expect_out(buffer) however. This can be tuned accordingly:
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide