diff options
author | Daniel Friesel <derf@finalrewind.org> | 2012-08-27 15:41:33 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2012-08-27 15:41:33 +0200 |
commit | b6692fe8cec4582853a3f0bbb1c70abbfd2a9170 (patch) | |
tree | 85d18adba3158c8b0980dffe4d81f1d6a4351c8d | |
parent | 93ebb76764a6185217310313e2b34729d9e5030f (diff) |
add -m / --match option
-rw-r--r-- | Changelog | 1 | ||||
-rwxr-xr-x | bin/icli | 11 |
2 files changed, 12 insertions, 0 deletions
@@ -1,6 +1,7 @@ git hEAD * Add missing documentation for -a / --acknowledge + * Add -m / --match option to select on plugin output icli 0.42 - Fri Jun 01 2012 @@ -26,6 +26,7 @@ my $list_type = 's'; my $verbosity = 1; my $recheck = 0; my $force_recheck = 0; +my $match_output = undef; my $acknowledge = undef; my $as_contact = undef; my $term_width = Term::Size::chars(); @@ -198,6 +199,10 @@ sub filter_generic { my ($x) = @_; my $filters_unfulfilled = @filters; + if ($match_output and not $x->{plugin_output} =~ $match_output) { + return 0; + } + foreach my $f (@filters) { if ( ( $f eq 'A' and $x->{'problem_has_been_acknowledged'} ) @@ -809,6 +814,7 @@ GetOptions( 'g|hostgroup=s' => sub { push( @for_groups, split( /,/, $_[1] ) ) }, 'h|host=s' => sub { push( @for_hosts, split( /,/, $_[1] ) ) }, 'l|list=s' => sub { $list_type = substr( $_[1], 0, 1 ) }, + 'm|match=s' => sub { $match_output = qr{$_[1]}i }, 'r|recheck' => sub { $recheck = 1; $list_type = q{} }, 's|service=s' => sub { push( @for_services, split( /,/, $_[1] ) ) }, 'u|force-recheck' => sub { $force_recheck = 1; $list_type = q{} }, @@ -984,6 +990,11 @@ List either services (the default) or hosts. Note that only the first character of the argument is checked, so C<< icli -lh >>, C<< icli -ls >> etc. are also fine. +=item B<-m>|B<--match> I<regex> + +Limit selection to hosts/services whose plugin output matches +I<regex> (perl regular expression, case insensitive. see L<perlre>). + =item B<-r>|B<--recheck> Schedule an immediate recheck of all selected services |