Harshit
Harshit

Reputation: 5157

Get remote systems CPU and memory information

I am looking for a way to ge remote systems CPU and memory information using java. Although it can be done using windows command which can be put in java program. Here are the commands.

wmic /node:HOSTNAME cpu get loadpercentage

This will give you the CPU load for a remote system.

wmic /node:HOSTNAME OS get FreePhysicalMemory

This will give you free memory for a remote system.

But, with these, I have to depend on the windows command when using these in java using Runtime.getRuntime().exec.

Is there any java native library present which can do this work ?

Thanks

Upvotes: 2

Views: 1451

Answers (1)

David ten Hove
David ten Hove

Reputation: 2826

No, there is no way Java can natively do this. If you want a pure Java solution you will have to run a Java application on the machines that you want to get the information from. From the central machine, a seperate Java application (or any other kind of client really) can connect to the Java applications on the indiviual machines.

The (probably unacceptable) downside of this is that you would have to install this Java application on all the client machines. At that point, you are probably better off using wmic.

Upvotes: 2

Related Questions