parse show lldp neighbors
[dell-switch] / dell-switch.pl
index c48184f..3c990c8 100755 (executable)
@@ -31,7 +31,17 @@ if ( ! @commands && ! -t STDIN && -p STDIN ) { # we are being piped into
 }
 
 warn "\n## ssh $ip\n";
-my $ssh = Net::OpenSSH->new($ip, user => $login, passwd => $passwd, default_ssh_opts => [-o => "StrictHostKeyChecking=no"]);
+my $ssh = Net::OpenSSH->new($ip, user => $login, passwd => $passwd, 
+    ssh_cmd => '/usr/bin/ssh1', # apt-get install openssh-client-ssh1
+    master_opts => [
+       -o => "StrictHostKeyChecking=no",
+       -F => '/home/dpavlin/dell-switch/ssh1-config'
+       ],
+    default_ssh_opts => [
+       -o => "StrictHostKeyChecking=no",
+       -F => '/home/dpavlin/dell-switch/ssh1-config'
+       ],
+);
 my ($pty ,$pid) = $ssh->open2pty();
 if ( ! $pty ) {
        warn "ERROR: can't connect to $ip, skipping";
@@ -89,7 +99,7 @@ while() {
        } elsif ( $buff =~ m/Password:/ ) {
                send_pty "$passwd\n";
                $buff = '';
-       } elsif ( $buff =~ m/([\w\-\(\)]+)#$/ ) {
+       } elsif ( $buff =~ m/[\n\r]([\w\-\(\)]+)#$/ ) {
                my $hostname = $1;
                if ( $buff ) {
                        save_log $ip, $hostname, $command, $buff;