ManageEngine Forums
is there any way through SNMP API or through any system command to find CPU utilization and Mem utilization of a Windows system. i've tried HOST-RESOURCE-MIB, but cudn't find any OID for the mentioned utilizations. Plz help.

Replies (35)

Hai,

You can find the CPU utilization of windows system by querying the oid .1.3.6.1.2.1.25.3.3.1.2 (.iso.org.dod.internet.mgmt.mib-2.host.hrDevice.hrProcessorTable.hrProcessorEntry.hrProcessorLoad) in HOST-RESOURCES-MIB.
There is no direct OID for getting memory utilization ,However we can obtain the same by querying the OID 1.3.6.1.2.1.25.5.1.1.2 from the same MIB which fetches the individual memory usage of all the process. The sum of these memory usages by the processes divided by the total memory available for processes which can be obtained from the OID .1.3.6.1.2.1.25.2.2,will get you the memory utilization .

Thanks,
Pravin.K.C
Hai,

You can find the CPU utilization of windows system by querying the oid .1.3.6.1.2.1.25.3.3.1.2 (.iso.org.dod.internet.mgmt.mib-2.host.hrDevice.hrProcessorTable.hrProcessorEntry.hrProcessorLoad) in HOST-RESOURCES-MIB.
There is no direct OID for getting memory utilization ,However we can obtain the same by querying the OID 1.3.6.1.2.1.25.5.1.1.2 from the same MIB which fetches the individual memory usage of all the process. The sum of these memory usages by the processes divided by the total memory available for processes which can be obtained from the OID .1.3.6.1.2.1.25.2.2,will get you the memory utilization .

Thanks,
Pravin.K.C
when i query these oid's on some systems, no result is returned though on systems it do work... wat to do?? will loading some mib will work out? if yes then plz let me know how to load mibs...

regards,sarah
Hai,
Make sure that HOST-RESOURCE-MIB is implemented in your snmp agent . If not, refer the agent documentation as such to know how to load the MIB in your agent.
From the manager stand point you need to use "-m" option for loading MIB's.
For example: java snmpget [-m MIB_files] host OID ,will load MIB file that is mentioned and will perform "snmpget" in the corresponding OID.

Pravin.K.C
Thanks alot Pravin for ur help. just one last thing. i know that we have to use -m option to load the mibs that we need but do u have any idea where to place these mibs that we want to use. i mean in which directory our mibs shud be places.i have used NetSNMP and have tried to place mib files in its mib folder and tried to load them but that didn't work. do u know anyother place (directory) where mib files can be placed and then loaded?

regards,
Hai,

In AdventNet SnmpApi, you can place your MIB file in any directory as you wish, but make sure that you use "-m" option and give the path of the file to load the MIB from the specified directory . Trying to load the MIB without "-m" option will lead to the search for the MIB file from the current directory.
For NetSnmp, I ll recommend you to refer their documentation for knowing more details about your queries.

Thanks,
Pravin.K.C
Sarah :

I doubt that you are using net-snmp to retrieve the managed information. If this is the case, go through the below URL which tells you how to load/use mib in net-snmp.
http://www.net-snmp.org/tutorial/tutorial-5/commands/mib-options.html

Bye

Gilli
The OID you mentionned before seems to be dynamic.
Indeed my graphes worked 1 week with OID .130 .131 .132 .133 (bi proc HT so 4 CPU) but now the working OID are .117 .118 .119 .120 !
So it's quite a problem since it has to work for years...
I tried to resolve the problem with specific OID, I mean, my servers are DELL powerEdge 2650/2850 and there are OID for DELL (you can find for cisco too or others).
But I don't find the CPU load OID...(I found RAM, space on hard disk, temperature...)

So is there a way to use your OID and make them static, or do you know the OID for DELL's CPU load ???

Can you reply to stekut@hotmail.com if you have the answer ?

Thx all.
Hai,

CPU utilisation of the server is calculated by summing the utilisation of each CPU and dividing by the number of CPU's. Since the CPU load of individual CPU keeps changing all the time , the CPU utilisation of server will always be dyanmic. Hence,I suppose there can't be any possibility of getting static OID for CPU load

