Skip site navigation (1)Skip section navigation (2)

ports/133758: new net-mgmt/net-snmp does not count inactive memory as free

From:Michael W Lucas <mwlucas@blackhelicopters.org>
Date:Wed, 15 Apr 2009 17:55:50 GMT
Subject:new net-snmp does not count inactive memory as free
Send-pr version:www-3.1

Number:133758
Category:ports
Synopsis:new net-mgmt/net-snmp does not count inactive memory as free
Severity:critical
Priority:low
Responsible:pgollucci@FreeBSD.org
State:feedback
Class:sw-bug
Arrival-Date:Wed Apr 15 18:00:05 UTC 2009
Closed-Date:
Last-Modified:Wed Jun 24 03:17:54 UTC 2009
Originator:Michael W Lucas
Release:6.2, current ports tree

Organization:
none
 
Environment:
FreeBSD aubsr086.us.add 6.2-STABLE FreeBSD 6.2-STABLE #1: Mon Mar 12 13:24:16 EST 2007 system_mwl@aubsr023.us.add:/usr/obj/usr/src/sys/NSONE i386
Description:
Hi,

Previous versions of the net-snmp port counted inactive memory as free. This is important for monitoring tools, such as Nagios. Without this behavior, net-snmp reports an alarm when the system has large amounts of inactive memory.

The net-snmp folks seems calculate this value in several places; I'm not sure if they keep changing it or if the way we build our ports changes it. In any event, the attached patch tells the new net-snmp to count inactive as free.

I'll also send this to the net-snmp people, try to get this incorporated upstream.
 
How-To-Repeat:
set snmpd to flag an alarm when the system has less than a certain amount free. Let inactive memory+used memory rise above that level. Use snmpwalk to verify that snmpd reports an alarm.
 
Fix:
see attached patch
Download patch.txt
--- memory_freebsd.c     Wed Apr 15 12:33:51 2009
+++ memory_freebsd.c.orig        Wed May 28 07:48:46 2008
@@ -59,7 +59,6 @@
     sysctlbyname("vfs.bufspace",    &bufspace,    &buf_size, NULL, 0);
     sysctlbyname("vfs.maxbufspace", &maxbufspace, &buf_size, NULL, 0);
     auto_nlist(SUM_SYMBOL,      (char *) &vmem,     sizeof(vmem));
-    auto_nlist(BUFSPACE_SYMBOL, (char *) &bufspace, sizeof(bufspace));
 #ifndef freebsd4
     pagesize = 1024;
 #else
@@ -76,7 +75,7 @@
         if (!mem->descr)
              mem->descr = strdup("Physical memory");
         mem->units = pagesize;
-        mem->size  = phys_mem/pagesize;
+        mem->size  = user_mem/pagesize;
         mem->free  = total.t_free;
     }
@@ -132,18 +131,7 @@
              mem->descr = strdup("Cached memory");
         mem->units = vmem.v_page_size;
         mem->size  = vmem.v_cache_max;
-        mem->free  = vmem.v_cache_max - (vmem.v_cache_count + vmem.v_inactive_count);
-    }
-
-    mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_MBUF, 1 );
-    if (!mem) {
-        snmp_log_perror("No Memory Buffer info entry");
-    } else {
-        if (!mem->descr)
-            mem->descr = strdup("Memory Buffer");
-        mem->units = pagesize;
-        mem->size  = bufspace/pagesize;
-        mem->free  = -1;
+        mem->free  = vmem.v_cache_max - vmem.v_cache_count;
     }
     nswap = swapmode(pagesize);


Release-Note:
 
Audit-Trail:
Responsible Changed
From-To:freebsd-ports-bugs->kuriyama
By:linimon
When:Thu Apr 16 21:18:03 UTC 2009
Why:Fix synopsis and assign.

Responsible Changed
From-To:kuriyama->pgollucci
By:pav
When:Fri May 15 14:00:15 UTC 2009
Why:Assign to new maintainer

State Changed
From-To:open->feedback
By:pgollucci
When:Mon May 18 05:55:49 UTC 2009
Why:how did the upstream submission go?

Unformatted:
 
Submit Followup | Raw PR | Find another PR