Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: how to monitor memory usage on freebsd systems

106 views
Skip to first unread message

Dave Shield

unread,
Aug 12, 2008, 5:21:34 AM8/12/08
to
2008/8/12 Chee Meng Gui <chee...@function.com>:
> So the hrStorageEntry.hrStorageUsed.1 is in kilobytes?

hrStorageUsed is reported in the units specified in hrStorageUnits.
So if hrStorageUnits.1 is 1024, then hrStorageUsed.1 is in Kb


> When I checked this result against the used memory output of sysctl {
> hw.physmem - ( ( vm.stats.vm.v_inactive_count + vm.stats.vm.v_cache_count +
> vm.stats.vm.v_free_count ) * hw.pagesize ) } , the two were not equal.

On FreeBSD with the latest (5.4.x) agent, "Physical memory" is
retrieved by running sysctl on HW_USERMEM. Most of the other
values are calculated by running sysctl on VM_METER

See 'agent/mibgroup/hardware/memory/memory_freebsd.c'
for the details.

Dave

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Net-snmp-users mailing list
Net-snm...@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Dave Shield

unread,
Aug 15, 2008, 4:26:33 AM8/15/08
to
2008/8/14 Chee Meng Gui <chee...@function.com>:
> Something is not right with net-snmp implementation for freebsd?

Rather than try to guess what might be happening,
could you please post the results of:

a) snmpwalk hrStorageTable
b) sysctl -a

That should give us something to work with.

Dave Shield

unread,
Aug 18, 2008, 4:37:15 AM8/18/08
to
2008/8/15 Chee Meng Gui <chee...@function.com>:
> As requested, attached here are the results of snmpwalk and sysctl -a.

Hmmm...

Well, the value for hrStorageSize.1 makes sense:

pa005: hw.physmem: 1063620608 / 4096 = 259673 = hrStorageSize.1
pa037: hw.physmem: 526729216 / 4096 = 128596 = hrStorageSize.1

Unfortunately, all of the other values are calculated using
figures from 'vm.vm_meter', which isn't part of the sysctl -a output.

Can you try retrieving these vm_meter values, and see how they
compare with the other memory-related figures?

Dave Shield

unread,
Aug 18, 2008, 2:23:32 PM8/18/08
to
2008/8/18 Chee Meng Gui <chee...@function.com>:
> The issue is hrStorageUsed does not make sense.
> It is much greater than the value calculated from sysctl -a.


As I said earlier:

>> ...... all of the other values are calculated using

Dave Shield

unread,
Aug 18, 2008, 6:24:40 PM8/18/08
to
2008/8/18 Chee Meng Gui <chee...@function.com>:
> How do I get retrieve the vm_meter values?


struct vmtotal total;
size_t total_size = sizeof(total);
int total_mib[] = { CTL_VM, VM_METER };

sysctl(total_mib, 2, &total, &total_size, NULL, 0);


Then you can print out the contents of the "struct vmtotal"

Dave Shield

unread,
Aug 22, 2008, 5:19:07 AM8/22/08
to
2008/8/19 Chee Meng Gui <chee...@function.com>:
> This is the struct vmtotal output
>
> vmtotal :
> run queue 1
> jobs in disk wait 4
> jobs in page wait 0
> jobs in sleeping in core 59
> swapped out runnable/short block jobs 0
> total virtual memory 610377642
> active virtual memory 44897
> total real memory 122578
> active real memory 16055
> shared virtual memory 9315
> active shared virtual memory 6527
> shared real memory 4214
> active shared real memory 2901
> free memory pages 8870

That's probably not a lot of use in isolation.
And comparing it to the snmpwalk output is
difficult, becuase the data will be sampled at
different times.

What you probably need to do is tweak your
test program so that it runs sysctl on *both*
VM_METER *and* the other structures that
you're interested in. You can then print out
the full contents of both structures, and compare
the values in a sensible manner.

Unfortunately I won't be around for the next
week or so, but I'll check in again after that
to see how you're getting on.

0 new messages