Project

General

Profile

« Previous | Next » 

Revision b5758d6e

Added by Hamish Coleman almost 17 years ago

  • ID b5758d6ebc578dd67e0c48d8c56f6c6bdf4efa3e

Add code to prune hosttypes based on number of members in the group

View differences:

mrtg.cgi
}
$db->{target}->{$name}->{_hosttype} = $hosttype;
$db->{hosttype}->{$hosttype}->{$name}++;
$db->{hosttype}->{$hosttype}->{$host}++;
}
#for my $hosttype (keys %{$db->{hosttype}}) {
# if ((keys %{$db->{hosttype}->{$hosttype}})<2) {
# delete $db->{hosttype}->{$hosttype};
# }
#}
# a valid hosttype is:
# defined($db->{target}->{$name}->{hosttype}) &&
# defined($db->{hosttype}->{$hosttype})
for my $hosttype (keys %{$db->{hosttype}}) {
if ((keys %{$db->{hosttype}->{$hosttype}})<2) {
delete $db->{hosttype}->{$hosttype};
}
}
}
sub maketree_grouphosttest($$) {
......
return;
}
#my $hosttype = $db->{target}->{$name}->{_hosttype};
#if (!defined($db->{hosttype}->{$hosttype})) {
# $hosttype=undef;
#}
my $hosttype;
# TODO - this needs to have a better way...
# hosttype is the non digit hostname prefix - thus
# "proxy-1" and "proxy-2" would both end up in the
# "proxy-" hosttype
if ($host =~ m/^(.*[^0-9])(\d+)$/) {
$hosttype = $1.'*';
# a valid hosttype both:
# defined($db->{target}->{$name}->{hosttype}) &&
# defined($db->{hosttype}->{$hosttype})
my $hosttype = $db->{target}->{$name}->{_hosttype};
if (!defined($db->{hosttype}->{$hosttype})) {
$hosttype=undef;
}
# TODO - determine a better description for this tree leaf

Also available in: Unified diff