Telnet and get info


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Telnet and get info
# 1  
Old 02-28-2007
Telnet and get info

Hello all,
probably this is a very stupid question but I'm a beginner in the arts of scripting... Smilie

I'm trying to do a script that logs in to several equipments, switchs etc, and make them show their version and save all the output to a file.
I managed to do the login, username/password and typing the command but the problem is that the command only displays a variable number of lines and then waits for a key press to continue showing the infos, thats the hard part I can't get it to work.....
The number of lines usable depends on the window size and the server I'm using. I don't have a fixed number for each server.

It looks like this :
(sleep 1;
echo username;
sleep 1;
echo password;
sleep 1
echo "show version"
sleep 3;

echo "exit") | telnet server

Any idea how to solve this?
Thanks a lot for the help!!!
# 2  
Old 02-28-2007
Quote:
Originally Posted by pmpx
Hello all,
probably this is a very stupid question but I'm a beginner in the arts of scripting... Smilie

I'm trying to do a script that logs in to several equipments, switchs etc, and make them show their version and save all the output to a file.
I managed to do the login, username/password and typing the command but the problem is that the command only displays a variable number of lines and then waits for a key press to continue showing the infos, thats the hard part I can't get it to work.....
The number of lines usable depends on the window size and the server I'm using. I don't have a fixed number for each server.

It looks like this :
(sleep 1;
echo username;
sleep 1;
echo password;
sleep 1
echo "show version"
sleep 3;

echo "exit") | telnet server

Any idea how to solve this?
Thanks a lot for the help!!!
If SNMP is configured on those witches use SNMP
# 3  
Old 02-28-2007
Thanks, but not all the switches/servers have SNMP....
I have to do it via a script running in Linux.

Thanks!
# 4  
Old 02-28-2007
Quote:
Originally Posted by pmpx
Thanks, but not all the switches/servers have SNMP....
I have to do it via a script running in Linux.

Thanks!
There is a "dirty" tool available called "rancid", which allows you to get information from all kind of network equipment.

It's build in perl and expect scripts.

Probably there are more similar tools around.
# 5  
Old 03-01-2007
Quote:
Originally Posted by pmpx
Hello all,
probably this is a very stupid question but I'm a beginner in the arts of scripting... Smilie

I'm trying to do a script that logs in to several equipments, switchs etc, and make them show their version and save all the output to a file.
I managed to do the login, username/password and typing the command but the problem is that the command only displays a variable number of lines and then waits for a key press to continue showing the infos, thats the hard part I can't get it to work.....
The number of lines usable depends on the window size and the server I'm using. I don't have a fixed number for each server.

It looks like this :
(sleep 1;
echo username;
sleep 1;
echo password;
sleep 1
echo "show version"
sleep 3;

echo "exit") | telnet server

Any idea how to solve this?
Thanks a lot for the help!!!
if you have Perl, the above can be done using its telnet module too, with more control over what you want to do.
Please see here for an example
# 6  
Old 03-01-2007
Quote:
Originally Posted by sb008
There is a "dirty" tool available called "rancid", which allows you to get information from all kind of network equipment.

It's build in perl and expect scripts.

Probably there are more similar tools around.
I agree that you should use some kind of available tool for this. Programming this effectively would take some time - unless you don't have a deadline. Lots of windows or GUI based tools won't come for free though.
# 7  
Old 03-02-2007
Quote:
Originally Posted by Deal_NoDeal
I agree that you should use some kind of available tool for this. Programming this effectively would take some time - unless you don't have a deadline. Lots of windows or GUI based tools won't come for free though.
Rancid is for free
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Want to remove telnet error/info from screen

Hi Team, I am using one script, It is working fine, the problem is it gives unwanted telnet errors when I am using it. I just want to remove these unwanted errors/info from my screen. bash-3.00$ cat raza_site_temp #!/usr/bin/bash #rj835b IFS="|" REGEX="$*" echo snarf2 -c "show... (2 Replies)
Discussion started by: Raza Ali
2 Replies

2. UNIX for Dummies Questions & Answers

Difference Between Krb5-telnet And Ekrb5-telnet

Hi, I want to know the difference between these two services. Both are under xinetd. Both are used for enabling and disabling Telnet service. So, can somebody please explain me the difference between the two ? Thanks in advance :) (0 Replies)
Discussion started by: kashifsd17
0 Replies

3. UNIX for Dummies Questions & Answers

Automatically login in the telnet from present telnet

Hi, I was writing one script which includes to switch to the another telnet automatically from the present telnet server. I was using rlogin but firstly it takes the same user name of the present telnet and secondly it is prompting for the password. But i want to switch to the another telnet... (2 Replies)
Discussion started by: Prateek
2 Replies

4. Shell Programming and Scripting

Grabbing info from Telnet

I have a process that is running locally on the machine. When you telnet to the process: telnet IP port, it automatically returns a string which shows the status of that process. Something like this: # telnet IP Port Trying 127.0.0.1... Connected to localhost (127.0.0.1). Escape... (3 Replies)
Discussion started by: skaptakalian
3 Replies

5. Shell Programming and Scripting

Webpage to Telnet via Perl and Expect: Telnet problem?

Somewhat long story: I have a simple Perl CGI script that uses Expect to Telnet to a device and grab some data, and then spits it back to Perl for display on the Webpage. This works for many devices I've tried, but one device just fails, it keeps rejecting the password on this device, only... (1 Reply)
Discussion started by: jondo
1 Replies

6. Shell Programming and Scripting

Getting LV Info

I have this working ksh, and it returns like below: LOGICAL VOLUME: prod_2048_005 VOLUME GROUP: prod1vg TYPE: raw WRITE VERIFY: off PHYSICAL VOLUME: hdisk108 VOLUME GROUP: prod1vg TOTAL PPs: 1023 (130944 megabytes) VG DESCRIPTORS: 1 USED PPs: 904 (115712 megabytes) MAX REQUEST: 1 megabyte... (1 Reply)
Discussion started by: Daniel Gate
1 Replies

7. UNIX for Dummies Questions & Answers

Some Info.

Hiya all ... i am a newbie to UNIX, Just want to knwo what this command does: /sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}' I think, 'grep shows the line with 'inet addr' (which is the 2nd line, displaying the IP Address, Broadcast Address and Subnet Mask) ... Is... (8 Replies)
Discussion started by: ad4m88
8 Replies

8. AIX

Extract info

Anyone have a better idea to automate extraction of info like ... "uname" "ifconfig" "ps efl" "netstat -ao" etc. from several hundred aix, solaris, red hat boxes? without logging into each box and manually performing these tasks and dumping them to individual files? thanks for any input (1 Reply)
Discussion started by: chm0dvii
1 Replies

9. Shell Programming and Scripting

Need Info

Hi, I'm a oracle DBA with little knowledge of Unix. I wanted to write some shell scripts which will be helpful for DBA's regular activity. As i'm a new to oracle with unix can any plese tell me what are all the activities can be done throgh Unix Shell Scripts also suggest me how to learn... (1 Reply)
Discussion started by: msgobinathan
1 Replies

10. UNIX for Dummies Questions & Answers

SU info

from the man page of su: EXAMPLES Example 1: Becoming User bin While Retaining Your Previously Exported Environment To become user bin while retaining your previously exported environment, execute: example% su bin Example 2: Becoming User bin and ... (4 Replies)
Discussion started by: afflack
4 Replies
Login or Register to Ask a Question