简体   繁体   English

如何使用Netapp ONTAP8.1 API和Java获取系统信息?

[英]How to get system information using Netapp ONTAP8.1 API and java?

I am novice to NETAPP API. 我是NETAPP API的新手。

I am using Netapp ONTAP API 8.1 and Java. 我正在使用Netapp ONTAP API 8.1和Java。 I want to get system information such as systemname,serial number, vendorID,Total processors etc. 我想获取系统信息,例如系统名称,序列号,供应商ID,处理器总数等。

I am able to get system version using following code 我可以使用以下代码获取系统版本

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");
}

How do I able to get above mentioned system information using ONTAP API and Java? 如何使用ONTAP API和Java获得上述系统信息? Any workaround or help will be appreciated. 任何解决方法或帮助将不胜感激。

Unlike you used API for system version, there is a API for system information named as SystemGetInfoRequest. 与您使用的API用于系统版本不同,有一个用于系统信息的API称为SystemGetInfoRequest。 You can use it as following 您可以按以下方式使用它

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();
}

You can extract all system related information like this. 您可以像这样提取所有与系统相关的信息。 Hope this will work for you. 希望这对您有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM