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 05-14-2013, 01:59 PM
gunslingor gunslingor is offline
Registered User
 
Join Date: May 2013
Posts: 27
Talking First networking script, interfaces, introduction

Hi all, I'm new to scripting for networking... in the past, I've written scripts for all types of hosts and clients, but I always ran these locally and now I'm a telecom engineer and I'm only dealing with networking devices currently. So I need some background and info to point me in the right direction.

So here is what I am trying to accomplish: basically, to start, I'm trying to get basic interface data out of all our cisco products and into a database. The fields defined in this DB currently include the following:

key - the device key for which all the below belong to.
INTERFACE - interface name/designation
IP_ADDRESS - obvious
SUBNET_MASK - obvious
MAC_ADDRESS - obvious
DOMAIN_NAME - obvious
DESCRIPTION - obvious
VLN_INTERFACES -which physical interfaces belong to which VLAN
STANDBY_IP - the failover IP
NOTES - obvious

Right now I'm attacking this task for the catalyst 2950/60s; once I get this I far I should have all the knowledge I need to carry the task further.

I've experimented with a number of commands (e.g "show ip interface brief" and "show vlan brief") that show some of this data, but obviously not in a DB importable form.

1. So the first question is, "will it be possible to precisely get this output in a DB importable form using the pipe operator, or is this just far to much customizing for the pipe to handle?". If yes, got any hints?
2. In the script, or even in the session itself, how do I make the output go to a text file or similar so that it can be imported directly without having to COPY/PASTE(perhaps parsed first if necessary, which I can handle that part)?
3. How do I run/create scripts that, I suppose, would use secureCRT or putty to a) connect b)run the script c)output to a text file on my computer.
4. What's the best web reference you guys know of for whatever scripting language you're going to tell me to use?

I may actually try connecting locally at the console port using putty instead of remotely using secure CRT, fyi.... this is prefered since I'm newer on the networking stuff.

Any comment is appreciated... I feel I just need a little help getting my feet wet... I've never met a programming language I couldn't tackle, but this situation is a bit different due to the unfamilar components and potentially remote accesses over a WAN/LAN.
Reply With Quote
  #2  
Old 05-14-2013, 05:38 PM
miked's Avatar
miked miked is offline
Registered User
 
Join Date: Feb 2004
Posts: 2,040
Greetings gunslingor,

Thanks for posting your scripting / automation questions.

Quote:
1. So the first question is, "will it be possible to precisely get this output in a DB importable form using the pipe operator, or is this just far to much customizing for the pipe to handle?". If yes, got any hints?
I'm not familiar with the pipe operator but am assuming that's a Cisco Catalyst related question. Perhaps a Cisco engineer would like to answer.

Quote:
2. In the script, or even in the session itself, how do I make the output go to a text file or similar so that it can be imported directly without having to COPY/PASTE(perhaps parsed first if necessary, which I can handle that part)?
You could use SecureCRT's logging to create a log file containing all of the output, then parse it later using your scripting language of choice to get the information you want. Alternatively, you could run a script from within SecureCRT and read the data, parsing as you go.

Quote:
3. How do I run/create scripts that, I suppose, would use secureCRT or putty to a) connect b)run the script c)output to a text file on my computer.
SecureCRT can host a script engine, so you can run scripts directly from SecureCRT.

Quote:
4. What's the best web reference you guys know of for whatever scripting language you're going to tell me to use?
The SecureCRT Scripting Guide provides information that I believe you'll find useful: Starting from Scratch with a New Script, Recording a Script, Connecting to Remote Machines, Reading Data from Remote Machines, Sending Data to Remote Machines, and more. There are complete examples, and fully explained.

