From 96faa18da96a09d1bf34d618c37929f52d350b93 Mon Sep 17 00:00:00 2001 From: "Hugh Brown (Saint Aardvark the Carpeted)" Date: Thu, 12 Apr 2012 13:34:19 -0700 Subject: Add option to force-schedule a check of services. --- bin/icli | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/icli b/bin/icli index 42abc34..3f15a50 100755 --- a/bin/icli +++ b/bin/icli @@ -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 - Icinga Command Line Interface B [B<-v>|B<-vv>] [B<-z> I] [B<-h> I] [B<-g> I] [B<-s> I] [B<-c> I] [B<-C>] [B<-f> I] -[B<-F> I] [B<-r>|B<-lh>|B<-ls>|B<-lq>|B<-ld>] +[B<-F> I] [B<-r>|B<-u>|B<-lh>|B<-ls>|B<-lq>|B<-ld>] [I/I 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 Limit selection to I (comma separated lists). Can be combined with -- cgit v1.2.3