Revision b5758d6e
Added by Hamish Coleman almost 18 years ago
- ID b5758d6ebc578dd67e0c48d8c56f6c6bdf4efa3e
| 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
Add code to prune hosttypes based on number of members in the group