hallo Leute habe dass problem jetzt so gelöst. Ist vielleicht nicht wirklich schön aber es funzt. genau so wollte ich es haben. man kann es mit sicherheit auch besser machen.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
my %relationen = (
'jittermaxnegsd'=>{'rel'=>'jittermaxpossd','func'=>\&jitter_out},
'jittermaxpossd'=>{'rel'=>'jittermaxnegsd','func'=>\&jitter_out},
'packetlossin' =>{'rel'=>'packetlossout' ,'func'=>\&packet_loss},
'packetlossout' =>{'rel'=>'packetlossin' ,'func'=>\&packet_loss},
);
my %nonrelation = (
'traffic' => \&traffic,
'cpu' => \&cpu,
);
foreach my $path(keys(%dirs)){
my @pathitems =(split (/\//,$path));
my $typ =$pathitems[-1];
if (exists $relation{$typ})
{
$pathitems[-1]=$relation{$typ}{'rel'};
my $path2 = join('/',@pathitems);
$relation{$typ}{'func'}($path,$dirs{$path},$path2,$dirs{$path2});
}else{ $nonrelation{$typ}($path,$dirs{$path});}
}
%dirs ist ein Hash der Form
%dirs =( './cisco-items/smfdsdn4/packetlossout' =>\@array,
./cisco-items/smfdsdn4/packetlossin'=> \@array,
./cisco-items/smfdsdn3/s0/traffic'=> \@array;
usw...
)\n\n
<!--EDIT|jason-duff|1137500800-->