+ Enhance memory local mode (Fix #24)

This commit is contained in:
garnier-quentin 2015-07-21 14:30:11 +02:00
parent 356537fd6e
commit c82b519cd8
1 changed files with 4 additions and 3 deletions

View File

@ -74,7 +74,9 @@ sub run {
command_path => $self->{option_results}->{command_path}, command_path => $self->{option_results}->{command_path},
command_options => $self->{option_results}->{command_options}); command_options => $self->{option_results}->{command_options});
my ($cached_used, $buffer_used, $free, $total_size); # Buffer can be missing. In Openvz container for example.
my $buffer_used = 0;
my ($cached_used, $free, $total_size);
foreach (split(/\n/, $stdout)) { foreach (split(/\n/, $stdout)) {
if (/^MemTotal:\s+(\d+)/i) { if (/^MemTotal:\s+(\d+)/i) {
$total_size = $1 * 1024; $total_size = $1 * 1024;
@ -87,8 +89,7 @@ sub run {
} }
} }
if (!defined($total_size) || !defined($cached_used) || if (!defined($total_size) || !defined($cached_used) || !defined($free)) {
!defined($buffer_used) || !defined($free)) {
$self->{output}->add_option_msg(short_msg => "Some informations missing."); $self->{output}->add_option_msg(short_msg => "Some informations missing.");
$self->{output}->option_exit(); $self->{output}->option_exit();
} }