summaryrefslogtreecommitdiff
path: root/bin/icli
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2010-07-30 17:46:42 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2010-07-30 17:46:42 +0200
commit38af3454d62611121963c0da8150980e21d31fc6 (patch)
tree0e8a3275ecff5a63a4e515b62c996185cd64aaa4 /bin/icli
parente8d4fa8c1cacc4062a573c46ced2e7c1ee25212a (diff)
Primitive support for pending service checks
Diffstat (limited to 'bin/icli')
-rwxr-xr-xbin/icli18
1 files changed, 14 insertions, 4 deletions
diff --git a/bin/icli b/bin/icli
index bfb959c..b1d7a92 100755
--- a/bin/icli
+++ b/bin/icli
@@ -104,7 +104,12 @@ sub enhance_status {
}
sub service_state {
- my ($digit) = @_;
+ my ($checked, $digit) = @_;
+
+ if (not $checked) {
+ return 'PENDING ';
+ }
+
given ($digit) {
when(0) { return with_colour(' OK ', 'black on_green' ) }
when(1) { return with_colour(' WARNING', 'black on_yellow') }
@@ -115,7 +120,12 @@ sub service_state {
}
sub host_state {
- my ($digit) = @_;
+ my ($checked, $digit) = @_;
+
+ if (not $checked) {
+ return ' PENDING ';
+ }
+
given($digit) {
when(0) { return with_colour(' OK ', 'black on_green') }
when(1) { return with_colour(' DOWN ', 'white on_red' ) }
@@ -164,7 +174,7 @@ sub display_service {
printf(
"%-20.20s %s %s\n",
$s->{service_description},
- service_state($s->{current_state}),
+ service_state($s->{has_been_checked}, $s->{current_state}),
$s->{plugin_output},
);
}
@@ -201,7 +211,7 @@ sub display_host_single {
printf(
"%-32.32s %s %s\n",
$h->{host_name},
- host_state($h->{current_state}),
+ host_state($h->{has_been_checked}, $h->{current_state}),
$h->{plugin_output},
);
}