views:

931

answers:

5

As the question's title says, I want to get the system information (like OS name, version, etc.) of a remote system using Java. But before anyone answers this question, I just want to ask whether this is possible, if yes, then how?

One more catch is that this should work for both Unix-based and Windows-based systems. I tried searching the Internet, but drew a blank (almost).

EDIT: The Java app will be a desktop app, and it will have to credentials to be able to log onto the remote system, but there will be no HTTP/RMI that'll be used.

+2  A: 

You need to clarify what you mean by "remote system" in this case - as in how are you communicating with it> Are we talking some form of HTTP? RMI? Applet running in a browser?

Generally, however, the answer is "No, it's not possible".

ChssPly76
Its just using Java - a desktop app. There's no RMI/HTTP connection to that machine. But the program will have to credentials to access that remote machine.
Kirtan
+1  A: 

This is a common problem in monitoring a large site comprised of scores or hundreds of machines. There are open source solutions like Zenoss and Nagios. SNMP is a widely supported standard in this space too (and there are ways to connect them into a Java-based "dashboard").

Jim Ferrans
A: 

You either need help from the remote system (i.e. an application running there that announces the data - which web browsers do, but only to the servers they visit) or access to low-level network APIs that allow a technique called OS fingerprinting. However, Java's network APIs are not low-level enough for that.

Michael Borgwardt
Yes. I was thinking about that. We will DEFINITELY need some help from the remote system, so that it can pass on the information to our app.
Kirtan
+4  A: 

For Windows you should be able to access WMI on the remote machine (with some ugly JNI glue), for UNIX systems I don't know of a way (unless you somehow have shell access, then you can probably try logging in via SSH and do a uname -a or similar). It's going to be a lot of work in either case and Java is hardly the right tool for that.

Joey
JACOB is easier than JNI for this.
finnw
A: 

You either need help from the remote system (i.e. an application running there that announces the data - which web browsers do, but only to the servers they visit) or access to low-level network APIs that allow a technique called OS fingerprinting. However, Java's network APIs are not low-level enough for that.

asis