From fe50af6721b170e0929b4e79dfc289452530e242 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 19 Nov 2010 12:19:11 +0100 Subject: icli: Add D filter to skip services on Down/Unreachable hosts --- bin/icli | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'bin/icli') diff --git a/bin/icli b/bin/icli index 357f8de..2fff1e9 100755 --- a/bin/icli +++ b/bin/icli @@ -79,6 +79,14 @@ sub check_is_soft { return ($x->{'last_hard_state'} != $x->{'current_state'}); } +sub check_is_host_down { + my ($s) = @_; + + return ( + $data->{'hosts'}->{ $s->{'host_name'} }->{'current_state'} != 0 + ); +} + sub filter_generic { my ($x) = @_; @@ -92,6 +100,8 @@ sub filter_generic { if ( ($f eq 'A' and $x->{'problem_has_been_acknowledged'}) or ($f eq '!A' and not $x->{'problem_has_been_acknowledged'}) or + ($f eq 'D' and check_is_host_down($x)) or + ($f eq '!D' and not check_is_host_down($x)) 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'} @@ -663,6 +673,10 @@ non-acknowledged services. Check state has been acknowledged +=item B + +The host this service belongs to is Down or Unreachable + =item B Service is flapping between states @@ -740,10 +754,10 @@ Schedule a check of the "APT Updates" service on all hosts having it List check queue for all hosts in the hostgroup "chaosdorf-hosts", plus the host aneurysm -=item C<< icli -z!o,!A,!S >> +=item C<< icli -z!o,!A,!S,!D >> Show all service problems which are already hard states and have not yet been -acknowledged +acknowledged. Also weed out problem services on hosts which are down anyways =back -- cgit v1.2.3