From 79874167598a4649634c9818f8c61b050b93a3f0 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Thu, 18 Jul 2019 09:12:59 +0200 Subject: [PATCH] Fix #1589 --- network/checkpoint/snmp/mode/memory.pm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/network/checkpoint/snmp/mode/memory.pm b/network/checkpoint/snmp/mode/memory.pm index 4374e02b7..28b62898d 100644 --- a/network/checkpoint/snmp/mode/memory.pm +++ b/network/checkpoint/snmp/mode/memory.pm @@ -139,12 +139,14 @@ sub manage_selection { total => $results->{$oid_memTotalReal64}, }; - $self->{swap} = { - prct_used => ($results->{$oid_memActiveVirtual64} - $results->{$oid_memActiveReal64}) * 100 / ($results->{$oid_memTotalVirtual64} - $results->{$oid_memTotalReal64}), - used => $results->{$oid_memActiveVirtual64} - $results->{$oid_memActiveReal64}, - free => $results->{$oid_memTotalVirtual64} - $results->{$oid_memTotalReal64} - ($results->{$oid_memActiveVirtual64} - $results->{$oid_memActiveReal64}), - total => $results->{$oid_memTotalVirtual64} - $results->{$oid_memTotalReal64} - }; + if ($results->{$oid_memTotalVirtual64} > $results->{$oid_memTotalReal64}) { + $self->{swap} = { + prct_used => ($results->{$oid_memActiveVirtual64} - $results->{$oid_memActiveReal64}) * 100 / ($results->{$oid_memTotalVirtual64} - $results->{$oid_memTotalReal64}), + used => $results->{$oid_memActiveVirtual64} - $results->{$oid_memActiveReal64}, + free => $results->{$oid_memTotalVirtual64} - $results->{$oid_memTotalReal64} - ($results->{$oid_memActiveVirtual64} - $results->{$oid_memActiveReal64}), + total => $results->{$oid_memTotalVirtual64} - $results->{$oid_memTotalReal64} + }; + } $self->{malloc} = { failed_mallocs => $results->{$oid_fwKmemFailedAlloc} }; }