diff options
Diffstat (limited to 'bin/icli')
-rwxr-xr-x | bin/icli | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -24,6 +24,7 @@ my $list_type = 's'; my $verbosity = 1; my $recheck = 0; my (@for_hosts, @for_groups, @for_services, @list_hosts, @list_services); +my @filters; sub have_host { my ($host) = @_; @@ -74,11 +75,30 @@ sub pretty_date { sub filter_generic { my ($x) = @_; + my $filters_unfulfilled = @filters; if ($short and not $x->{'current_state'}) { return 0; } + foreach my $f (@filters) { + if ( + ($f eq 'A' and $x->{'problem_has_been_acknowledged'}) or + ($f eq '!A' and not $x->{'problem_has_been_acknowledged'}) or + ($f eq 'F' and $x->{'is_flapping'}) or + ($f eq '!F' and not $x->{'is_flapping'}) or + ($f eq 'P' and $x->{'passive_checks_enabled'} + and not $x->{'active_checks_enabled'}) or + ($f eq '!P' and $x->{'active_checks_enabled'}) + ) { + $filters_unfulfilled--; + } + } + + if ($filters_unfulfilled) { + return 0; + } + return 1; } |