From cf1c773dff3bc1fe35a6550f2cfffafa2658aa3d Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 19 Apr 2011 21:22:00 +0200 Subject: Support "icli host/service" as "icli -h host -s service" shortcut --- bin/icli | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'bin') diff --git a/bin/icli b/bin/icli index dcf1f4b..42abc34 100755 --- a/bin/icli +++ b/bin/icli @@ -789,6 +789,17 @@ read_objects($status_file, \$data); read_objects($config_file, \$config); enhance_status(); +for my $arg (@ARGV) { + my ($host, $service) = split(qr{/}, $arg); + + if (not grep { $host } @for_hosts) { + push(@for_hosts, $host); + } + if ($service) { + push(@for_services, $service); + } +} + foreach my $host (@for_hosts) { if (not exists $data->{services}->{$host}) { die("Unknown host: ${host}\n"); @@ -869,6 +880,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>] +[I/I I<...>] =head1 DESCRIPTION @@ -882,6 +894,11 @@ B only works when executed on the host running the B daemon. To use it on another host, shell aliases (like C<< alias icli='ssh $icingahost icli' >>) or similar are recommended. +You can narrow down the list of services you want displayed either using +B (like C<< icli -z!o >>), the B<-h>/B<-s> arguments (C<< icli -h +aneurysm -s Libraries,Websites >>) or commandline args (C<< icli +aneurysm/{Libraries,Websites} >> with shell expansion). + =head1 OPTIONS =over -- cgit v1.2.3