Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Commit

Permalink
Memory usage fix for negative memory usage reported by rhevm-guest-agent
Browse files Browse the repository at this point in the history
(Fixes #10)
  • Loading branch information
Rene Koch committed Nov 7, 2013
1 parent 9fdf1d3 commit 7668308
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions plugin-dir/check_rhev3.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1219,6 +1219,10 @@ sub get_stats {
}else{
my $mem_installed = $result{statistic}{"memory.installed"}{values}{value}{datum};
my $mem_used = $result{statistic}{"memory.used"}{values}{value}{datum};
# fix issue with negative memory usage
if ($mem_used < 0){
$mem_used = $mem_installed + $mem_used;
}
$memory_usage = sprintf("%.2f", $mem_used / $mem_installed * 100);
}
$rethash{$key}{usage} = $memory_usage;
Expand Down

0 comments on commit 7668308

Please sign in to comment.