Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automated telnet scripts

Status
Not open for further replies.

smolz

ISP
Dec 2, 2002
4
US
What I want to be able to do is I have a program that monitors my routers. It has the ability to launch a program if one goes down. So what i want to do is to have a program that can create a script of some kind so that i can call it when a router goes down. I want the scripts to telnet into a router and make modifications to the running config. I am hopeing that there is something that is easy to use.
thanks
 
That's kind of an iffy thing isn't it?
How can you anticipate what the problem is?
You should be using a syslogging server in
any case and logging heavily , which is a
better method IMO than emulating some kind
of expert system with a script.

If you just want some kind of quick connectivity test
and config dump and you have *nix then check out
expect: , and libcisco:
 
I really have two situationst that I would like to use a script to change an active config. One is that we have multiple ISP's, but with one i need to be able to change a route when the link goes down. so if the link goes down i will be notified but the script will automatically change the route in the router so that it will go out another isp.
 
Ah, I understand now...
I have a similar situation for my home LAN using a
redundant dialup link. It's simple to code and
uses a simple dnsquery and ping test for connectivity
testing.

You could check out the links and see if you could
code something simple. I don't know of any systems that
have this capability offhand, though I'm sure there
is some management systems using smnp which have the option
of triggering user defined actions, including exec'ing
programs and scripts on traps.
 
There are plenty of management apps you can use, and certainly plenty of choice in SMNP readers and tools. HP Vangepoint operations (Openview) does this, but is mega bucks.
One scripting language I have used a bit is TCL or even better is EXPECT.
Its very very functional and allows you to define responses and wait until certian srtings or event happen before exec`ing the next line or another app.
I wrote and automated password change script to change about 50/60 routers and switch telnet, enable and console passwords, all reading information from a text file of routers/switches and other info.
Another really really functional language is Perl. You can write a bit of code that would say monitor smnp details from your routers or whatever, then run a certain util or whatever. Normally if a router goes down, id run a ping command then depending on the outcome , try a trace to it and then alarm if you cant do either.

ANyway...the lowdown is..spend shed loads of cash for something off the shelf..
Or spend a little bit of time and write something yourself in TCL/EXPECT or Perl.

Hope this helps a little...

Andrew
 
sounds much more like a case of configuring BGP correctly with your ISP's to handle this issue
 
Requirement One:I really have two situationst that I would like to use a script to change an active config. One is that we have multiple ISP's, but with one i need to be able to change a route when the link goes down.

The easiest way to accomplish this is to have the router do it for you without having to modify the running ocnfiugration. Use a floating static route. I am assuming that the route you are referring to is a default route. The syntax to create a floating static route is ip route 0.0.0.0 0.0.0.0 1.1.1.1 200.

Where 1.1.1.1 is the IP address of the secondary ISP next hop and 200 is the administrative distance. Once the interface, or link, to the primary ISP goes down, the route to that ISP will get flusheed and the secondary route with the higher administrative distance will get placed into the routing table.


Requirement 2: so if the link goes down i will be notified

This one you can use a program that monitors (most easily by issuing pings) the routers interfaces. YOu can configure a loopback and have it ping the loopback. This will ensure that the router itself has not failed. Further you can have it ping the IP address on the interface that connects to the primary ISP, this ensures that the link to the primary ISP is up. There are a number of programs that you will do this, and alot of them are configurable to have the program email or send a page. It depends on how much money you want to spend, if any at all. It probably would not be too difficulut to write a script that would accomplish the same thing. As suggested previously, perl is a great scripting language. One free monitoring utility that uses perl and works well with perl is mrtg and can be found at
hope this helps
Erik Rudnick, CCIE No. 9545
mailto:erik@kuriosity.com
 
this is not possible because it is actually the ISP's equipment that prohibits me from doing anything. Their CPE has a nice feature that when it loses the link to the CO it will not do anything for about a minute. So i have put a couple of router behind the box and convinced them that if the link goes down then they will send the traffic back to us. but it will not do this for a minute in the mean time dropping sessions into the abyss. so i have a notification system that will alert me when it drops out. but i still want to be able to run a scipt that will automatically switch the routes back out to the other ISP's. So it appears that there is nothing that i can do this easily without having to learn some scripting, which appears to be the best solution.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top