diff options
author | Daniel Friesel <derf@finalrewind.org> | 2011-04-19 21:22:00 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2011-04-19 21:22:00 +0200 |
commit | cf1c773dff3bc1fe35a6550f2cfffafa2658aa3d (patch) | |
tree | ab968031eabdc0af7ebec8ae327fde0ed4861b40 | |
parent | 845f5f9b8d03468cc97d9e5d804b45ec20be03fb (diff) |
Support "icli host/service" as "icli -h host -s service" shortcut
-rwxr-xr-x | bin/icli | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -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<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>] +[I<host>/I<service> I<...>] =head1 DESCRIPTION @@ -882,6 +894,11 @@ B<icli> only works when executed on the host running the B<Icinga> 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<filters> (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 |