From 8d515ce48915195ed9e57cf9ad4368bc86eb41a7 Mon Sep 17 00:00:00 2001 From: qgarnier Date: Tue, 14 Mar 2023 13:16:44 +0000 Subject: [PATCH] (plugin) network::hirschmann::standard::snmp - mode memory fix calc (#4280) --- .../hirschmann/standard/snmp/mode/memory.pm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/network/hirschmann/standard/snmp/mode/memory.pm b/src/network/hirschmann/standard/snmp/mode/memory.pm index a377f1f14..15ed9d534 100644 --- a/src/network/hirschmann/standard/snmp/mode/memory.pm +++ b/src/network/hirschmann/standard/snmp/mode/memory.pm @@ -88,12 +88,12 @@ my $map_enable = { my $mapping = { hios => { measure_enable => { oid => '.1.3.6.1.4.1.248.11.22.1.8.1', map => $map_enable }, # hm2DiagEnableMeasurement - ram_total => { oid => '.1.3.6.1.4.1.248.11.22.1.8.11.1' }, # hm2DiagMemoryRamAllocated + ram_used => { oid => '.1.3.6.1.4.1.248.11.22.1.8.11.1' }, # hm2DiagMemoryRamAllocated ram_free => { oid => '.1.3.6.1.4.1.248.11.22.1.8.11.2' } # hm2DiagMemoryRamFree }, classic => { measure_enable => { oid => '.1.3.6.1.4.1.248.14.2.15.1', map => $map_enable }, # hmEnableMeasurement - ram_total => { oid => '.1.3.6.1.4.1.248.14.2.15.3.1' }, # hmMemoryAllocated + ram_used => { oid => '.1.3.6.1.4.1.248.14.2.15.3.1' }, # hmMemoryAllocated ram_free => { oid => '.1.3.6.1.4.1.248.14.2.15.3.2' } # hmMemoryFree } }; @@ -109,14 +109,14 @@ sub check_memory { $self->{output}->option_exit(); } - $result->{ram_total} *= 1024; + $result->{ram_used} *= 1024; $result->{ram_free} *= 1024; $self->{ram} = { - total => $result->{ram_total}, - used => $result->{ram_total} - $result->{ram_free}, + total => $result->{ram_used} + $result->{ram_free}, + used => $result->{ram_used}, free => $result->{ram_free}, - prct_used => 100 - ($result->{ram_free} * 100 / $result->{ram_total}), - prct_free => $result->{ram_free} * 100 / $result->{ram_total} + prct_used => $result->{ram_used} * 100 / ($result->{ram_used} + $result->{ram_free}), + prct_free => $result->{ram_free} * 100 / ($result->{ram_used} + $result->{ram_free}) }; }