I have Net-SNMP 5.2.1 on several FreeBSD 5.x (5.1, 5.2, 5.3) platforms
and have been puzzling over the difference in memory values reported by
memTotalReal vs. hrStorageSize.  The value from memTotalReal for total
memory is smaller than that reported by hrStorageSize.

In looking at the code, I noticed that both MIBs use sysctl to get the
installed RAM, but they are querying different values.  hrStorage is
quering sysctl hw.physmem while memTotalReal is looking at sysctl
hw.usermem.  I haven't found any good documentation on the difference
between hw.physmem and hw.usermem but what I've seen indicates
hw.physmem is the amount of physical RAM in the box while hw.usermem is
the amount of user memory in use.  Fetching memTotalReal seems to
support this assumption as the value keeps changing based on the amount
of memory in use at the time.

Would it be more consistent to change the code in
agent/mibgroup/ucd-snmp/memory_freebsd2.c to query sysctl hw.physmem for
memTotalReal?  A diff on the code change would look like this:

--- agent/mibgroup/ucd-snmp/memory_freebsd2.c.orig      Wed Aug  3
14:43:51 2005
+++ agent/mibgroup/ucd-snmp/memory_freebsd2.c   Wed Aug  3 14:44:12 2005
@@ -260,7 +260,7 @@

     u_long          phys_mem;
     size_t          phys_mem_size = sizeof(phys_mem);
-    int             phys_mem_mib[] = { CTL_HW, HW_USERMEM };
+    int             phys_mem_mib[] = { CTL_HW, HW_PHYSMEM };

 #ifdef BUFSPACE_SYMBOL
     long            bufspace;



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to