Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: telnet from a cisco telnet

by Kumar Mantri (Novice)
on Aug 09, 2011 at 12:15 UTC ( [id://919460]=note: print w/replies, xml ) Need Help??


in reply to Re^2: telnet from a cisco telnet
in thread telnet from a cisco telnet

yes finally i did with this..done!!but small problem,here it is writing value 1 to the text file..but declared it as array ..here im expecting some set of commands from the device.....any help please?

use Net::Cisco; my $t =Net::Telnet::Cisco->new(Host=>'10.0.2.2'); my @output; my $tl=0; $t->login('9190','KUM@R425'); $t->print("telnet 192.168.203.23")or $tl=1; $t->waitfor('m/password:/'); $t->print("public"); $t->waitfor('m/]>/'); @output=$t->print("show system"); $t->waitfor('m/]>/'); $t->print("exit"); open(CONFIG,">config.txt"); print CONFIG "@output\n"; close(CONFIG); $t->close;

Replies are listed 'Best First'.
Re^4: telnet from a cisco telnet
by Corion (Patriarch) on Aug 09, 2011 at 12:21 UTC
    @output=$t->print("show system"); $t->waitfor('m/]>/');

    This cannot work, because the output of show system will only be available after you have assigned it into @output. You will need to use $t->cmd(...) to collect the output of a command.

      the other device which i am doing telnet from cisco router is not a cisco device thats why im using ...but i change like u suggested but i got a timeout message at that line.. thank u....
      $t->print(..);

        If you get a timeout, then the prompt that your appliance uses is not a prompt that is recognized by Net::Telnet::Cisco (or Net::Telnet). Read the documentation and supply the appropriate prompt, and everything should work.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://919460]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (1)
As of 2024-04-25 04:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found