From 0a50281e824d77e77fa7257645e6874909a6f078 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 8 Nov 2010 19:30:21 +0100 Subject: Add option to change rw-file --- bin/icli | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bin/icli b/bin/icli index 15393c4..c516e1b 100755 --- a/bin/icli +++ b/bin/icli @@ -16,6 +16,7 @@ my $VERSION = '0.1'; my ($cache, $config, $data, $extra); my $config_file = '/var/cache/icinga/objects.cache'; my $status_file = '/var/lib/icinga/status.dat'; +my $rw_file = '/var/lib/icinga/rw/icinga.cmd'; my $context; my $colours = 1; my $short = 0; @@ -316,13 +317,13 @@ sub display_host { sub dispatch_command { my $str = join(';', @_); - open(my $cmd_fh, '>', '/var/lib/icinga/rw/icinga.cmd') or die("Can't open: $!"); + open(my $cmd_fh, '>', $rw_file); printf $cmd_fh ( "[%d] %s", time(), $str, ); - close($cmd_fh) or die("Can't close: $!"); + close($cmd_fh); } @@ -347,6 +348,7 @@ GetOptions( 'c|config=s' => \$config_file, 'C|no-colours' => sub { $colours = 0 }, 'f|status-file=s' => \$status_file, + 'F|rw-file=s' => \$rw_file, '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) }, @@ -456,6 +458,11 @@ Disable colours in output Read the status from I instead of the default F +=item B<-F>|B<--rw-file> I + +Use I as external commands file. Default: +F + =item B<-g>|B<--hostgroup> I Limit selection to hosts in I -- cgit v1.2.3