如何使用 java 程序或 JMX 获取远程计算机的系统总 CPU 使用百分比
您好,在我的系统中将有一个主节点和 n 个从节点。主节点将传入请求转发到其从节点之一。我想找到其所有从节点的CPU使用率,以便我可以将请求转发到适当的节点。我发现了类似的问题,他们回答使用 getCpuUsage() 来查找。但是当我使用它时出现错误,例如找不到符号:getCpuUsage()。任何人都可以建议我如何找到(从属节点及其 IP 地址的)CPU 使用率百分比。提前致谢。
Hi in my system there will be a master node and n number of slave nodes. The master node will forward the incoming request to one of its slave nodes. I want to find the CPU usage of all its slave node, So that i can forward the request to the appropriate node. I have found similar question like this in that they answered to use getCpuUsage() to find. But when i use it am getting an error like cannot find symbol: getCpuUsage(). Can any one please suggest me how can i find the cpu usage percentage (of the slave node with their i.p address). Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用这段代码片段来计算 CPU 负载,并使用从 jconsole 中提取的 java 1.5 来计算:
I used this snipped of code to compute cpu load with java 1.5 extracted from jconsole: