From b0d074ea5ef30212c83e4848f2122dc988d7f467 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 20 Nov 2010 03:24:19 +0100 Subject: Show DOWN/UNREACHABBLE hosts in service list --- bin/icli | 16 +++++++++++++++- t/out/filter_.A.o | 2 +- t/out/filter_.o | 2 +- t/out/filter_D | 4 ++-- t/out/filter_S | 2 +- t/out/filter_c | 2 +- t/out/filter_u | 2 +- t/out/list_services_nc | 4 ++-- t/out/services_group_local | 4 ++-- t/out/services_short | 2 +- t/out/standard | 4 ++-- 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%): -- cgit v1.2.3