Revision 256ae084
Added by Hamish Coleman almost 17 years ago
- ID 256ae08463c60f3bb9983edde083e60d263afa3b
mrtg.cgi | ||
---|---|---|
}
|
||
}
|
||
|
||
sub maketree_grouphosttest($) {
|
||
my ($name) = @_;
|
||
my $sequence = $db->{target}->{$name}->{_sequence};
|
||
sub maketree_grouphosttest($$) {
|
||
my ($name,$sequence) = @_;
|
||
|
||
# Do not classify any test with no separators in it
|
||
if ($name !~ /,/) {
|
||
... | ... | |
|
||
}
|
||
|
||
sub maketree_cfgfile($$) {
|
||
my ($name,$sequence) = @_;
|
||
|
||
# config files
|
||
my $cfgfile = $db->{target}->{$name}->{_cfgfile};
|
||
|
||
my @cfgpath = split /\//,$cfgfile;
|
||
|
||
shift @cfgpath; # remove initial slash
|
||
|
||
unshift @cfgpath,"config"; # ensure that the config node exists
|
||
my $node = $db->{tree};
|
||
|
||
while (@cfgpath ) {
|
||
if (!defined $node->{$cfgpath[0]}) {
|
||
$node->{$cfgpath[0]} = {};
|
||
}
|
||
$node = $node->{$cfgpath[0]};
|
||
shift @cfgpath;
|
||
}
|
||
|
||
# assign a target name and sequence to the final node
|
||
$node->{$name} = $sequence;
|
||
}
|
||
|
||
# Look through the target database and create tree entries for each cfgfile
|
||
#
|
||
sub maketree() {
|
||
for my $name (keys %{$db->{target}}) {
|
||
my $sequence = $db->{target}->{$name}->{_sequence};
|
||
# config files
|
||
my $cfgfile = $db->{target}->{$name}->{_cfgfile};
|
||
$db->{tree}->{config}->{$cfgfile}->{$name} = $sequence;
|
||
|
||
maketree_grouphosttest($name);
|
||
maketree_cfgfile($name,$sequence);
|
||
maketree_grouphosttest($name,$sequence);
|
||
# TODO - parse the Target setting and create trees
|
||
# TODO - parse magic comments and create trees here
|
||
}
|
||
}
|
||
|
||
# FIXME - global
|
||
my $node_next = 1;
|
||
sub emit_tree_one($$$);
|
||
sub emit_tree_one($$$) {
|
||
my ($parentnode,$path,$dir) = @_;
|
||
|
||
... | ... | |
}
|
||
|
||
my $node = 'n'.$node_next++;
|
||
print "$node = insFld($parentnode, gFld(\"$i\", \"?path=$path:$i\"))\n";
|
||
emit_tree_one("$node","$path:$i",$val);
|
||
print "$node = insFld($parentnode, gFld(\"$i\", \"?path=$path/$i\"))\n";
|
||
emit_tree_one("$node","$path/$i",$val);
|
||
}
|
||
}
|
||
|
||
... | ... | |
sub emit_path_contents($$) {
|
||
my ($path,$graph) = @_;
|
||
|
||
my @path = split /:/,$path;
|
||
my @path = split /\//,$path;
|
||
my @pathfound;
|
||
|
||
my $node = $db->{tree};
|
Also available in: Unified diff
Change config tree to use a tree. Change path separator to a slash