Question

I am novice to NETAPP API.

I am using Netapp ONTAP API 8.1 and Java. I want to get system information such as systemname,serial number, vendorID,Total processors etc.

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? Any workaround or help will be appreciated.

Was it helpful?

Solution

Unlike you used API for system version, there is a API for system information named as 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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top