|
Using SSH to run a command on a Cisco router the module isn't assigning the output of the cmd to an array. Look at the code and results below. The array size is zero !!!
The STDOUT proves that the command is running but the array is zero. HELP !!!
&ios_login($ip,$username,$password,$ssh);
@lines = $session_obj->cmd('ping 1.1.1.1');
$size = scalar @lines;
print "@lines size= $size\n";
foreach $line (@lines)
{
print "$line\n";
if ($line =~ /Success rate is (\d+)/)
{
$rate = $1;
print "Rate=$rate\n";
}
}
$session_obj->close;
------- OUTPUT -------
size= 0
ping 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/8/12 ms
|