summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/icli48
1 files changed, 29 insertions, 19 deletions
diff --git a/bin/icli b/bin/icli
index 9bfa94a..65ea86d 100755
--- a/bin/icli
+++ b/bin/icli
@@ -1120,28 +1120,38 @@ elsif ( $list_type eq 'q' ) {
display_queue();
}
elsif ( $list_type eq 'd' ) {
- say "Host downtimes:";
- if ( $verbosity == 1 ) {
- printf( "%-25.25s %-20.20s %-20.20s\n", 'Host', 'start', 'stop' );
- }
- elsif ( $verbosity == 2 ) {
- printf( "%-25.25s %-20.20s %-20.20s %-17.17s %s\n",
- 'Host', 'start', 'stop', 'duration', 'comment' );
- }
- foreach my $downtime ( @{ $data->{hostdowntimes} } ) {
- display_downtime($downtime);
+ if ( @{ $data->{hostdowntimes} } ) {
+ say "Host downtimes:";
+ if ( $verbosity == 1 ) {
+ printf( "%-25.25s %-20.20s %-20.20s\n", 'Host', 'start', 'stop' );
+ }
+ elsif ( $verbosity == 2 ) {
+ printf( "%-25.25s %-20.20s %-20.20s %-17.17s %s\n",
+ 'Host', 'start', 'stop', 'duration', 'comment' );
+ }
+ foreach my $downtime ( @{ $data->{hostdowntimes} } ) {
+ display_downtime($downtime);
+ }
}
- say "\nService downtimes:";
- if ( $verbosity == 1 ) {
- printf( "%-25.25s %-25.25s %-20.20s %-20.20s\n",
- 'Host', 'Service', 'start', 'stop' );
+ else {
+ say "No host downtimes";
}
- elsif ( $verbosity == 2 ) {
- printf( "%-25.25s %-25.25s %-20.20s %-20.20s %-17.17s %s\n",
- 'Host', 'Service', 'start', 'stop', 'duration', 'comment' );
+ if ( @{ $data->{servicedowntimes} } ) {
+ say "\nService downtimes:";
+ if ( $verbosity == 1 ) {
+ printf( "%-25.25s %-25.25s %-20.20s %-20.20s\n",
+ 'Host', 'Service', 'start', 'stop' );
+ }
+ elsif ( $verbosity == 2 ) {
+ printf( "%-25.25s %-25.25s %-20.20s %-20.20s %-17.17s %s\n",
+ 'Host', 'Service', 'start', 'stop', 'duration', 'comment' );
+ }
+ foreach my $downtime ( @{ $data->{servicedowntimes} } ) {
+ display_downtime($downtime);
+ }
}
- foreach my $downtime ( @{ $data->{servicedowntimes} } ) {
- display_downtime($downtime);
+ else {
+ say "\nNo service downtimes";
}
}
elsif ($action) {