From owner-freebsd-ports-bugs@FreeBSD.ORG Wed Apr 15 18:00:07 2009 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 258EC106567C for ; Wed, 15 Apr 2009 18:00:07 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 0078C8FC22 for ; Wed, 15 Apr 2009 18:00:07 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n3FI05Ji003128 for ; Wed, 15 Apr 2009 18:00:05 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n3FI05Oe003127; Wed, 15 Apr 2009 18:00:05 GMT (envelope-from gnats) Resent-Date: Wed, 15 Apr 2009 18:00:05 GMT Resent-Message-Id: <200904151800.n3FI05Oe003127@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Michael W Lucas Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 471F4106564A for ; Wed, 15 Apr 2009 17:55:51 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 1B45B8FC15 for ; Wed, 15 Apr 2009 17:55:51 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n3FHtoFu079941 for ; Wed, 15 Apr 2009 17:55:50 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n3FHtorH079940; Wed, 15 Apr 2009 17:55:50 GMT (envelope-from nobody) Message-Id: <200904151755.n3FHtorH079940@www.freebsd.org> Date: Wed, 15 Apr 2009 17:55:50 GMT From: Michael W Lucas To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: ports/133758: new net-snmp does not count inactive memory as free X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Apr 2009 18:00:07 -0000 >Number: 133758 >Category: ports >Synopsis: new net-snmp does not count inactive memory as free >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Apr 15 18:00:05 UTC 2009 >Closed-Date: >Last-Modified: >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 Patch attached with submission follows: --- 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: >Unformatted: