in reply to Re: Login to multiple devices using telnet and issue different commands
in thread Login to multiple devices using telnet and issue different commands

Thank you for your reply. I got it to work. When each command processes, how do I print results from the command? I tried putting in "for my" section, but print shows only login message (response from device) but no data from the command.
for my $cmd (@{$hosts{$host}{commands}}){ if(my @check = $telnet->cmd($cmd)){ my $response = join(" ", @check); print "response below \n"; print $response; print $log_fh "$ip $cmd successful\n"; }else{ print $log_fh "$ip Unable to Connect"; } }
  • Comment on Re^2: Login to multiple devices using telnet and issue different commands
  • Download Code

Replies are listed 'Best First'.
Re^3: Login to multiple devices using telnet and issue different commands
by poj (Abbot) on Aug 26, 2015 at 07:00 UTC

    Try adding logging to the session and look at the results.

    $telnet = new Net::Telnet ( Timeout=>10, Errmode=>'die', Prompt => '/# $/i', Input_log => 'input.log', Dump_log => 'dump.log', );
    poj