SIMPLE PERL SCRIPT TO CONNECT TO ONE OR MULTIPLE NETAPP AND RUN A COMMAND
This is a very simple perl script to connect to netapp and run any command.
Useful for beginners. It can work both in 7mode and cmode.
By the way you can use to to connect to other devices as well :)
#!/usr/bin/perl
use strict;
use warnings;
use lib "/<user directory to keep modules>" # if you don't have internet you can download the modules and keep it here;
use Net::OpenSSH;
use Expect;
$| = 1;
my ($f);
my $username = 'user';
my $password= 'password';
my $cmd = 'version';
my @servers = ('filer1', 'filer2');
foreach $f (@filers) {
my $ssh = Net::OpenSSH->new("$username\@$f", timeout => 30, password => $password);
$ssh->error and die "Unable to connect: " + $ssh->error;
print "Connected to NetApp Filer : $f\n";
my $out = $ssh->capture($cmd) or die "Unable to run command";
print $out;
}
Guy please like and comment, if you find it useful.
Netapp Guide >>>>> Download Now
ReplyDelete>>>>> Download Full
Netapp Guide >>>>> Download LINK
>>>>> Download Now
Netapp Guide >>>>> Download Full
>>>>> Download LINK PY