in reply to Re^5: Net::Telnet::Cisco - command timed-out error
in thread Net::Telnet::Cisco - command timed-out error

With the Send_wakeup => 'connect', added my script times out and I get the following error-
bad named parameter "Send_wakeup" given to Net::Telnet::Cisco::new() a +t
Please let me know.

Replies are listed 'Best First'.
Re^7: Net::Telnet::Cisco - command timed-out error
by soonix (Chancellor) on Oct 26, 2014 at 15:41 UTC

    Sorry, I know this module only from its doc and source, because we don't have that much Ciscos.

    The message "bad named parameter" isn't there, but in Net::Telnet. Obviously, Net::Telnet::Cisco->new gives all its input parameters to Net::Telnet->new without cleaning out its own extensions.
    Perhaps the error checking in Net::Telnet->new was put in later...

    Anyway, if you leave it out, and put instead
    $cs->send_wakeup('connect'); $cs->login(...);
    at least this doesn't give the error message.

    Update: tried it at work (no Cisco at home :-)), our cisco doesn't need send_wakeup, but works also with it. I tested using the following code

    use Net::Telnet::Cisco; my ($host, $user, $pass) = qw(10.10.1.1 user pass); my $cs = Net::Telnet::Cisco->new( Host => $host, Dump_Log => 'cisco.log', Prompt => '/(?m:^\W?[\w\/\d.:-]+[>#])/', ); $cs->send_wakeup('connect'); $cs->login( $user, $pass ); my @cmd_output = $cs->cmd( 'show ver | inc Configuration' ); print @cmd_output; $cs->close;
      Thank you for the update. I just tried as following-
      use Net::Telnet::Cisco; my ($host, $user, $pass) = qw(10.10.1.1 user pass); my $cs = Net::Telnet::Cisco->new( Host => $host, Port => $port, Dump_Log => 'cisco.log', Prompt => '/(?m:^\W?[\w\/\d.:-]+[>#])/', ); $cs->send_wakeup('connect'); $cs->login( $user, $pass ); print "username and password sent\n"; my @cmd_output = $cs->cmd( 'show cdp nei' ); print @cmd_output; $cs->close;
      But, I am getting the following error-
      username and password sent command timed-out at c:\temp\dir6483.tmp\sendWake.pl line 28 Press any key to continue . . .
      line 28: my @cmd_output = $cs->cmd( 'show cdp nei' );

      After that when I use putty to access, I can see that it's displaying my "show cdp nei" and didn't ask for authentication, as I have already provided thru the script. However, it didn't display in the script output and gave me that error.

      Please let me know.

      ##UPDATE:
      never mind... it's working. I just had to add 'term leng 0' first. Thank you all.

        This is strange. Normally, putty doesn't "continue" sessions from other programs. (Also, the Cisco here at my workplace doesn't understand "show cdp"...)

        However, you still haven't told us what is in "cisco.log". You inserted the "dump_log" parameter as per Loops' advice, but didn't yet comment on the findings...