summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2014-06-02 17:07:17 +0200
committerDaniel Friesel <derf@finalrewind.org>2014-06-02 17:07:17 +0200
commit8559009dc832e65aab539b891308c6c9a33c6deb (patch)
treeaae21cf5d0aad8f59f1622bf683e993c357304b4 /bin
parent8bc973db6d3a21d23bb1f9fac0573c5e438768fd (diff)
-ld: Print "no {host/service} downtimes" instead of an empty list
Diffstat (limited to 'bin')
-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) {