Click here to get back home

Net:Telnet problem with print

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Net:Telnet problem with print Gary 10-20-2005
Posted by Gary on October 20, 2005, 5:04 pm
Please log in for more thread options


Folks,

I am running into a problem when using print with Net:Telnet. It does
not seem to be sending the command sent using print to the remote
machine (Redline load balancer). It does send the commands sent with
print during login but not after that. Do I need to do something else
with print after login?

#!/usr/bin/perl -w
$lbIP = "1.31.24.178";
$username = "user1";
$password = "password";
use Net::Telnet ();
# Login to the device
        $prompt = '/.*%/';
        $t = new Net::Telnet (Timeout => 40,
                input_log => "/tmp/logs/file_name_telnet.txt",
                Dump_Log => "/tmp/logs/file_name_All.txt",
                Errmode => 'return',
                Prompt => $prompt);
        $t->open($lbIP);
        $t->waitfor(Timeout => 40,
                Match => '/login: $/i') or die "Could not telnet";
        $t->print($username);
        $t->waitfor('/Password: $/i');
        $t->print($password);
        $t->waitfor($prompt) or die "Check passwords";
        $ok1 = $t->print("sh slb group 1.31.26.77_TCP_80");
        print "$ok1\n";
        ($preMatch,$match) = $t->waitfor(Timeout => 40,
                Match => '/More/',
                Match => '/$prompt') or die "My Error";
This is what the dump_log shows:
< 0x00000: 6c 6f 67 69 6e 3a 20 login:

> 0x00000: 75 73 65 72 31 0d 0a user1..

< 0x00000: 75 73 65 72 31 0d 0a user1..

< 0x00000: 50 61 73 73 77 6f 72 64 3a
Password:

> 0x00000: 70 61 73 73 77 6f 72 64 0d 0a password..

< 0x00000: 0d 0a ..

< 0x00000: 0d 0a 43 6f 70 79 72 69 67 68 74 20 28 63 29 20
...Copyright (c)
< 0x00010: 31 39 38 30 2c 20 31 39 38 33 2c 20 31 39 38 36 1980.
1983. 1986
< 0x00020: 2c 20 31 39 38 38 2c 20 31 39 39 30 2c 20 31 39 . 1988.
1990. 19
< 0x00030: 39 31 2c 20 31 39 39 33 2c 20 31 39 39 34 0d 0a 91.
1993. 1994..
< 0x00040: 09 54 68 65 20 52 65 67 65 6e 74 73 20 6f 66 20 .The
Regents of
< 0x00050: 74 68 65 20 55 6e 69 76 65 72 73 69 74 79 20 6f the
University o
< 0x00060: 66 20 43 61 6c 69 66 6f 72 6e 69 61 2e 20 20 41 f
California. A
< 0x00070: 6c 6c 20 72 69 67 68 74 73 20 72 65 73 65 72 76 ll
rights reserv
< 0x00080: 65 64 2e 0d 0a 0d 0a 43 6f 70 79 72 69 67 68 74
ed.....Copyright
< 0x00090: 20 28 63 29 20 32 30 30 31 2c 20 32 30 30 32 2c (c)
2001. 2002.
< 0x000a0: 20 32 30 30 33 2c 20 32 30 30 34 2c 20 32 30 30 2003.
2004. 200
< 0x000b0: 35 20 52 65 64 6c 69 6e 65 20 4e 65 74 77 6f 72 5
Redline Networ
< 0x000c0: 6b 73 2c 20 49 6e 63 2e 0d 0a 0d 0a 0d 0a 0d 0a ks.
Inc.........
< 0x000d0: 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a
.................
< 0x000e0: 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a
.................
< 0x000f0: 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a
.................
< 0x00100: 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a
.................
< 0x00110: 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a
.................
< 0x00120: 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a
.................
< 0x00130: 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a
.................
< 0x00140: 0d 0a 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 ......

< 0x00150: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20

< 0x00160: 57 65 6c 63 6f 6d 65 20 54 6f 20 52 65 64 6c 69 Welcome
To Redli
< 0x00170: 6e 65 20 4e 65 74 77 6f 72 6b 73 0d 0a 20 20 20 ne
Networks..
< 0x00180: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20

< 0x00190: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20

< 0x001a0: 20 20 20 45 7c 58 0d 0a 20 20 20 20 20 20 20 20 E|X..

< 0x001b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20

< 0x001c0: 20 20 20 20 20 20 20 20 57 65 62 20 41 63 63 65
Web Acce
< 0x001d0: 6c 65 72 61 74 6f 72 0d 0a 0d 0a 0d 0a 0d 0a 0d
lerator.........
< 0x001e0: 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 52 65 64
..............Red
< 0x001f0: 6c 69 6e 65 25 20 line%

> 0x00000: 73 68 20 73 6c 62 20 67 72 6f 75 70 20 31 2e 33 sh slb group 1.3
> 0x00010: 31 2e 32 36 2e 37 37 5f 54 43 50 5f 38 30 0d 0a 1.26.77_TCP_80..

Notice, how when I send the username: user1, it is echoed back, but the
command does not seem to get echoed. It seems to me the Load Balancer
does not get the command I send.

On the actual device if I do a
Redline% sh slb group 1.31.26.77_TCP_80
======================================================================
group 1.31.26.77_TCP_80
vip: 1.31.26.77
port: 80
policy: roundrobin
protocol: tcp
nat: full
nat port start: 1024
nat port end: 8000
sticky: disabled
softpause sticky override: disabled
smtp healthcheck: disabled
pause: none
priority based loadbalancing: disabled
minhosts: 3

Targethosts:
IP:Port Weight Maxconn Priority Status Pause
----------------------------------------------------------------------
1.31.24.255:8080 1 200 1 Down none
1.31.24.184:80 1 200 1 Down none
1.1.1.1:80 1 200 1 Down none
1.1.1.2:80 1 200 1 Down none
----------------------------------------------------------------------
======================================================================

One more question, It seems when I use DOS or Cygwin or SecureCRT, I
never get the [More .. ] with certain commands but with Net:Telnet
package, the same command will always have to scroll, is there a window
size negotiated at telnet time?


Thanks



Similar ThreadsPosted
net::telnet problem July 23, 2004, 6:46 pm
Problem with Net::Telnet October 20, 2005, 4:19 pm
Telnet Problem December 8, 2006, 5:06 am
problem in telnet using perl December 27, 2007, 11:22 pm
Telnet problem -getting timed out error - April 18, 2006, 9:15 am
reading from Net::Telnet input string problem June 16, 2006, 1:17 pm
Net::Telnet retrieving temporary text problem November 6, 2006, 3:32 am
CGI.PM and print table April 13, 2008, 1:18 pm
Image::Magick scalar value to print use CGI April 13, 2006, 10:09 pm
Print Subject without characters Just Numbers using POP3Client. Please Help April 10, 2007, 11:27 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap