add few comments

This commit is contained in:
Shini31 2015-07-24 15:27:20 +02:00
parent 91935ee9fd
commit 311ac12ca0
3 changed files with 19 additions and 16 deletions

View File

@ -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);

View File

@ -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,
);
}

View File

@ -187,7 +187,7 @@ __END__
=head1 MODE
Check Container's image viability
Check Container's image viability with a registry
=over 8