diff options
| author | Daniel Friesel <derf@finalrewind.org> | 2010-11-18 23:08:04 +0100 | 
|---|---|---|
| committer | Daniel Friesel <derf@finalrewind.org> | 2010-11-18 23:08:04 +0100 | 
| commit | 5c330c8d09f0cae4690c6871f29ea680a1fe673f (patch) | |
| tree | cf17b42fee10b173b46cff209dad493c02fa27a0 | |
| parent | 416a6fedf5feebc6c8d27f22ef828419fd365609 (diff) | |
Use filters for host listing as well
| -rwxr-xr-x | bin/icli | 18 | 
1 files changed, 14 insertions, 4 deletions
| @@ -72,6 +72,16 @@ sub pretty_date {  	return time2str('%Y-%m-%d %H:%M:%S', $unix);  } +sub filter_host { +	my ($h) = @_; + +	if ($short and not $h->{'current_state'}) { +		return 0; +	} + +	return 1; +} +  sub filter_service {  	my ($s) = @_; @@ -320,10 +330,6 @@ sub display_host_single {  	my $h = $data->{hosts}->{$host};  	my $v = $verbosity; -	if ($short and not $h->{current_state}) { -		return; -	} -  	printf("%-32.32s", $h->{'host_name'});  	printf(" %s", host_state($h->{'has_been_checked'}, $h->{'current_state'})); @@ -423,6 +429,10 @@ if (@list_services) {  	@list_hosts = grep { have_service_multi($_, @list_services) } @list_hosts;  } +if ($list_type eq 'h') { +	@list_hosts = grep { filter_host($data->{'hosts'}->{$_}) } @list_hosts; +} +  if ($list_type ~~ [qw[s h]]) {  	foreach my $host (@list_hosts) {  		display_host($host, (@list_hosts > 1)); | 
