diff options
author | Daniel Friesel <derf@finalrewind.org> | 2010-11-20 09:59:51 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2010-11-20 09:59:51 +0100 |
commit | efbe4a66d63d2a55c9e9721e471780b2cfba23ad (patch) | |
tree | c87858d2ea7ebf00f2961c3968c1fb1eecd50853 /bin/icli | |
parent | a8a3d4bdb9393631f308f516df7e4ddad423bd33 (diff) |
Add -vv mode for -lh as well
Diffstat (limited to 'bin/icli')
-rwxr-xr-x | bin/icli | 65 |
1 files changed, 60 insertions, 5 deletions
@@ -483,17 +483,72 @@ sub display_host_services { sub display_host_single { my ($host) = @_; + my $format = "%-16s : %s\n"; my $h = $data->{hosts}->{$host}; my $v = $verbosity; - printf("%-32.32s", $h->{'host_name'}); - printf(" %s", host_state($h->{'has_been_checked'}, $h->{'current_state'})); + if ($v < 3) { - if ($v >= 2) { - printf(" %d/%d", $h->{'current_attempt'}, $h->{'max_attempts'}); + 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'}); + } + else { + printf( + $format, + 'Host', + $h->{'host_name'}, + ); + printf( + "%-16s : %s (for %s)%s\n", + 'Status', + host_state($h->{'has_been_checked'}, $h->{'current_state'}), + pretty_duration($h->{'last_state_change'}), + ($h->{'problem_has_been_acknowledged'} ? ' (Acknowledged)' : q{}), + ); + printf( + $format, + 'Plugin Output', + $h->{'plugin_output'}, + ); + printf( + $format, + 'Performance Data', + $h->{'performance_data'}, + ); + printf( + "%-16s : %d/%d\n", + 'Current Attempt', + $h->{'current_attempt'}, + $h->{'max_attempts'}, + ); + printf( + $format, + 'Last Check Time', + pretty_date($h->{'last_check'}), + ); + printf( + $format, + 'Next Check', + pretty_date($h->{'next_check'}), + ); + printf( + "%-16s : %s (%.1f%% state change)\n", + 'Flapping', + ($h->{'is_flapping'} ? + colored('YES', 'white on_red') : + colored('NO', 'black on_green') + ), + $h->{'percent_state_change'}, + ); + print "\n"; } - printf(" %s\n", $h->{'plugin_output'}); } sub display_host { |