From: Stephen L Johnson Date: Wed, 9 Feb 2000 19:56:29 +0000 (+0000) Subject: added spong.groups 'compress' attribute to display_html(). only display X-Git-Tag: spong-2_7-alpha5~89 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3fc9bdc252c1695589bfd0c68f0ca5fd239d1518;p=spong.git added spong.groups 'compress' attribute to display_html(). only display columns that have data in the host group. --- diff --git a/src/lib/Spong/HostList.pm b/src/lib/Spong/HostList.pm index fb2ee4e..3d24aaf 100755 --- a/src/lib/Spong/HostList.pm +++ b/src/lib/Spong/HostList.pm @@ -213,8 +213,20 @@ sub display_html { # Compute the total list of services running on the various hosts, and # sort them alphabetically (except always put ping first). - if( grep( /^ping$/, keys %main::SERVICES ) ) { push( @names, "ping" ); } - foreach $service ( sort keys %main::SERVICES ) { + # If group has a compress attribute, only print services in use +#&main::debug("self->name = " . $self->{'name'} . +# "compress = " . $main::GROUPS{$self->{'name'}}->{'compress'} ); + if ( $main::GROUPS{$self->{'name'}}->{'compress'} ) { + foreach $host ( $self->hosts() ) { + foreach $service ( $host->service_names() ) { + $services{$service}++; }} + @s = (keys %services); + } else { + @s = (keys %main::SERVICES); + } + + if( grep( /^ping$/, (@s) ) ) { push( @names, "ping" ); } + foreach $service ( sort (@s) ) { push( @names, $service ) unless $service eq "ping"; } # Print the horizontal axis of the table (names of the services)