• Post Reply Bookmark Topic Watch Topic
  • New Topic

How calculate CPU usage from remote Windows or Linux server?  RSS feed

 
Baranenko Nikolay
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I want to calculate CPU usage from remote Widnows or Lunix server.
Try to resolve this task on Java.
Can found next option



but this option resolve task on localhost. (((

May be you know how to use this option for remote host.

May be you know other option to resolve this task?

I will be glad to consider any varinty.
 
K. Tsang
Bartender
Posts: 3648
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you planning to connect to remote host?

Besides for linux anyway, there is the "top" or "mpstat" command to get cpu usage, among other commands.

Executing such command remotely should get the job done. Of course you need to parse the output and send it back.
 
Tim Moores
Saloon Keeper
Posts: 3835
80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the remote server runs a JVM, and it's feasible to open the required port, then using JMX would allow you to do most of this without any 3rd party library.

If there's a servlet container running, you can do without the custom ports by using the Jolokia web app.
 
Baranenko Nikolay
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
found option for linux

 
Henry Wong
author
Sheriff
Posts: 23282
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Baranenko Nikolay wrote:found option for linux


That code goes through ssh, which should work for a majority of Linux environments, as it does come installed by default. Windows on the other hand, will be an issue. You will need to install a version of ssh for it -- of which, there are a few options.

My issue with this is that this may be a security hole. You are using ssh which can be used for anything. You will need an account and password on the target machine. And also, you will need to hard wire the password into the client application. Someone can simply uncompile your code and have access to the target machine via the ssh account -- password and all.

Henry
 
Baranenko Nikolay
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Else not find option for REMOTE windows server....

Recommended to find solve depend solve with SNMP, BUT worked solve now else not find too.

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!