Quote:
I may actually try connecting locally at the console port using putty instead of remotely using secure CRT, fyi.... this is prefered since I'm newer on the networking stuff.
SecureCRT supports the serial protocol so you don't need two different emulators.
__________________
Mike
VanDyke Software
Technical Support
[http://www.vandyke.com/support]
Reply With Quote
  #3  
Old 05-15-2013, 06:59 AM
gunslingor gunslingor is offline
Registered User
 
Join Date: May 2013
Posts: 27
Thanks, this should help out a lot.

"Alternatively, you could run a script from within SecureCRT and read the data, parsing as you go."
-This is prefered... parse it before it goes into the text/import file rather than parsing just the command outputs from within my DB... primarily because each device will likely require modifications to the script and I feel the script is the most appropriate spot for all this variably, rather than cluttering up my DB. However, later, I may want to initiate the script from the DB for one click importing. The script will likely grow later, gathering even more configuration data.
-Are there any other nuggets of information related to this approach that you can feed me? Or are there any examples, sections or documents that you think I should read to accomplish this approach? I am a highly experienced programmer of arbitrary languages; the hardest part for me is always just getting setup in a development environment.


I've never really had to worry about scripting engines, in the past I always used the OS default engine I presume. But I suspect your document will clear up this missing knowledge.


I think this questions are still outstanding:
1. So the first question is, "will it be possible to precisely get this output in a DB importable form using the pipe operator, or is this just far to much customizing for the pipe to handle?". If yes, got any hints?
-If I can precisely control the command outputs and sort of combine commands, this will make parsing easier for me, a lot easiler. For example, "show ip interface brief" contains interface names plus IP addresses (in tabular form which will help with parsing) that I want in my table, "show vlan brief" tells me what physical interfaces are on which vlan (vlans are being treated the same as physical interfaces within my DB, i.e. same table) and "show interface" tells me the MAC addresses of the interfaces. Would there be a way to type in a long structured command that only gives the data I need, or is this just too much for the device to handle and a script is really the only option?
Reply With Quote
  #4  
Old 05-15-2013, 07:02 AM
gunslingor gunslingor is offline
Registered User
 
Join Date: May 2013
Posts: 27
Is this site serious? Every single post is reviewed by a moderator? This kind of makes the forum unusable. Hey moderator, go look at other forums, this isn't a standard way of doing things and your forcing people to wait a lot longer for replies as you catch up on the backlog. I would change this policy quickly, because there are a lot of similar forums that don't require this and their gonna get all the users.
Reply With Quote
  #5  
Old 05-15-2013, 10:28 AM
miked's Avatar
miked miked is offline
Registered User
 
Join Date: Feb 2004
Posts: 2,040
Quote:
Are there any other nuggets of information related to this approach that you can feed me? Or are there any examples, sections or documents that you think I should read to accomplish this approach?
I think you'll find the SecureCRT Scripting Guide chapter 4 helpful overall, and 4.3 Capturing Data from a Remote Machine especially useful.

Quote:
each device will likely require modifications to the script and I feel the script is the most appropriate spot for all this
We have an example script that I believe may be helpful for you - it shows how to Read Data From Separate Hosts/Commands File And Log To Individual Files.
__________________
Mike
VanDyke Software
Technical Support
[http://www.vandyke.com/support]
Reply With Quote
  #6  
Old 05-15-2013, 10:46 AM
gunslingor gunslingor is offline
Registered User
 
Join Date: May 2013
Posts: 27
Thanks Miked, you've been a massive help.... I have my toes wet... now for the feet =).
Reply With Quote
  #7  
Old 05-15-2013, 12:30 PM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 942
Quote:
Originally Posted by gunslingor View Post
Is this site serious? Every single post is reviewed by a moderator? This kind of makes the forum unusable. Hey moderator, go look at other forums, this isn't a standard way of doing things and your forcing people to wait a lot longer for replies as you catch up on the backlog. I would change this policy quickly, because there are a lot of similar forums that don't require this and their gonna get all the users.
Dear gunslinger,

These forums are created and maintained for the benefit of those who are using VanDyke Software products. The forums are public, but you'll notice that the vast majority of responses come from VanDyke Software technical support staff.

In the past, bogus posts about topics unrelated to VanDyke Software products would have been allowed without restraint, making it difficult for individuals to search for and find relevant information. Since these forums also allow for RSS feed subscriptions, this meant that undesired posts would be broadcast to all RSS readers before they could be filtered as junk.

To honor requests from legitimate forum users, we have implemented mechanisms that can help prevent garbage from polluting the forums.

The first few posts of a new user will be moderated. A post made by a new user won't appear until the post has been approved. This is not unusual for a forum that desires to be of value to a specific audience. Moderated forum posts are evaluated for approval between the hours of 7:30AM to 5:30PM (GMT-7:00).

The vast majority of technical support (even for evaluators) occurs via email. If you prefer to have an email conversation rather than interact via a public forum web page, please send email to support@vandyke.com. One example where email should be used is with any question involving sensitive information. For security reasons, log files and other sensitive information exposing usernames, host names, machine names, IP addresses, etc. should not be posted to a public forum. If your question involves sensitive information as described, please send email to support@vandyke.com; do not post sensitive information to the forums.
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support
Reply With Quote
Reply

Tags
data export , interfaces , managment


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 09:51 AM.