in reply to Re^4: best way to monitor real memory usage on linux
in thread best way to monitor real memory usage on linux

Surely I don't understand the question - it looks like you are asking how to eliminate e.g. the $cache variable, but that seems too simple given your apparently higher skill level.!

One world, one people

  • Comment on Re^5: best way to monitor real memory usage on linux

Replies are listed 'Best First'.
Re^6: best way to monitor real memory usage on linux
by mariog (Acolyte) on Aug 07, 2015 at 08:33 UTC
    Hello

    That is my question for now...I have used mainly the examples of the Nagios::Plugin and Net::SNMP to build the script..

    The object returned by Net::SNMP get_request is a hash how can I make arithmetic operation on the values returned by those. the only workaround I found was to extract the value in a temporary variable..

    I am in my first baby steps in Perl.
      You are receiving a hash reference as a result. So if the call is $result = $session->get_request(<arguments>), then instead of a temporary variable you can use the expression $result->{key} instead. The last argument in the call should be a reference to array of OIDs, rather than calling get_request (blocking) for every individual OID! An example of arithmetic using referenced hash values:-
      my $AminusBminusC = $result->{A} - $result->{B} - $result->{C};
      The A B and C are actual keys. Actually any expression can go inside the braces (e.g. variable, function call, array element, yet another hash value) and the value of the expression will be used as the key to look up its corresponding hash value. If instead you were directly accessing a hash called %result instead of a hash reference $result, you'd remove the -> (dereference) operator from each expression that gets the value for a key. Hope this helps!

      One world, one people