Regards,
Pravin.K.C
quite annoying since i have to make graphes that refresh every 5 minutes...
so i suppose i'll make a daemon that check the OID of my config file et update it if necessary.

thx for helping me.
can some one please tell me what is the OID to find number of CPU's and the cpu usage for the particular CPU.
OID .1.3.6.1.2.1.25.3.3.1.2 ( hrProcessorLoad ) of HOST-RESOURCES-MIB can be used to query the CPU usage of particular device.
hi can anyone tell me how to get total and used virtual memory and pagfile using Public MIB.
Hi,

You can use hrMemorySize(.1.3.6.1.2.1.25.2.2) from HOST-RESOURCES-MIB to find the total memory.
memTotalSwap(.1.3.6.1.4.1.2021.4.3) and memAvailSwap(.1.3.6.1.4.1.2021.4.4) of UCD-SNMP-MIB can be used for obtaining total and available virtual memory respectively, using which used virtual memory can be obtained.

Regards,
Pravin.K.C
first ,you should understand the agent on managed devices,such as cisco or computers,the agent is key in NMS. a agent does not support all mibs default,but if the agent supports MIB extend,you can add mibs you required,and then you can get the OID's result.
my questions are :

1.how can i get the MIB file extend?
for example,HOST-RESOURCES-MIB
where can i download it?

2.can i load the MIBs extend to the agent of devices managed just on manager side?can i do that on the center monitor?

3.and i wanna get CPU & memory of the devices ,but the OS may be unix,linux or windows,is the HOST-RESOURCES-MIB enough ?need other MIBs?

thanks
my questions are :

1.how can i get the MIB file extend?
for example,HOST-RESOURCES-MIB
where can i download it?

2.can i load the MIBs extend to the agent of devices managed just on manager side?can i do that on the center monitor?

3.and i wanna get CPU & memory of the devices ,but the OS may be unix,linux or windows,is the HOST-RESOURCES-MIB enough ?need other MIBs?

thanks
my questions are :

1.how can i get the MIB file extend?
for example,HOST-RESOURCES-MIB
where can i download it?

2.can i load the MIBs extend to the agent of devices managed just on manager side?can i do that on the center monitor?

3.and i wanna get CPU & memory of the devices ,but the OS may be unix,linux or windows,is the HOST-RESOURCES-MIB enough ?need other MIBs?

thanks
Hai

1.The HOST-RESOURCES-MIB is available in the following directory
<Product-Home>/mibs.

2. From your second query I get that, you are interested in knowing as whether or not to load the mibs while querying the OIDs. Please correct me if my understanding is wrong.
If the mib is loaded then the OID is shown in the resolved format (.iso.org.dod...).If not , the OID value will be in numerical format(.1.3.6.1....).

3. For Linux OS

You can find the CPU utilization of Linux system by querying the oid
.1.3.6.1.4.1.2021.11.9
(.iso.org.dod.internet.private.enterprises.ucdavis.systemStats.ssCpuUser.0) in UCD-SNMP-MIB

There is no direct OID for getting memory utilization .

Querying the OID .1.3.6.1.2.1.25.2.3.1.6 (hrStorageUsed) in HOST-RESOURCES- MIB which fetches the storage allocations for different type of memory. Querying OID .1.3.6.1.2.1.25.2.3.1.4 from the same mib which will give you the storage allocation units for the same.


Using the simple formula, you can findout the memory utilization, and this is based on the RAM memory storage only. The RAM memory index can be obtained by quering OID .1.3.6.1.2.1.25.2.3.1.2 (hrStorageType).

Memory Utilization = StorageUsed * StorageAllocatioUnits;

For Example,

hrStorageType.4 : .iso.org.in. . . .storageRam
hrStorageAllocationUnits.4 : 65536
hrStorageUsed.4 : 6481

MemoryUtilization = 65536*6481.

Hope this helps

Regards
R.Ravikumar
How do you get the OIDs for Windows 2003?
to Ravikumar :
yes,i wanna load some mib to the remote devices monitored on my center machine. it is similar to your meaning that loading the mibs while querying the OIDs, but how to load the mibs while querying the OIDs? can you give me an example ?

