summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2010-11-20 03:24:19 +0100
committerDaniel Friesel <derf@finalrewind.org>2010-11-20 03:24:19 +0100
commitb0d074ea5ef30212c83e4848f2122dc988d7f467 (patch)
treee6dcc8587baa2c2c21f609bbb5edece489dbd667
parent0eab1e66dfce62d603d4ccde50bcee9378bd620d (diff)
Show DOWN/UNREACHABBLE hosts in service list
-rwxr-xr-xbin/icli16
-rw-r--r--t/out/filter_.A.o2
-rw-r--r--t/out/filter_.o2
-rw-r--r--t/out/filter_D4
-rw-r--r--t/out/filter_S2
-rw-r--r--t/out/filter_c2
-rw-r--r--t/out/filter_u2
-rw-r--r--t/out/list_services_nc4
-rw-r--r--t/out/services_group_local4
-rw-r--r--t/out/services_short2
-rw-r--r--t/out/standard4
11 files changed, 29 insertions, 15 deletions
diff --git a/bin/icli b/bin/icli
index eb84fdb..2c5d15a 100755
--- a/bin/icli
+++ b/bin/icli
@@ -374,11 +374,25 @@ sub display_service {
sub display_host_services {
my ($host, $all) = @_;
my @services;
+ my $h = $data->{'hosts'}->{$host};
@services = grep { filter_service($_) } @{$data->{'services'}->{$host}};
if ($all and @services) {
- say "\n$host";
+
+ print "\n$host";
+
+ if ($h->{'current_state'}) {
+ print q{ };
+ }
+ if ($h->{'current_state'} == 1) {
+ print colored('DOWN', 'white on_red');
+ }
+ elsif ($h->{'current_state'} == 2) {
+ print colored('UNREACHABLE', 'white on_blue');
+ }
+
+ print "\n";
}
foreach my $service (@services) {
diff --git a/t/out/filter_.A.o b/t/out/filter_.A.o
index f6396c5..f570a57 100644
--- a/t/out/filter_.A.o
+++ b/t/out/filter_.A.o
@@ -1,5 +1,5 @@
-aneurysm
+aneurysm UNREACHABLE
Load CRITICAL OK - load average: 0.17, 0.13, 0.09
Processes  UNKNOWN PROCS OK: 118 processes
diff --git a/t/out/filter_.o b/t/out/filter_.o
index f6396c5..f570a57 100644
--- a/t/out/filter_.o
+++ b/t/out/filter_.o
@@ -1,5 +1,5 @@
-aneurysm
+aneurysm UNREACHABLE
Load CRITICAL OK - load average: 0.17, 0.13, 0.09
Processes  UNKNOWN PROCS OK: 118 processes
diff --git a/t/out/filter_D b/t/out/filter_D
index 105ebbe..601e69c 100644
--- a/t/out/filter_D
+++ b/t/out/filter_D
@@ -1,8 +1,8 @@
-alpha
+alpha DOWN
HTTP  OK  HTTP OK: HTTP/1.0 200 OK - 2333 bytes in 0.019 second response time
-aneurysm
+aneurysm UNREACHABLE
Disk: /  OK  DISK OK - free space: / 4846 MB (75% inode=90%):
Disk: /boot  OK  DISK OK - free space: /boot 119 MB (53% inode=99%):
Disk: /data  OK  DISK OK - free space: /data 60091 MB (48% inode=99%):
diff --git a/t/out/filter_S b/t/out/filter_S
index f6396c5..f570a57 100644
--- a/t/out/filter_S
+++ b/t/out/filter_S
@@ -1,5 +1,5 @@
-aneurysm
+aneurysm UNREACHABLE
Load CRITICAL OK - load average: 0.17, 0.13, 0.09
Processes  UNKNOWN PROCS OK: 118 processes
diff --git a/t/out/filter_c b/t/out/filter_c
index acc5847..46a6433 100644
--- a/t/out/filter_c
+++ b/t/out/filter_c
@@ -1,3 +1,3 @@
-aneurysm
+aneurysm UNREACHABLE
Load CRITICAL OK - load average: 0.17, 0.13, 0.09
diff --git a/t/out/filter_u b/t/out/filter_u
index ba2b691..b2f93fa 100644
--- a/t/out/filter_u
+++ b/t/out/filter_u
@@ -1,3 +1,3 @@
-aneurysm
+aneurysm UNREACHABLE
Processes  UNKNOWN PROCS OK: 118 processes
diff --git a/t/out/list_services_nc b/t/out/list_services_nc
index 2ff7487..df0529f 100644
--- a/t/out/list_services_nc
+++ b/t/out/list_services_nc
@@ -1,8 +1,8 @@
-alpha
+alpha DOWN
HTTP OK HTTP OK: HTTP/1.0 200 OK - 2333 bytes in 0.019 second response time
-aneurysm
+aneurysm UNREACHABLE
Disk: / OK DISK OK - free space: / 4846 MB (75% inode=90%):
Disk: /boot OK DISK OK - free space: /boot 119 MB (53% inode=99%):
Disk: /data OK DISK OK - free space: /data 60091 MB (48% inode=99%):
diff --git a/t/out/services_group_local b/t/out/services_group_local
index 105ebbe..601e69c 100644
--- a/t/out/services_group_local
+++ b/t/out/services_group_local
@@ -1,8 +1,8 @@
-alpha
+alpha DOWN
HTTP  OK  HTTP OK: HTTP/1.0 200 OK - 2333 bytes in 0.019 second response time
-aneurysm
+aneurysm UNREACHABLE
Disk: /  OK  DISK OK - free space: / 4846 MB (75% inode=90%):
Disk: /boot  OK  DISK OK - free space: /boot 119 MB (53% inode=99%):
Disk: /data  OK  DISK OK - free space: /data 60091 MB (48% inode=99%):
diff --git a/t/out/services_short b/t/out/services_short
index f6396c5..f570a57 100644
--- a/t/out/services_short
+++ b/t/out/services_short
@@ -1,5 +1,5 @@
-aneurysm
+aneurysm UNREACHABLE
Load CRITICAL OK - load average: 0.17, 0.13, 0.09
Processes  UNKNOWN PROCS OK: 118 processes
diff --git a/t/out/standard b/t/out/standard
index d9a3cd1..815ca3b 100644
--- a/t/out/standard
+++ b/t/out/standard
@@ -1,8 +1,8 @@
-alpha
+alpha DOWN
HTTP  OK  HTTP OK: HTTP/1.0 200 OK - 2333 bytes in 0.019 second response time
-aneurysm
+aneurysm UNREACHABLE
Disk: /  OK  DISK OK - free space: / 4846 MB (75% inode=90%):
Disk: /boot  OK  DISK OK - free space: /boot 119 MB (53% inode=99%):
Disk: /data  OK  DISK OK - free space: /data 60091 MB (48% inode=99%):