Java API
HSM Dinamo
Loading...
Looking for...
No entries found
GetHSMSystemInfo.java

Example of retrieving information from HSM counters.

See Note on examples.
package doxy.examples;
import com.dinamonetworks.Dinamo;
import com.dinamonetworks.HSMAllInfo;
import br.com.trueaccess.TacException;
import br.com.trueaccess.TacNDJavaLib;
public class GetHSMSystemInfo {
public static void main(String[] args) throws TacException {
/*
* Recupera informações de sistema do HSM.
*
* */
Dinamo opUserSession = new Dinamo();
String ip = "127.0.0.1";
String user = "master"; // O usuário precisa ser operador/master ou ter as permissões necessárias
String password = "12345678";
opUserSession.openSession(ip, user, password, TacNDJavaLib.DEFAULT_PORT, false, false, true);
HSMAllInfo allInfo = opUserSession.getHSMInfo();
System.out.println("\nCounter info:");
System.out.println("Users count: " + allInfo.getCounterInfo().getUsers());
System.out.println("Objects count: " + allInfo.getCounterInfo().getObjects());
System.out.println("Base file size: " + allInfo.getCounterInfo().getSlbeFileSize());
System.out.println("Tasks count: " + allInfo.getCounterInfo().getTasks());
System.out.println("VM size: " + allInfo.getCounterInfo().getVmSize());
System.out.println("\nStatus info:");
System.out.println("Sessions count: " + allInfo.getStatusInfo().getSessionCount());
System.out.println("CPU: " + allInfo.getStatusInfo().getCpuUsage() + "%");
System.out.println("Memory: " + allInfo.getStatusInfo().getMemUsage() + "%");
System.out.println("\nDisk info:");
System.out.println("Block size: " + allInfo.getDiskInfo().getBlockSize());
System.out.println("Total blocks: " + allInfo.getDiskInfo().getTotalBlocks());
System.out.println("Free blocks: " + allInfo.getDiskInfo().getFreeBlocks());
System.out.println("\nHSM info:");
System.out.println("HSM firmware version: " + opUserSession.getFirmwareVersion());
System.out.println("HSM model: " + opUserSession.getModel());
System.out.println("HSM serial number: " + opUserSession.getSerialNumber());
opUserSession.closeSession();
}
}