but to the memory's OIDS you explained,I think these OIDS are for DISK SPACE.not for memory ???are you sure???

and i query the cpu oid:1.3.6.1.2.1.25.3.3.1.2 in DOS . the response is :
Index = 3:
1.3.6.1.2.1.25.3.3.1.2.3 = 12

the result is changed .sometimes it is

Index = 3:
1.3.6.1.2.1.25.3.3.1.2.3 = 3

etc.

of course ,the mib is not HOST-RESOURCES-MIB,but hostmib.mib of windows(xp). their contents are almost the same.
what does it means?1.3.6.1.2.1.25.3.3.1.2.3.

anyway thanks.

regards.
Thank you!

I want to know if i can load mib to the remote device monitored on my center machine. it is similar to your meaning .But how

can I load the mibs while querying the OIDs?Can you show me an example ?

The OIDs that you explained about memory,are they correct???I think they are used to fetching disk space! But I am a beginner on SNMP,so i am not sure that.

Once more,in windows(2000,xp),the OID of cpu is 1.3.6.1.2.1.25.3.3.1.2 .
But the reponse is dynamic.The MIB is hostmib.mib of windows. it is similar to HOST-RESOURCES-MIB.why and what does it mean?

the response is :

Index = 3:
1.3.6.1.2.1.25.3.3.1.2.3 = 6

sometimes it is

Index = 3:
1.3.6.1.2.1.25.3.3.1.2.3 = 12

etc.

regards

Hai

1.The HOST-RESOURCES-MIB is available in the following directory
<Product-Home>/mibs.

2. From your second query I get that, you are interested in knowing as whether or not to load the mibs while querying the OIDs. Please correct me if my understanding is wrong.
If the mib is loaded then the OID is shown in the resolved format (.iso.org.dod...).If not , the OID value will be in numerical format(.1.3.6.1....).

3. For Linux OS

You can find the CPU utilization of Linux system by querying the oid
.1.3.6.1.4.1.2021.11.9
(.iso.org.dod.internet.private.enterprises.ucdavis.systemStats.ssCpuUser.0) in UCD-SNMP-MIB

There is no direct OID for getting memory utilization .

Querying the OID .1.3.6.1.2.1.25.2.3.1.6 (hrStorageUsed) in HOST-RESOURCES- MIB which fetches the storage allocations for different type of memory. Querying OID .1.3.6.1.2.1.25.2.3.1.4 from the same mib which will give you the storage allocation units for the same.


Using the simple formula, you can findout the memory utilization, and this is based on the RAM memory storage only. The RAM memory index can be obtained by quering OID .1.3.6.1.2.1.25.2.3.1.2 (hrStorageType).

Memory Utilization = StorageUsed * StorageAllocatioUnits;

For Example,

hrStorageType.4 : .iso.org.in. . . .storageRam
hrStorageAllocationUnits.4 : 65536
hrStorageUsed.4 : 6481

MemoryUtilization = 65536*6481.

Hope this helps

Regards
R.Ravikumar
faint !i think i don't post it for the 1st time.
repeat . sorry.
Hai,

You can load the MIB files using loadMibModules() method of MibOperations class for querying OID. To my knowledge, the procedure which I have explained for memory utilization is correct. CPU utilization is dynamic, this is already discussed in the same thread.

Refer to the link below to know more about loadMibModules() method.

http://snmp.adventnet.com/help/snmpapi/snmpv3/javadocs/com/adventnet/snmp/mibs/MibOperations.html

Regards
R.Ravikumar
thanks a lot .

i anatomize the info in this thread.
Hi all,

I'm glad i found this topic, as it is exactly my concerns:
I'm using host-ressources-mib to get memory and utilization, and i've tried 2 methods (which have been described here):
1rst method: (hrstorageused.i / hrstoragesize.i) *100
(where i is the index of my phisical memory, for info you have to find the index coresponding to the hrstoragetype which is hrstorageram. We don't use hrStorageallocationunit as it is a ratio)

2nd method:I sum up the hsSWrunperfmem for all processes, put it in kbytes, then divide it by (hrstoragesize * hrallocationunit)

The thing is, that the two ratios are not the same. More precisely thte total memory used by the processes is less than the (hrstorageused * hrstorageallocationunit)

So, I'd like to know, which one is closer to the truth? (or what the first method doesn't take into account)

