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 10-11-2020, 10:20 AM
dsautter dsautter is offline
Registered User
 
Join Date: Jun 2007
Posts: 11
Loop on While Not {name}.atEndOfStream connection list.

I would like to create a VBS script what would connect to multiple hosts and collect data. Pause a specified amount of time and then reconnect to each device and collect the data again.

1. do while x
2. Connect to each device
3. Collect output from show commands
4. End
5. Pause a prefined time
6. loop x

Please see the attached script for more details. Currently I have two duplicate sections with a different "While Not {}.atEndOfStream". Instead I would like to loop back to the top.
Reply With Quote
  #2  
Old 10-12-2020, 09:12 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,474
Hi dsautter,

There was nothing attached.

What version of SecureCRT are you using?

On what platform?

If Windows and if you are making your connections within the script, this would seem like the sort of task where you might use a SecureCRT command-line:

SecureCRT /Script "Path_to_my_script"
And maybe run it as a scheduled task at the desired interval.

If you do post the script, please elaborate on what undesired behavior you are seeing.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 10-12-2020, 10:14 AM
dsautter dsautter is offline
Registered User
 
Join Date: Jun 2007
Posts: 11
Script attached

Hello Brenda,

The version is 8.7.1 on Windows 2008 R2 server.

Currently the only way to accomplish what I'm trying is to have multiple sections where it would be great to have the one section and just loop through it.

Thanks,
Don
Attached Files
File Type: zip ASR1K-SOAK-TEST-2.vbs.zip (1.7 KB, 36 views)
Reply With Quote
  #4  
Old 10-12-2020, 11:57 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,474
Hi Don,

I'm trying to understand the relevance of the source files. What is the reason for separate files? Why wouldn't you just have one file for reading in all the devices?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #5  
Old 10-12-2020, 01:44 PM
dsautter dsautter is offline
Registered User
 
Join Date: Jun 2007
Posts: 11
Response

Hello Brenda,

Let me see if I can explain what I'm trying to accomplish.

We want to run a test over a 48 period. Within the 48 hours, we want to connect to all the devices in the list, grab outputs from show commands, and then pause for 4 hours. After the 4 hours, connect to all the devices again, run the same commands, and repeat 11 more times.

Time 0
top
While Not DeviceIP2.atEndOfStream "Connect to each device"
collect outputs
end if
wend
sleep for 4 hours
loop to top

I'm struggling with the outer loop, pause four hours, then go back to the "While Not DeviceIP2.atEndOfStream" to start the process of connecting to all devices and running the show commands.
Reply With Quote
  #6  
Old 10-12-2020, 03:17 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,474
Hi Don,

I still don't understand the need for multiple DeviceIP# files.

Since the time iterator is known and VBScript functions can determine exact number of hosts in the file, I would just do this with two For/Next loops:

Code:
read source file
split ip's into array
for x = 0 to 11
    for y = 0 to ubound(hosts)
        connect
        run cmds
        log output
    next
    sleep 4 hrs
next
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #7  
Old 10-13-2020, 08:21 AM
dsautter dsautter is offline
Registered User
 
Join Date: Jun 2007
Posts: 11
Reply

Hello Brenda,

I removed the second section and uploaded the script with comments to try and simplify the ask.

Hope this helps.

Thanks,
Don
Attached Files
File Type: zip ASR1K-SOAK-TEST-RUN.vbs.zip (1.7 KB, 31 views)
Reply With Quote
  #8  
Old 10-14-2020, 02:12 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,474
Hi Don,

I posted what I felt was a reasonable alternative. I don't know how to accomplish it in the way you apparently want to accomplish it.

So we will just have to leave this open for community input.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
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 06:17 AM.