diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2010-09-05 16:21:10 +0200 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2010-09-05 16:21:10 +0200 |
commit | 0f3b5b657b95451f0c9328db053710c1edb782c6 (patch) | |
tree | 44d03184a9f9152a1fd3ecac334f5ce3f3196391 /bin | |
parent | 61fc6dec5d7312dbfaf19e8ccffda705a128cad4 (diff) |
proper -v handling
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/icli | 42 |
1 files changed, 18 insertions, 24 deletions
@@ -179,25 +179,16 @@ sub display_queue { sub display_service { my ($s) = @_; - given ($verbosity) { - when (1) { - printf( - "%-20.20s %s %s\n", - $s->{service_description}, - service_state($s->{has_been_checked}, $s->{current_state}), - $s->{plugin_output}, - ); - } - when (2) { - printf("%-20.20s %s %d/%d %s\n", - $s->{service_description}, - service_state($s->{has_been_checked}, $s->{current_state}), - $s->{current_attempt}, - $s->{max_attempts}, - $s->{plugin_output}, - ); - } + my $v = $verbosity; + + printf("%-20.20s", $s->{service_description}); + printf(" %s" , service_state($s->{'has_been_checked'}, $s->{'current_state'})); + + if ($v >= 2) { + printf(" %d/%d", $s->{'current_attempt'}, $s->{'max_attempts'}); } + + printf(" %s\n", $s->{'plugin_output'}); } sub display_host_services { @@ -224,17 +215,20 @@ sub display_host_services { sub display_host_single { my ($host) = @_; my $h = $data->{hosts}->{$host}; + my $v = $verbosity; if ($short and not $h->{current_state}) { return; } - printf( - "%-32.32s %s %s\n", - $h->{host_name}, - host_state($h->{has_been_checked}, $h->{current_state}), - $h->{plugin_output}, - ); + printf("%-32.32s", $h->{'host_name'}); + printf(" %s", host_state($h->{'has_been_checked'}, $h->{'current_state'})); + + if ($v >= 2) { + printf(" %d/%d", $h->{'current_attempt'}, $h->{'max_attempts'}); + } + + printf(" %s\n", $h->{'plugin_output'}); } sub display_host { |