summaryrefslogtreecommitdiff
path: root/bin/icli
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2010-11-18 23:29:08 +0100
committerDaniel Friesel <derf@finalrewind.org>2010-11-18 23:29:08 +0100
commit5264f6ecbf7638cb7a498ba9f18e481b9cdf4c80 (patch)
tree100d32b2cde2b2640a8d4e8d77ff749e15eefd2b /bin/icli
parent5b6c9f684132dae79014e985f7502d42c74b60bb (diff)
Filters! So far only those based on Flags and not totally clean. But working.
Diffstat (limited to 'bin/icli')
-rwxr-xr-xbin/icli20
1 files changed, 20 insertions, 0 deletions
diff --git a/bin/icli b/bin/icli
index 663eccc..0a40f94 100755
--- a/bin/icli
+++ b/bin/icli
@@ -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;
}