Posted by mansoorx (mansoorx), 29 August 2006Hello,
I am using expect to retrive information from the Cisco Devices, e.g,
"show interface descrition" display the list of all interfaces of the Cisco Devices,
Problem is that if the Devices interface is 24 Ports expect_out(buffer) store the result, but when port of the switch is 48 Ports expect_out(buffer) do not store the result of Cisco Commnads,
So how can i increase the Size of Expect out Buffer.
Posted by admin (Graham Ellis), 29 August 2006Are you sure you have a buffer size problem rather than a timeout problem? The buffer is dynamic and I wouldn't anticipate that size would be an issue, but the timeout might if the router / network takes a while.
Posted by mansoorx (mansoorx), 30 August 2006Thank You for a reply,
I think there is no timeout issue, i have observe, anyhow what will be the solutiuon of this problem ? because i do it manully and its very panic
Posted by admin (Graham Ellis), 30 August 2006The default time out is 10 seconds, and you can change it with:
set timeout 75
to change it to 75 seconds (or any other number of seconds you wish, of course.
How do you know that you don't have a time out issue? Have you already added a timeout option to your expect command and found that it wasn't activated?
Posted by mansoorx (mansoorx), 31 August 2006I am using this Script to reterive Description of Switch Ports, i have checked by timeout but donot work, default timeout is already more than enough (10 Second) there is any other issue, because is i store description of almost 36 Port it store the Decription, but when i increase the Switch descrition upto 48 or even 40 it doesnot store, it mean its a buffer size problem not timeout.
spawn telnet IP
expect [lindex $argv 1]
send "show int des\r"
#set timeout 15
expect [lindex $argv 1]
set swdes [open swdes.txt a+];
set tempvarl2 $expect_out(buffer);
#set IP = $argv 0;
puts $swdes $tempvarl2;
#puts $argv 0;
Posted by admin (Graham Ellis), 31 August 2006At the next step then, I would be tempted to add a loop of expects to expect each port back one by one and handle them that way.
Posted by mansoorx (mansoorx), 8 September 2006Ok,
By using Loop i cannot get a desire information,
because when i send a "sh int des | include Fa0/3" not only port 3 inforamtion out but information of all 30 to 39 port is also collected because the infrmation of the 30 to 39 port is also match with the desired information,
2nd thing where should i put the set timeout in our script,
Posted by admin (Graham Ellis), 8 September 2006Use Tcl commands like "if" to filter out the return strings you don't want
Use expect -i to expect from multiple sources.
Would you like an example, or is that enough to go on?
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: firstname.lastname@example.org • WEB: http://www.wellho.net • SKYPE: wellho