diff options
author | Hugh Brown (Saint Aardvark the Carpeted) <aardvark@saintaardvarkthecarpeted.com> | 2012-04-12 13:34:19 -0700 |
---|---|---|
committer | Hugh Brown (Saint Aardvark the Carpeted) <aardvark@saintaardvarkthecarpeted.com> | 2012-04-12 13:34:19 -0700 |
commit | 96faa18da96a09d1bf34d618c37929f52d350b93 (patch) | |
tree | aaa22f90da1073417f196158a82e70ac7ea85925 | |
parent | 19bec5d72a57f37cce81b0dbf527092e6782c199 (diff) |
Add option to force-schedule a check of services.
-rwxr-xr-x | bin/icli | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -23,6 +23,7 @@ my $colours = 1; my $list_type = 's'; my $verbosity = 1; my $recheck = 0; +my $force_recheck = 0; my $acknowledge = undef; my $term_width = Term::Size::chars(); my $cut_mode = 'b'; @@ -736,6 +737,14 @@ sub recheck_service { say "Scheduled check of '$service' on '$host'"; } +sub force_recheck_service { + my ($host, $service) = @_; + + dispatch_command('SCHEDULE_FORCED_SVC_CHECK', $host, $service, + time()); + say "Scheduled forced check of '$service' on '$host'"; +} + sub acknowledge_service { my ($host, $service) = @_; @@ -762,6 +771,9 @@ sub action_on_service { if ($recheck) { recheck_service($h, $s); } + if ($force_recheck) { + force_recheck_service($h, $s); + } if ($acknowledge) { acknowledge_service($h, $s); } @@ -778,6 +790,7 @@ GetOptions( 'l|list=s' => sub { $list_type = substr($_[1], 0, 1) }, '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{} }, 'v|verbose+' => \$verbosity, 'V|version' => sub { say "icli version $VERSION"; exit 0 }, 'x|cut-mode=s' => sub { $cut_mode = substr($_[1], 0, 1) }, @@ -879,7 +892,7 @@ B<icli> - Icinga Command Line Interface B<icli> [B<-v>|B<-vv>] [B<-z> I<filter>] [B<-h> I<hosts>] [B<-g> I<hostgroups>] [B<-s> I<services>] [B<-c> I<config>] [B<-C>] [B<-f> I<status-file>] -[B<-F> I<rw-file>] [B<-r>|B<-lh>|B<-ls>|B<-lq>|B<-ld>] +[B<-F> I<rw-file>] [B<-r>|B<-u>|B<-lh>|B<-ls>|B<-lq>|B<-ld>] [I<host>/I<service> I<...>] =head1 DESCRIPTION @@ -940,6 +953,10 @@ Note that only the first character of the argument is checked, so C<< icli Schedule an immediate recheck of all selected services +=item B<-u>|B<--force-recheck> + +Schedule a forced, immediate recheck of all selected services + =item B<-s>|B<--service> I<services> Limit selection to I<services> (comma separated lists). Can be combined with |