分类: Python/Ruby
2011-03-29 23:06:32
#!/usr/bin/perl
use strict;
my @hrFSRMP1;
my @hrFSMP1;
while() {
chomp;
my $ip = $_;
print "$ip\n";
my @hrFSRMP = `snmpwalk -Os -v 2c -c L97iDuba $ip hrFSRemoteMountPoint`;
my @hrFSMP = `snmpwalk -Os -v 2c -c L97iDuba $ip hrFSMountPoint`;
for(my $i=0; $i<=$#hrFSRMP; $i++) {
chomp;
if($hrFSRMP[$i] =~ /hrFSRemoteMountPoint\.\d+ = (?:STRING: )?"(.*)"/) {
push @hrFSRMP1, $1;
}
}
for(my $j=0; $j<=$#hrFSMP; $j++) {
chomp;
if($hrFSMP[$j] =~ /hrFSMountPoint\.\d+ = STRING: "(.*)"/) {
push @hrFSMP1, $1;
}
}
for(my $k=5; $k<=$#hrFSRMP1; $k++) {
print "mount -o rsize=32768,wsize=32768,tcp,noatime,timeo=22,retrans=5 $hrFSRMP1[$k] $hrFSMP1[$k]\n";
}
print "----------------------------------------------------------------------------------------------------------------------\n";
@hrFSRMP1=();
@hrFSMP1=();
}