From c82b519cd89313c58fbda941a5d755b2648a6e81 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Tue, 21 Jul 2015 14:30:11 +0200 Subject: [PATCH] + Enhance memory local mode (Fix #24) --- os/linux/local/mode/memory.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/os/linux/local/mode/memory.pm b/os/linux/local/mode/memory.pm index 45381dc07..86c8d57c0 100644 --- a/os/linux/local/mode/memory.pm +++ b/os/linux/local/mode/memory.pm @@ -74,7 +74,9 @@ sub run { command_path => $self->{option_results}->{command_path}, 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)) { if (/^MemTotal:\s+(\d+)/i) { $total_size = $1 * 1024; @@ -87,8 +89,7 @@ sub run { } } - if (!defined($total_size) || !defined($cached_used) || - !defined($buffer_used) || !defined($free)) { + if (!defined($total_size) || !defined($cached_used) || !defined($free)) { $self->{output}->add_option_msg(short_msg => "Some informations missing."); $self->{output}->option_exit(); }