From b3c4c7874404a8dd65e6b6a670bfe7cfc285df63 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 12 Sep 2010 18:59:59 +0200 Subject: Add icli -ld (list downtimes) --- bin/icli | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/icli b/bin/icli index 229d85a..451f359 100755 --- a/bin/icli +++ b/bin/icli @@ -186,6 +186,35 @@ sub display_queue { } } +sub display_downtime { + my ($d) = @_; + my $v = $verbosity; + + printf('%-20.20s', $d->{'host_name'}); + + if ($v >= 3) { + printf( + ' %s %-10.10s', + pretty_date($d->{'entry_time'}), + $d->{'author'}, + ); + } + if ($v >= 2) { + printf(' %-30.30s', $d->{'comment'}); + } + printf( + ' %s %s', + pretty_date($d->{'start_time'}), + pretty_date($d->{'end_time'}), + ); + if ($v >= 2) { + print ($d->{'fixed'} ? ' Fixed' : ' Flexi'); + } + + print "\n"; +} + + sub display_service { my ($s) = @_; @@ -195,7 +224,7 @@ sub display_service { printf(" %s" , service_state($s->{'has_been_checked'}, $s->{'current_state'})); if ($v >= 2) { - printf(" %d/%d", $s->{'current_attempt'}, $s->{'max_attempts'}); + printf(' %d/%d', $s->{'current_attempt'}, $s->{'max_attempts'}); } printf(" %s\n", $s->{'plugin_output'}); @@ -305,6 +334,11 @@ elsif ($list_type eq 'h') { elsif ($list_type eq 'q') { display_queue(); } +elsif ($list_type eq 'd') { + foreach my $downtime (@{$data->{downtimes}}) { + display_downtime($downtime); + } +} else { die("See perldoc -F $0\n"); } -- cgit v1.2.3