summaryrefslogtreecommitdiff
path: root/bin/icli
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2014-06-12 11:22:06 +0200
committerDaniel Friesel <derf@finalrewind.org>2014-06-12 11:22:06 +0200
commitdf744427be22787720e84850a209c6b0e0241e0f (patch)
treeddebe036d5fae65f8dd7af0bf6e8f4c55471eff9 /bin/icli
parent7e3ea47a68e8e87e321ac01f6f046733bca6aef5 (diff)
show service comments when using -vvv
Diffstat (limited to 'bin/icli')
-rwxr-xr-xbin/icli20
1 files changed, 16 insertions, 4 deletions
diff --git a/bin/icli b/bin/icli
index dc30273..06ba2e8 100755
--- a/bin/icli
+++ b/bin/icli
@@ -384,12 +384,10 @@ sub read_objects_line {
= $cache;
}
when ('hostcomment') {
-
- # TODO
+ push( @{ ${$ref}->{hostcomments} }, $cache );
}
when ('servicecomment') {
-
- # TODO
+ push( @{ ${$ref}->{servicecomments} }, $cache );
}
when ('host') {
${$ref}->{hosts}->{ $cache->{host_name} } = $cache;
@@ -441,6 +439,16 @@ sub read_objects {
}
sub enhance_status {
+ for my $c ( @{ $data->{servicecomments} } ) {
+ say "!";
+ my $service
+ = firstval { $_->{service_description} eq $c->{service_description} }
+ @{ $data->{services}->{ $c->{host_name} } };
+ push( @{ $service->{comments} }, $c );
+ }
+ for my $c ( @{ $data->{hostcomments} } ) {
+ push( @{ $data->{hosts}->{ $c->{host_name} }->{comments} }, $c );
+ }
HOST: for my $h ( keys %{ $data->{services} } ) {
for my $s ( @{ $data->{services}->{$h} } ) {
if ( $s->{current_state} != 0 ) {
@@ -802,6 +810,10 @@ sub display_x_verbose {
'Flap Detection',
pretty_yesno( $x->{'flap_detection_enabled'} ),
);
+
+ for my $c ( @{ $x->{comments} // [] } ) {
+ printf( $format, 'Comment', break_str( $c->{comment_data}, 19 ) );
+ }
}
}