[英]How to get Disks, Aggregate and LUNs information of storage system using netapp ontap api (8.1) and java?
[英]How to get system information using Netapp ONTAP8.1 API and java?
我是NETAPP API的新手。
我正在使用Netapp ONTAP API 8.1和Java。 我想獲取系統信息,例如系統名稱,序列號,供應商ID,處理器總數等。
我可以使用以下代碼獲取系統版本
try {
ApiRunner apirunner = new ApiRunner(ApiTarget.builder()
.withHost(host)
.withUserName(username)
.withPassword(password)
.withTargetType(TargetType.FILER)
.useProtocol(protocol)
.build()
);
SystemGetVersionRequest vq = new SystemGetVersionRequest();
System.out.println("version request"+vq);
SystemGetVersionResponse vr = apirunner.run(vq);
storageout.put("version", vr.getVersion());
}
catch (Exception e){
e.printStackTrace();
System.out.println("Error in getting info");
}
如何使用ONTAP API和Java獲得上述系統信息? 任何解決方法或幫助將不勝感激。
與您使用的API用於系統版本不同,有一個用於系統信息的API稱為SystemGetInfoRequest。 您可以按以下方式使用它
SystemGetInfoRequest sq = new SystemGetInfoRequest();
SystemGetInfoResponse sr = apirunner.run(sq);
try {
System.out.println("Systemname"+ sr.getSystemInfo().getSystemName());
System.out.println("SerialNumber"+sr.getSystemInfo().getSystemSerialNumber());
System.out.println("MemorySize"+ sr.getSystemInfo().getMemorySize());
System.out.println("VendorID"+ sr.getSystemInfo().getVendorId());
System.out.println("TotalProcessors"+ sr.getSystemInfo().getNumberOfProcessors());
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
您可以像這樣提取所有與系統相關的信息。 希望這對您有用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.