1

We have few Esxi 5.0 server (with 64GB memory in each srvr) & snmp is enabled. As per my research there is no oid for used/available memory OID, it have only hrMemorySize.0. Therefore in order to calculate used memory, I am trying to get memory used by all processes by using bash script which does the math too.

USEDMEM=`snmpwalk -v2c -c PUBLIC -m "/cfg/mibs/HOST-RESOURCES-MIB" $HOST |grep hrSWRunPerfMem. | awk '{print $4}' |  awk '{ sum += $1 } END { print sum }'`
RAW_MEM_BYTES=`echo "scale=3; $USEDMEM*1024" |bc -l`
RAW_MEM_GB=`echo "scale=3; $RAW_MEM_BYTES/1073741824" |bc -l`
echo $USEDMEM Kbits
echo $RAW_MEM_BYTES Bytes
echo $RAW_MEM_GB GB

Resulting ...

66858364 Kbits
68462964736 Bytes
63.761 GB

But on ESXI client I can see only 60 GB used. Same happening if I try to collect used memory of windows server using above script. It's probably some calculation forumla mistake? I have tried to used * 1000 in calculation but still in-correct results. Its happening with ESXI and Windows Server too If I try to calculate used memory by hrSWRunPerfMem. For windows I have many other ways to get used memory as there are standard snmp oids for this purpose. but for this esxi (5) server, I am clueless :(

How can I get accurate results?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.