For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > October 2005 > Problem with Net::Telnet









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Problem with Net::Telnet
Gary

2005-10-20, 9:55 pm

Hi Folks,

I am writing a script to get information from a Redline box, problem I
am running into is the Redline box has paging turned on (cannot be
disabled) so halfway through the output it sends: [More 10%] and that
causes my script to fail without error.

#!/usr/bin/perl -w

$lbIP = "1.31.24.178";
$username = "myuser";
$password = "mypassword";

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";

$cmdToSend = "show slb group 1.31.26.77_TCP_80\n";
my @slbRIPArray = $t->cmd(String=>$cmdToSend) or die "Failed";

My question:
Why does it not timeout and fail with error message?
How do I solve this problem?

Thanks a lot for help

The logs files show the following:
Redline% show 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 1000 1 Up none
1.31.24.184:80 1 1000 1 Up none
1.1.1.1:80 1 200 1 Down none
1.1.1.2:80 1 200 1 Down none
[=More (92%)=]

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com