Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 09-28-2009, 10:35 AM
tarrasque tarrasque is offline
Registered User
 
Join Date: Nov 2006
Posts: 2
secureCRT help required

wonder if anyone can help me

i use an already robust script to log onto multiple devices and issue commands and capture the output..however this is stumping me


this is the subroutine i'm calling..i previously pulled another command and passed the output to excel, this should read in the list of ip address' and then issue the command with the IP in the middle

its getting the ip address correcly from excel..its issuing the command thats causing me the problem

i pass the worksheet details and start and finish rows to the sub



sub neighbours(nstart,nfinish,ws)
dim tip(100)

crt.Screen.Synchronous = True

for ineigh=nstart to nfinish
tipc=ineigh-nstart
tip(tipc) = "Show ip bgp neighbors " & ws.Cells(ineigh, 3).Value & " received-routes" 'gets list of ip address'
next

for i6=0 to tipc 'step through IP address'

crt.Screen.Send tip(i6) & VbCr 'sends command


*************
it sends the command, but then just hangs instad of completing the loop ..pressing enter on the console will bomb out of the loop and execute the next sub

crt.Screen.WaitForString "#"


strResult3 = crt.Screen.ReadString("#")

*********rest of code...but it never gets here



this is the console output on screen

hostname#Show ip bgp neighbors xx.xx.xx.xx received-routes
BGP table version is 129386411, local router ID is xxxx.xxxx.xxxx.xxx
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path
* xx.xx.xxx.xxx/27 xx.xxx.xx.xx 1000 0 65489 i
* xx.xx.xx.xx/27 xx.xxx.xx.xx 1000 0 65489 i

Total number of prefixes 2
hostname#

at this point unless i press enter, the script hangs...when i press enter, it bombs out of the loop and picks up the next subroutine

any clever ideas ?
Reply With Quote
  #2  
Old 09-28-2009, 10:58 AM
miked's Avatar
miked miked is offline
Registered User
 
Join Date: Feb 2004
Posts: 2,040
Hello tarrasque,

It sounds like the code may be stuck on ReadString. I'm guessing that pressing the Enter key causes the "#" prompt to appear, and then causes the code to step past the ReadString. Can you verify where the code is getting stuck by using MsgBox at appropriate places?
Code:
    MsgBox "Calling crt.Screen.ReadString"
    strResult3 = crt.Screen.ReadString("#")
    MsgBox "Past crt.Screen.ReadString"
Without seeing all of the code I don't know why the code would bomb out of the loop. It may be a problem you run into after fixing the first problem.

Could you send your entire script to support@vandyke.com with subject "Forum thread 4048, attn Mike" so that I can get a better overall picture of how the script should work?
__________________
Mike
VanDyke Software
Technical Support
[http://www.vandyke.com/support]

Last edited by miked; 09-28-2009 at 01:44 PM.
Reply With Quote
  #3  
Old 09-28-2009, 01:10 PM
tarrasque tarrasque is offline
Registered User
 
Join Date: Nov 2006
Posts: 2
its stuck before it executes the readstring
if i press enter, it then does the readstring which of course is blank!

i will mail the code later as i'm on a different machine

Chris
Reply With Quote
  #4  
Old 09-28-2009, 01:57 PM
miked's Avatar
miked miked is offline
Registered User
 
Join Date: Feb 2004
Posts: 2,040
Thanks, I'll watch for your e-mail.

If you were to put a timeout in the ReadString call then I suspect the code would make it past ReadString. For example, the following will timeout after 10 seconds.
Code:
    strResult3 = crt.Screen.ReadString("#", 10)
If the timeout causes the code to proceed past the ReadString then at least you know that the code is stopped on the ReadString line. Knowing this may or may not help.

Looking at the code and possibly running the code with a raw log file will help us see why the code isn't working the way you want it to work.

When you e-mail the code could you also send a raw log file?

To create a raw log:
1. Before connecting with the session, select "Raw Log Session" from SecureCRT's "File" menu.

2. In the "Select Log File" dialog, choose a folder and filename in which you would like the log text to be stored and press the "Save" button. At this point, if you open the "File" menu, you will notice that the "Raw Log Session" menu item now has a check-mark next to it; this indicates that raw logging is activated.

3. Now connect to the remote machine and perform the actions which cause the reported problem to occur.

4. Once the problem occurs, disconnect the session and select "Raw Log Session" from the "File" menu to turn off the raw logging feature.

5. Browse to the location of the raw log file and add the file as an attachment to your e-mail reply.
__________________
Mike
VanDyke Software
Technical Support
[http://www.vandyke.com/support]
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 02:19 AM.