当前位置:编程学习 > JAVA >>

求IPMI java实例

同志们好, 想求Ipmi 的java实例
比如, 获取服务器主板信息, 获取服务器风扇的温度等信息
网上资料很少, 开源的代码实例也有限
希望做过类似的帮忙一下, 谢谢大家
如下是我自己的一段实例:

public static void testPower() {
// Create the connector, specify port that will be used to communicate
// with the remote host. The UDP layer starts listening at this port, so
// no 2 connectors can work at the same time on the same port.
IpmiConnector connector = null;
ConnectionHandle handle = null;
try {
connector = new IpmiConnector(6666);
System.out.println("Connector created");

// Create the connection and get the handle, specifiy IP address of the
// remote host. The connection is being registered in ConnectionManager,
// the handle will be needed to identify it among other connections
// (target IP address isn't enough, since we can handle multiple
// connections to the same host)
handle = connector.createConnection(InetAddress
.getByName("172.16.103.11"));
System.out.println("Connection created");

// Get available cipher suites list via getAvailableCipherSuites and
// pick one of them that will be used further in the session.
CipherSuite cs = connector.getAvailableCipherSuites(handle).get(3);
System.out.println("Cipher suite picked");

// Provide chosen cipher suite and privilege level to the remote host.
// From now on, your connection handle will contain these information.
connector.getChannelAuthenticationCapabilities(handle, cs,
PrivilegeLevel.User);
System.out.println("Channel authentication capabilities receivied");

// Start the session, provide username and password, and optionally the
// BMC key (only if the remote host has two-key authentication enabled,
// otherwise this parameter should be null)
connector.openSession(handle, "admin", "password", null);
System.out.println("Session open");

// Send some message and read the response
GetChassisStatusResponseData response = (GetChassisStatusResponseData) connector
.sendMessage(handle, new GetChassisStatus(IpmiVersion.V20, cs, AuthenticationType.RMCPPlus));

System.out.println("Received answer");
System.out.println("System power state is "
+ (response.isPowerOn() ? "up" : "down"));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
// Close the session
connector.closeSession(handle);
System.out.println("Session closed");

// Close connection manager and release the listener port.
connector.tearDown();
System.out.println("Connection manager closed");
} catch (Exception e) {
e.printStackTrace();
}
}

}
--------------------编程问答-------------------- 没做过,友情帮顶 --------------------编程问答-------------------- 可以参照这个地址http://www.veraxsystems.com/en/products/ipmilib
有个开源的vxIPMI.jar包。希望对你有用。 --------------------编程问答-------------------- 楼主对verax的IPMI了解得很透,求获取传感器信息的代码 --------------------编程问答-------------------- 本人正在以verax的IPMI java包做开发,怎么主动获取sensor id /sensor number呢?求私聊q 583775108
补充:Java ,  Java SE
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,