This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes JMX - How to find system Load of remote machine in Java? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "JMX - How to find system Load of remote machine in Java?" Watch "JMX - How to find system Load of remote machine in Java?" New topic
Author

JMX - How to find system Load of remote machine in Java?

Azrael Noor
Ranch Hand

Joined: Jul 29, 2010
Posts: 382
Hi

I am making a client which fetch load from remote machine. After searches, i found to call getSystemLoadAverage(), but i am unable to connect to remote machine.

Following is snippet in use:



I am using hit and trial to connecting remote system by finding default port found on WWW,
i have found and used following ports:
1099, 8686,9010,9001

but i am unable to connect with any and getting following exception.



Could anyone help in finding default JMX port which could be used to connect that server?
or is there any issue in above snippet?


Regards
Azrael Noor
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42028
    
  64
How is the remote JVM started? Several JVM properties need to be set in order to enable JMX connections. I use the following set for a local JVM:

For a remote connection you also need to ensure that no firewall between your machine and the remote machine blocks anything, and you should set up and use authentication.


Ping & DNS - my free Android networking tools app
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42028
    
  64
An interesting alternative for accessing JMX remotely is to run Jolokia on the JVM, which exposes JMX via HTTP - which is easier to work with than the JMX/RMI/JRMP. Java client code is shown at http://www.jolokia.org/client/java.html.
E Armitage
Rancher

Joined: Mar 17, 2012
Posts: 892
    
    9
Don't look for a default port. Different servers use different values as defaults. Ask the guys that started up the server what the settings should be. Generally server admins won't (should not) just allow anyone JMX access to their servers for security reasons.
Azrael Noor
Ranch Hand

Joined: Jul 29, 2010
Posts: 382
Ulf Dittmer wrote:An interesting alternative for accessing JMX remotely is to run Jolokia on the JVM, which exposes JMX via HTTP - which is easier to work with than the JMX/RMI/JRMP. Java client code is shown at http://www.jolokia.org/client/java.html.


Hi Ulf, Thanks for quick response.

I think remote JVM start here means System Startup?
or some application server startup like Glassfish

we are trying to connect to System not Application server. I have admin rights with me, any suggestion what to check to see that?

Thanks

E Armitage
Rancher

Joined: Mar 17, 2012
Posts: 892
    
    9
What do you mean by System? JMX is for monitoring JVMs, so you need to start that JVM with settings that allow JMX monitoring from other JVMs.
 
GeeCON Prague 2014
 
subject: JMX - How to find system Load of remote machine in Java?