Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Figure out memory usage using SNMP on Windows

Tags:

windows

snmp

oid

Currently i use the following to figure it out:

For total memory:

.1.3.6.1.2.1.25.2.2.0 

For used memory i walk the following oid (gives me usage of each process):

.1.3.6.1.2.1.25.5.1.1.2

and sum them all.

However, this is very inaccurate, because it shows much less usage than if i use WMI or the performance monitor.

Am i missing something? I do not want to use third party SNMP agents (like SNMP informant, which works correctly btw). I wanna figure it out using what's standard in windows.

like image 553
timeshift Avatar asked Feb 25 '11 17:02

timeshift


1 Answers

Try 1.3.6.1.2.1.25.2.3.1. I received the following results with Net-SNMP's snmpwalk utility from one of our Windows Server 2003 servers:

$ snmpwalk -v1 -cpublic 10.200.80.221 1.3.6.1.2.1.25.2.3.1.3
HOST-RESOURCES-MIB::hrStorageDescr.1 = STRING: C:\ Label:  Serial Number 38728140
HOST-RESOURCES-MIB::hrStorageDescr.2 = STRING: D:\
HOST-RESOURCES-MIB::hrStorageDescr.3 = STRING: O:\ Label:Data  Serial Number b618c4bc
HOST-RESOURCES-MIB::hrStorageDescr.4 = STRING: Q:\ Label:Quorum  Serial Number 4cbbcc74
HOST-RESOURCES-MIB::hrStorageDescr.5 = STRING: Virtual Memory
HOST-RESOURCES-MIB::hrStorageDescr.6 = STRING: Physical Memory

$ snmpwalk -v1 -cpublic 10.200.80.221 1.3.6.1.2.1.25.2.3.1.4
HOST-RESOURCES-MIB::hrStorageAllocationUnits.1 = INTEGER: 4096 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.2 = INTEGER: 0 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.3 = INTEGER: 4096 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.4 = INTEGER: 4096 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.5 = INTEGER: 65536 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.6 = INTEGER: 65536 Bytes

$ snmpwalk -v1 -cpublic 10.200.80.221 1.3.6.1.2.1.25.2.3.1.5
HOST-RESOURCES-MIB::hrStorageSize.1 = INTEGER: 17911195
HOST-RESOURCES-MIB::hrStorageSize.2 = INTEGER: 0
HOST-RESOURCES-MIB::hrStorageSize.3 = INTEGER: 66794245
HOST-RESOURCES-MIB::hrStorageSize.4 = INTEGER: 35836990
HOST-RESOURCES-MIB::hrStorageSize.5 = INTEGER: 128101
HOST-RESOURCES-MIB::hrStorageSize.6 = INTEGER: 98266

$ snmpwalk -v1 -cpublic 10.200.80.221 1.3.6.1.2.1.25.2.3.1.6
HOST-RESOURCES-MIB::hrStorageUsed.1 = INTEGER: 1365706
HOST-RESOURCES-MIB::hrStorageUsed.2 = INTEGER: 0
HOST-RESOURCES-MIB::hrStorageUsed.3 = INTEGER: 38290
HOST-RESOURCES-MIB::hrStorageUsed.4 = INTEGER: 17637
HOST-RESOURCES-MIB::hrStorageUsed.5 = INTEGER: 4819
HOST-RESOURCES-MIB::hrStorageUsed.6 = INTEGER: 6952

What is important here are the 5th and 6th rows of the tables. If you have fewer hard disks then you can find the values of virtual and physical memory in other rows.

like image 109
Bill Avatar answered Oct 06 '22 20:10

Bill