diff options
author | Daniel Friesel <derf@finalrewind.org> | 2010-11-18 23:29:08 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2010-11-18 23:29:08 +0100 |
commit | 5264f6ecbf7638cb7a498ba9f18e481b9cdf4c80 (patch) | |
tree | 100d32b2cde2b2640a8d4e8d77ff749e15eefd2b | |
parent | 5b6c9f684132dae79014e985f7502d42c74b60bb (diff) |
Filters! So far only those based on Flags and not totally clean. But working.
-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; } |