>Here's the output you requested:

>swap -s:
>total: 2653088k bytes allocated + 37416k reserved = 2690504k used, 2899264k
available

>UCD-SNMP-MIB::memTotalSwap.0 = INTEGER: 4003952
>UCD-SNMP-MIB::memAvailSwap.0 = INTEGER: 1528520
>UCD-SNMP-MIB::memMinimumSwap.0 = INTEGER: 16000
>HOST-RESOURCES-MIB::hrStorageDescr.3 = STRING: Swap Space
>HOST-RESOURCES-MIB::hrStorageAllocationUnits.3 = INTEGER: 8192 Bytes
>HOST-RESOURCES-MIB::hrStorageSize.3 = INTEGER: 698726

>So that I understand it, the Host-Resources MIB contains the incorrect
values. So, if an NMS (like SolarWinds), >it is going to get values that do
not what is really on the system.

>I am still confused as to why the numbers do not match. Assuming the values
that swap -s are correct, then there is 2690504k +  2899264k  = 5592344k
(5726560256 bytes) of swap. However, from the Host resources MIB,  698726 *
8192 = 5723963392 bytes, which does match. They are close, so I could be
tempted to simply say there is 5.7 Gb on this system

>What units is memTotalSwap? I am now totally consfused as to where this
value is coming from.

To understand what's going on, it helps to look at the code.  For starters
you can pretty much ignore memMinimumSwap - I don't think it's properly
implemented (and i didn't write it).

Here's the data structures for sysctl (from sys/swap.h)

################################################333

#define SC_ADD          1       /* add a specified resource for swapping */
#define SC_LIST         2       /* list all the swapping resources */
#define SC_REMOVE       3       /* remove the specified swapping resource */
#define SC_GETNSWP      4       /* get number of swap resources configured
*/
#define SC_AINFO        5       /* get anonymous memory resource information
*/

typedef struct swapres {
        char    *sr_name;       /* pathname of the resource specified */
        off_t   sr_start;       /* starting offset of the swapping resource
*/
        off_t   sr_length;      /* length of the swap area */
} swapres_t;

typedef struct swapent {
        char    *ste_path;      /* get the name of the swap file */
        off_t   ste_start;      /* starting block for swapping */
        off_t   ste_length;     /* length of swap area */
        long    ste_pages;      /* numbers of pages for swapping */
        long    ste_free;       /* numbers of ste_pages free */
        int     ste_flags;      /* see below */
} swapent_t;

typedef struct swaptable {
        int     swt_n;                  /* number of swapents following */
        struct  swapent swt_ent[1];     /* array of swt_n swapents */
} swaptbl_t;

#####################################################3

Here's some excerpts from agent/mibgroup/ucd-snmp/memory_solaris2.c 

##############################
#include "util_funcs.h"         /* utility function declarations */
#include "memory.h"             /* the module-specific header */
#include "memory_solaris2.h"    /* the module-specific header */
#include <kstat.h>
#include <sys/stat.h>
#include <sys/swap.h>

/****************************
 * Kstat specific variables *
 ****************************/
extern kstat_ctl_t *kstat_fd;   /* defined in kernel_sunos5.c */
kstat_t        *ksp1, *ksp2;
kstat_named_t  *kn, *kn2;

...

    case MEMTOTALSWAP:
        long_ret = getTotalSwap() * (getpagesize() / 1024);
        return ((u_char *) (&long_ret));
    case MEMAVAILSWAP:
        long_ret = getFreeSwap() * (getpagesize() / 1024);
        return ((u_char *) (&long_ret));
    case MEMSWAPMINIMUM:
        long_ret = minimumswap;
        return ((u_char *) (&long_ret));
    case MEMTOTALREAL:
#ifdef _SC_PHYS_PAGES
        long_ret = sysconf(_SC_PHYS_PAGES) * (getpagesize()/1024);
#else
        ksp1 = kstat_lookup(kstat_fd, "unix", 0, "system_pages");
        kstat_read(kstat_fd, ksp1, 0);
        kn = kstat_data_lookup(ksp1, "physmem");

        long_ret = kn->value.ul * (getpagesize() / 1024);
#endif
        return ((u_char *) (&long_ret));
    case MEMAVAILREAL:
#ifdef _SC_AVPHYS_PAGES
        long_ret = sysconf(_SC_AVPHYS_PAGES) * (getpagesize()/1024);
#else
        long_ret =
            (getTotalFree() - getFreeSwap()) * (getpagesize() / 1024);
#endif
        return ((u_char *) (&long_ret));
    case MEMTOTALFREE:
        long_ret = getTotalFree() * (getpagesize() / 1024);
        return ((u_char *) (&long_ret));

################

or briefly:

MEMTOTALSWAP comes from getTotalSwap() which cobbles it up from ste_pages
MEMAVAILSWAP comes from getFreeSwap() which cobbles it up from ste_free
MEMTOTALREAL comes from kstat
MEMTOTALFREE comes from getTotalFree() which gets it *sigh* from SC_AINFO
which I still think is a Bad Thing

vs. HOST-RESOURCES-MIB which appears to try to get everything from either
kstat or SC_AINFO.


I'm hoping to have my development server built over the weekend and I'll
compile up all the version trees of net-snmp, run them on Solaris 2.6, 2.7,
8, 9, 10 and Open Solaris and compare numbers.





This communication is intended for the use of the recipient to which it is
addressed, and may contain confidential, personal and or privileged
information. Please contact us immediately if you are not the intended
recipient of this communication, and do not copy, distribute, or take action
relying on it. Any communication received in error, or subsequent reply,
should be deleted or destroyed.



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
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

Reply via email to