summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2014-06-02 17:42:22 +0200
committerDaniel Friesel <derf@finalrewind.org>2014-06-02 17:42:22 +0200
commita88cbfbb9c163c95253f39aaaf3a1664a180ea2a (patch)
tree8fded4360b0441950e5a20e892eb8f623c1b4b82 /bin
parent8559009dc832e65aab539b891308c6c9a33c6deb (diff)
-ld: support -vv / -vvv
Diffstat (limited to 'bin')
-rwxr-xr-xbin/icli97
1 files changed, 72 insertions, 25 deletions
diff --git a/bin/icli b/bin/icli
index 65ea86d..1a7b93d 100755
--- a/bin/icli
+++ b/bin/icli
@@ -609,35 +609,82 @@ sub display_queue {
}
sub display_downtime {
- my ($d) = @_;
- my $v = $verbosity;
+ my ($d) = @_;
+ my $v = $verbosity;
+ my $format = "%-10s : %s\n";
- if ( $d->{service_description} ) {
- printf( '%-25.25s %-25.25s',
- $d->{'host_name'}, $d->{service_description} );
+ if ( $v > 2 ) {
+ printf( $format, 'Host', $d->{host_name} );
+ if ( $d->{service_description} ) {
+ printf( $format, 'Service', $d->{service_description} );
+ }
+ printf( $format,
+ 'Start',
+ $d->{is_in_effect}
+ ? with_colour( pretty_date( $d->{start_time} ), 'bold' )
+ : pretty_date( $d->{start_time} ) );
+ printf( $format,
+ 'End',
+ $d->{is_in_effect}
+ ? with_colour( pretty_date( $d->{end_time} ), 'bold' )
+ : pretty_date( $d->{end_time} ) );
+ printf( $format,
+ 'Duration',
+ $d->{fixed} ? 'Fixed' : pretty_duration_abs( $d->{duration} ) );
+ if ( $v > 3 ) {
+ printf( $format, 'ID', $d->{downtime_id} );
+ if ( $d->{trigger_time} ) {
+ printf( $format,
+ 'Trigger',
+ $d->{triggered_by}
+ . ' (active since '
+ . pretty_date( $d->{trigger_time} )
+ . ')' );
+ }
+ else {
+ printf( $format, 'Trigger', $d->{triggered_by} || 'None' );
+ }
+ }
+ printf( $format, 'Author', $d->{author} );
+ printf( $format, 'Comment', break_str( $d->{comment}, 19 ) );
}
else {
- printf( '%-25.25s', $d->{'host_name'} );
- }
- if ( $v >= 3 ) {
- printf( ' %s %-10.10s',
- pretty_date( $d->{'entry_time'} ),
- $d->{'author'}, );
- }
- printf(
- ' %-20.20s %-20.20s',
- pretty_date( $d->{'start_time'} ),
- pretty_date( $d->{'end_time'} ),
- );
- if ( $v >= 2 ) {
- printf( '%-17.17s',
- $d->{'fixed'}
- ? ' Fixed'
- : ' ' . pretty_duration_abs( $d->{duration} ) );
- }
- if ( $v >= 2 ) {
- print( $d->{comment} );
+ if ( $d->{service_description} ) {
+ printf( '%-25.25s %-25.25s',
+ $d->{'host_name'}, $d->{service_description} );
+ }
+ else {
+ printf( '%-25.25s', $d->{'host_name'} );
+ }
+
+ if ( $v >= 3 ) {
+ printf( ' %s %-10.10s',
+ pretty_date( $d->{'entry_time'} ),
+ $d->{'author'}, );
+ }
+ if ( $d->{is_in_effect} ) {
+ printf( ' %-28s %-28s',
+ with_colour( pretty_date( $d->{'start_time'} ), 'bold' ),
+ with_colour( pretty_date( $d->{'end_time'} ), 'bold' ),
+ );
+ }
+ else {
+ printf(
+ ' %-20.20s %-20.20s',
+ pretty_date( $d->{'start_time'} ),
+ pretty_date( $d->{'end_time'} ),
+ );
+ }
+ if ( $v >= 2 ) {
+ printf( '%-17.17s',
+ $d->{'fixed'}
+ ? ' Fixed'
+ : ' ' . pretty_duration_abs( $d->{duration} ) );
+ }
+ if ( $v >= 2 ) {
+ print( $d->{comment} );
+ }
}
print "\n";