regards,

Gerard M.
Hi,
If your OS is Linux,

(hrstorageused.i / hrstoragesize.i) *100


If it is Windows,
sum up the hsSWrunperfmem for all processes divide it by hrMemorySize

which gives the memory utilization.

Hope this is clear

Regards
R.Ravikumar
is there any way through SNMP API or through any system command to find CPU utilization and Mem utilization of a Windows system. i've tried HOST-RESOURCE-MIB, but cudn't find any OID for the mentioned utilizations. Plz help.
Hi,

Refer the same thread. The calculation of CPU/memory utilization for windows and linux OS are discussed already. If you have any clarifications please send us the same.

Regards
GuruJi...
is there any way through SNMP API or through any system command to find CPU utilization and Mem utilization of a Windows system. i've tried HOST-RESOURCE-MIB, but cudn't find any OID for the mentioned utilizations. Plz help.
Dear Guest,

First dont post your query as guest, please login and post.

You can get all fundas in the same thread , which really will help you to identify the information you required. If not post what you are looking for in detail that will help the community to help you better.

JF
Is there a way to retrieve the total megahertz of the system, or on a per processor basis?

/m
Hi krispy,

From my knowledge, if you are querying the OID .1.3.6.1.2.1.25.5.1.1.1 ( hrSWRunPerfCPU) from the HOST-RESOURCE-MIB which will gives the number of centi-seconds of the total system's CPU resources consumed by each process. Once you can get the centi-seconds converted into seconds. The reciprocal values of the seconds which will gives the speed of the process in hertz.

Hertz=1/Time.

For example ,

Sent get request to localhost : 161
hrSWRunPerfCPU.1:-->28954575
hrSWRunPerfCPU.4:-->48754
hrSWRunPerfCPU.600:-->6
hrSWRunPerfCPU.672:-->49078
hrSWRunPerfCPU.696:-->1984
hrSWRunPerfCPU.756:-->1740
hrSWRunPerfCPU.768:-->3064
hrSWRunPerfCPU.964:-->104
hrSWRunPerfCPU.1032:-->271

speed of the Process1 (hrSWRunPerfCPU.1) :
seconds= 28954575/100 = 289545.75
hertz = 3.45 MHz.

The same way you can calculate the speed of all the process which are running.

Hope this helps

Regards
R.Ravikumar
Hi,

I have couple of following questions

1) Is it really necessary to load or copy anything(like mib file) other then SNMP service on remote machine to get cpu,  
    memory and disk utilization.
2) How we can find the individual cpu usage if we have multiple cpu using the mentioned process calculations.
3) how can we cross check the given usage is match with exact usage of cpu ?
4) My last question is how to find disk utilization ?


Thanks in advance
Deepen


Hi Deepan,

Please find our response for your queries.

1) Is it really necessary to load or copy anything(like mib file) other then SNMP service on remote machine to get cpu,  
    memory and disk utilization.

Yes. SNMP service will load/contains the specified MIB (HOST-RESOURCE-MIB) and will be running on remote machine.

2) How we can find the individual cpu usage if we have multiple cpu using the mentioned process calculations.

  Please refer the below links for cpu usage and disk utilization calculation.
http://forums.manageengine.com/topic/obtaining-hard-disk,-cpu,-ram-related-info-using-snmp
http://forums.manageengine.com/topic/hard-disk-calculation-for-host-resources-mib

you can  get the cpu details separately and do the calculation using previously mentioned procedure.

3) how can we cross check the given usage is match with exact usage of cpu ?
you can cross check the cpu usage using taskmanager menu from the taskbar  .
Right click the taskbar and select the TaskManager which will displays the cpu usage.

4) My last question is how to find disk utilization ?

Please refer the above link which is present in the second answer.


Regards,
K.Prathika