Leser: 18
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
sub check_mount(){
my $must_mounted = shift(@_);
my $is_mounted = shift(@_);
my %erg;
my @not_mounted;
while ( my ($key, $value) = each(%$must_mounted) ) {
if ( not exists $is_mounted->{$key}){
push(@not_mounted,$key);
$erg{'servity'}='critical';
$erg{'mounts'} = \@not_mounted;
}
};
return %erg;
};
%ergebnis = &check_mount(\%block_mounts,\%mounts);
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
sub check_mount { my ($must_mounted, $is_mounted, $ergebnis) = @_; my %erg; my @not_mounted; while ( my ($key, $value) = each(%$must_mounted) ) { if ( not exists $is_mounted->{$key}){ push(@not_mounted,$key); $erg{'servity'}='critical'; $erg{'mounts'} = \@not_mounted; } }; push(@{$ergebnis}, \%erg); };
1 2 3 4 5
my %ergebnis; &check_mount(\%block_mounts,\%mounts, \%ergebnis); &check_mount(\%block_mounts,\%mounts, \%ergebnis); &check_mount(\%block_mounts,\%mounts, \%ergebnis); # ...
1 2 3 4 5
my @ergebnis; &check_mount(\%block_mounts,\%mounts, \@ergebnis); &check_mount(\%block_mounts,\%mounts, \@ergebnis); &check_mount(\%block_mounts,\%mounts, \@ergebnis); # ...
1 2 3 4 5 6 7 8
my @all_results; for ( ... ) { # irgend eine schleife my %result = check_mount(...); push @all_results, \%result; } print Dumper \@all_results;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
sub check_mount{
my ($must_mounted ,my $is_mounted) = @_;
my %erg;
my @not_mounted;
while ( my ($key, $value) = each(%$must_mounted) ) {
if ( not exists $is_mounted->{$key}){
push(@not_mounted,$key);
$erg{'servity'}='critical';
$erg{'mounts'} = \@not_mounted;
}
};
return \%erg;
};
1
2
%ergebnis{A} = &check_mount(\%block_mounts,\%mounts);
%ergebnis{B} = &check_mount(\%nfs_mounts,\%mounts);