Java System Info

Problem this snippet solves:

This Java application illustrates how to query system information from a BIG-IP with Java.

This sample is the companion code for the "Getting Started With iControl And Java - Setting Up Eclipse" Tech Tip on DevCentral. It illustrates how to setup the iControl interfaces object and query system information from the BIG-IP with Java and iControl.

Code :

public class SystemInfo {
  public iControl.Interfaces m_interfaces = new iControl.Interfaces();

  public void usage()
  {
    System.out.println("Usage: SystemInfo hostname username password");
  }
  
  public void Run(String [] args) throws Exception
  {
    if ( args.length < 3 )
    {
      usage();
    }
    else
    {
      String host = args[0];
      String user = args[1];
      String pass = args[2];
      
      boolean bInit = m_interfaces.initialize(host, user, pass);
      if ( bInit )
      {
        getSystemInformation();
      }
    }
  }
  public void getSystemInformation() throws Exception
  {
    iControl.SystemSystemInformation sysInfo =
      m_interfaces.getSystemSystemInfo().get_system_information();
    
    System.out.println("======================================================");
    System.out.println(" System Information");
    System.out.println("------------------------------------------------------");
    System.out.println("System Name                     : " + sysInfo.getSystem_name());
    System.out.println("Host name                       : " + sysInfo.getHost_name());
    System.out.println("OS Release                      : " + sysInfo.getOs_release());
    System.out.println("OS Machine                      : " + sysInfo.getOs_machine());
    System.out.println("OS Version                      : " + sysInfo.getOs_version());
    System.out.println("Platform                        : " + sysInfo.getPlatform());
    System.out.println("Product Category                : " + sysInfo.getProduct_category());
    System.out.println("Chassis Serial                  : " + sysInfo.getChassis_serial());
    System.out.println("Switch Board Serial             : " + sysInfo.getSwitch_board_serial());
    System.out.println("Switch Board Part Revision      : " + sysInfo.getSwitch_board_part_revision());
    System.out.println("Host Board Serial               : " + sysInfo.getHost_board_serial());
    System.out.println("host Board Part Revision        : " + sysInfo.getHost_board_part_revision());
    System.out.println("Annunciator Board Serial        : " + sysInfo.getAnnunciator_board_serial());
    System.out.println("Annunciator Board Part Revision : " + sysInfo.getAnnunciator_board_part_revision());
  }
  
  /**
   * @param args
   */
  public static void main(String[] args) {
    try
    {
      SystemInfo sysInfo = new SystemInfo();
      sysInfo.Run(args);
    }
    catch(Exception ex)
    {
      ex.printStackTrace(System.out);
    }
  }
}
Published Mar 08, 2015
Version 1.0
  • Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/axis/client/Stub