summaryrefslogtreecommitdiff
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
parent7e3ea47a68e8e87e321ac01f6f046733bca6aef5 (diff)
show service comments when using -vvv
-rw-r--r--Changelog1
-rwxr-xr-xbin/icli20
2 files changed, 17 insertions, 4 deletions
diff --git a/Changelog b/Changelog
index 90f12e0..ae2b38f 100644
--- a/Changelog
+++ b/Changelog
@@ -7,6 +7,7 @@ git HEAD
-u/--force-recheck wiht -aR / -a force_recheck
* add -ad / -a downtime option to schedule host/service downtimes
* Also show service downtimes when using -ld, improve its output
+ * Show service comments when using -vvv
icli 0.47 - Thu May 29 2014
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 ) );
+ }
}
}