summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 {