Welcome to the VanDyke Software Forums

Join the discussion today!

Go Back   VanDyke Software Forums > Scripting


Thread Tools Rate Thread Display Modes
Old 08-05-2015, 02:46 AM
john.salcedo john.salcedo is offline
Registered User
Join Date: Aug 2015
Posts: 1
Python scripting help (Log-in and retrieve output from multiple devices)

I have 0 experience with regards to scripting, I have only done fundamental research on what language I have to study first. Python looks promising, it is beginner friendly, has a variety of applications, etc. I've looked at the sample Python scripts available at the website but I'm afraid non fits the exact goal I'm trying to achieve. I think I just need a sample working script I could use and whose function I understand to get my feet wet in scripting so if anybody could please provide a working best-practice Python script for the following goal:

x = (x1, x2, ... , xn)
y = (y1, y2, ... , yn)

1. Login to each device via ssh for each element in set x
2. Retrieve output from each device using each element in set y
3. Filter the output using this condition:
Parse the output of y1, look for string 'a', then get b characters that appear after string 'a'. e.g.
'if b=5, the command will get 12345 from the output of y1
4. Save this file using the following wildcard format: <hostname><date>
Please show how to save to a file using both simple text file and to csv file formats.

when using the csv format, how can it appear to be:
x1, y1output, y2output, ynoutput
x2, y1output, y2output, ynoutput
xn, y1output, y2output, ynoutput

Reply With Quote
Old 08-05-2015, 08:55 AM
rtb rtb is offline
VanDyke Technical Support
Join Date: Aug 2008
Posts: 4,306
Hi john.salcedo,

Thanks for the post. Here is an example that you could use to begin your journey:
The VBScript version is better structured, but you could also adapt the Python version to meet your specific needs.

Do these examples help you get started?

VanDyke Software
Technical Support
Reply With Quote

multiple session , python , retrieve output , save to a file

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:32 AM.