That question is actually dependent on one specific thing - your implementation. You can use Java to try to do an RPC, though I haven't looked for this online - I'm pretty sure you can Google search for it, i'd be surprised if there wasn't something out there for it. You would have to enable RPC on the remote machine, though. You can write a client-server interaction where you have a small java agent sitting on the remote machine to get that info and send it back (you would have to be able to install the agent on the machine). You could use SNMP (once again, you'd have to google search for what libraries Java has for this).
I'm sure there are other ways to do this, but the main thing is which one seems easiest and most simple to understand to you.