diff --git a/cloud/docker/mode/blockio.pm b/cloud/docker/mode/blockio.pm index d5e40b3fa..00aa0ae9c 100644 --- a/cloud/docker/mode/blockio.pm +++ b/cloud/docker/mode/blockio.pm @@ -158,6 +158,7 @@ sub run { $new_datas->{last_timestamp} = time(); my $old_timestamp = $self->{statefile_value}->get(name => 'last_timestamp'); + # First execution if (!defined($old_timestamp)) { $self->{output}->output_add(severity => 'OK', short_msg => "Buffer creation..."); @@ -201,15 +202,15 @@ sub run { $write_value . $write_unit)); $self->{output}->perfdata_add(label => 'read_io', unit => 'B/s', - value => sprintf("%.2f", $read_absolute_per_sec), - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-read'), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-read'), - min => 0); + value => sprintf("%.2f", $read_absolute_per_sec), + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-read'), + critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-read'), + min => 0); $self->{output}->perfdata_add(label => 'write_io', unit => 'B/s', - value => sprintf("%.2f", $write_absolute_per_sec), - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-write'), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-write'), - min => 0); + value => sprintf("%.2f", $write_absolute_per_sec), + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-write'), + critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-write'), + min => 0); $self->{statefile_value}->write(data => $new_datas); diff --git a/cloud/docker/mode/containerstate.pm b/cloud/docker/mode/containerstate.pm index 3d8348646..b8076149a 100644 --- a/cloud/docker/mode/containerstate.pm +++ b/cloud/docker/mode/containerstate.pm @@ -177,6 +177,7 @@ sub run { if (defined($self->{option_results}->{id}) || defined($self->{option_results}->{name})) { while ( my ($keys,$values) = each(%{$webcontent->{State}})) { + # Why not set a variable that contains the state? if ($values eq 'true') { $result = $keys; $containername = $webcontent->{Name}; @@ -200,6 +201,7 @@ sub run { $containername = $val->{Names}->[0]; $containername =~ s/^\///; + # Thanks to Docker API for the paused state... if (($val->{Status} =~ m/^Up/) && ($val->{Status} =~ m/^(?:(?!Paused).)*$/)) { $result = 'Running'; $nbrunning++; @@ -215,7 +217,7 @@ sub run { $exit = $self->{output}->get_most_critical(status => [ $tmp_exit, $exit ]); if (!$self->{output}->is_status(value => $tmp_exit, compare => 'OK', litteral => 1)) { $self->{output}->output_add(long_msg => sprintf("Containers %s is in %s state", - $containername, $result)); + $containername, $result)); } } @@ -224,16 +226,16 @@ sub run { short_msg => sprintf("Some containers are in wrong state")); } $self->{output}->perfdata_add(label => "running", - value => $nbrunning, - min => 0, + value => $nbrunning, + min => 0, ); $self->{output}->perfdata_add(label => "paused", - value => $nbpaused, - min => 0, + value => $nbpaused, + min => 0, ); $self->{output}->perfdata_add(label => "exited", - value => $nbexited, - min => 0, + value => $nbexited, + min => 0, ); } diff --git a/cloud/docker/mode/image.pm b/cloud/docker/mode/image.pm index e5ad60c35..ce4bde967 100644 --- a/cloud/docker/mode/image.pm +++ b/cloud/docker/mode/image.pm @@ -187,7 +187,7 @@ __END__ =head1 MODE -Check Container's image viability +Check Container's image viability with a registry =over 8