Re: OpenBSD w/ DISMAN-EVENT-MIB swapError / memMinimumSwap

"Brian A. Seklecki" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
 	Okay per the grep below, the problem is in memory_netbsd1.c, 
which, given the name of the file, would explain a great deal of 
desynchronization between the kernel data structures and the state of the 
MIB data retrieval algorithm.  The logic is the line:

if (swapFree < minimumswap)
 	....blah

In FreeBSD, swapFree get's assigned

 	swapFree += kswap[i].ksw_total

But in OpenBSD (I'm assuming it uses the NetBSD #ifdef'd file), I don't 
really even see where swapFree is getting set.  Unless

 	long_ret = (swapFree > minimumswap) ? 0 : 1;

...bitwise operation is doing so.  But I doubt it.  I suspect the problem 
is persistent in NetBSD as well (CC'ing pkgsrc maintainer).  Also, I don't 
know how far apart the NetBSD and OpenBSD virtual memory systems have 
grown.


net-snmp-5.2.1.2/agent/mibgroup/ucd-snmp$ grep -ir swapFree ./*
./memory.c:       unsigned long *swapfree);
./memory.c:        swapfree;
./memory.c:           &swapfree);
./memory.c:       unsigned long *swapfree)
./memory.c:        b = strstr(buff, "SwapFree: ");
./memory.c:            sscanf(b, "SwapFree: %lu", swapfree);
./memory.c:            snmp_log(LOG_ERR, "No SwapFree line in 
/proc/meminfo\n");
./memory.c:            *swapfree = 0;
./memory.c:    swapfree
./memory.c:        case swapfree:
./memory.c:    spaceleft = memory(swapfree);
./memory.c:        long_ret = memory(memfree) + memory(swapfree);
./memory_freebsd2.c:quad_t          swapFree;
./memory_freebsd2.c:        sscanf(ext.output, "%*s%*d%qd%qd", &swapUsed, 
&swapFree);
./memory_freebsd2.c:        swapTotal = swapUsed + swapFree;
./memory_freebsd2.c:    swapUsed = swapTotal = swapFree = 0;
./memory_freebsd2.c:        swapFree += kswap[i].ksw_total - 
kswap[i].ksw_used;
./memory_freebsd2.c:    swapUsed = swapTotal - swapFree;
./memory_freebsd2.c:    swapFree *= pagesize;
./memory_freebsd2.c:        long_ret = swapFree;
./memory_freebsd2.c:        long_ret = (swapFree > minimumswap) ? 0 : 1;
./memory_freebsd2.c:        if (swapFree < minimumswap)
./memory_freebsd2.c:            sprintf(errmsg, "Running out of swap space 
(%qd)", swapFree);
./memory_netbsd1.c:quad_t          swapFree;
./memory_netbsd1.c:        long_ret = (swapFree > minimumswap) ? 0 : 1;
./memory_netbsd1.c:        if (swapFree < minimumswap)
./memory_netbsd1.c:            sprintf(errmsg, "Running out of swap space 
(%qd)", swapFree);



On Mon, 15 Aug 2005, Brian A. Seklecki wrote:

>
> [with the correct address list this time]
>
> All:
>
> Another issue with OpenBSD.  Using the 'defaultMonitor' config with OpenBSD 
> 3.7/i386 running Net-SNMP 5.2.1p1.  At agent restart, I always get a trap 
> from the agent about swap:
>
> example:
>
> Jul 25 08:49:01 nmsHostname snmptrapd[72648]: 2005-07-25 08:49:01 
> hostname.com [UDP: [192.168.1.1]:45160]: DISMAN-EVENT-MIB::sysUpTimeInstance 
> = Timeticks: (40857874) 4 days, 17:29:38.74 SNMPv2-MIB::snmpTrapOID.0 = OID: 
> DISMAN-EVENT-MIB::mteTriggerFired DISMAN-EVENT-MIB::mteHotTrigger = STRING: 
> memory DISMAN-EVENT-MIB::mteHotTargetName = STRING: 
> DISMAN-EVENT-MIB::mteHotContextName = STRING: DISMAN-EVENT-MIB::mteHotOID = 
> OID: UCD-SNMP-MIB::memSwapError.0 DISMAN-EVENT-MIB::mteHotValue = INTEGER: 1 
> UCD-SNMP-MIB::memErrorName.0 = STRING: swap UCD-SNMP-MIB::memSwapErrorMsg.0 =
> STRING: Running out of swap space (0)
>
>
> I'm not sure where DISMAN-EVENT-MIB is pulling information about swap 
> (sysctl? kernel? userland?), but it's erroneous in this case.
>
>
> # swapctl  -l
> Device      1K-blocks     Used    Avail Capacity  Priority
> /dev/raid0a   2097024        0  2097024     0%    0
>
> In UCD-SNMP-MIB.txt, the following is defined:
>
> memMinimumSwap OBJECT-TYPE
>    SYNTAX      Integer32
>    MAX-ACCESS  read-only
>    STATUS      current
>    DESCRIPTION
>        "Minimum amount of free swap required to be free
>         or else memErrorSwap is set to 1 and an error string is
>         returned memSwapErrorMsg."
>    ::= { memory 12 }
>
>
> And that traces to net-snmp-5.2.1.2/agent/mibgroup/ucd-snmp/memory.h where
> #define MEMSWAPMINIMUM 12
>
> ...I'll look into how FreeBSD and OpenBSD accumulate this value differently. 
> It's burried in the source somewhere.
>
>
> l8*
> 	-lava
>
> x.25 - minix - bitnet - plan9 - 110 bps - ASR 33 - base8
>
>
> -------------------------------------------------------
> 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-users mailing list
> [email protected]
> Please see the following page to unsubscribe or change other options:
> https://lists.sourceforge.net/lists/listinfo/net-snmp-users
>

l8*
 	-lava

x.25 - minix - bitnet - plan9 - 110 bps - ASR 33 - base8


-------------------------------------------------------
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-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.