summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2010-11-20 09:59:51 +0100
committerDaniel Friesel <derf@finalrewind.org>2010-11-20 09:59:51 +0100
commitefbe4a66d63d2a55c9e9721e471780b2cfba23ad (patch)
treec87858d2ea7ebf00f2961c3968c1fb1eecd50853
parenta8a3d4bdb9393631f308f516df7e4ddad423bd33 (diff)
Add -vv mode for -lh as well
-rwxr-xr-xbin/icli65
1 files changed, 60 insertions, 5 deletions
diff --git a/bin/icli b/bin/icli
index 9c6e9b8..a2f061e 100755
--- a/bin/icli
+++ b/bin/icli
@@ -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 {