Forum Discussion

sk_85494's avatar
sk_85494
Icon for Nimbostratus rankNimbostratus
Jul 08, 2013

Java Monitor Example Code Or Documentation

Hello,

 

I am trying to code a utility which will create a Monitor on an F5 device, using iControl, and then change the attributes. Unfortunatelly I am having a problem understanding the documentation for the iControl API.

 

I believe I should do the following steps

 

  1. Get the monitor stub with the getLocalLbMonitor()
  2. Use the stub to create a Monitor with the method create_template()
  3. Use the stub to set the Monitor attributes with the method set_template_string_property()

I was wondering if anyone has any example Java source code which defines a Monitor on and F5 device? Or if there is any other documentation I could reference, that is Java specific, which would explain the process.

 

 

Thank you

 

 

Stefanos

 

 

 

2 Replies

  • That's exactly the process you'll want to go through. The libraries we supply are based on Apache Axis-J so you should be able to find plenty of resources on the web covering how to use that client binding. We've tried our best to mask out anything binding specific though and make it as easy as possible to make iControl calls with the libraries. The iControl.Interfaces class contains get accessors for all of the interfaces that returns the stub for that WSDL document's client bindings. You'll want to then make the individual method calls with that stub.

     

    Over the years we have put together a bunch of examples/tech tips, and resources for using iControl with Java. Check out the Java page in the iControl wiki at https://devcentral.f5.com/wiki/iControl.Java.ashx.

     

    I'm not sure if we have an example in there with the Monitor interfaces but there are others that should show you how to use the library.

     

    Hope this helps...

     

    -Joe

     

  •         LocalLBMonitorMonitorTemplate monitorDef = new LocalLBMonitorMonitorTemplate();
            monitorDef.setTemplate_name(monitorName);
            monitorDef.setTemplate_type(LocalLBMonitorTemplateType.TTYPE_HTTP);
            LocalLBMonitorCommonAttributes commonAttr = new LocalLBMonitorCommonAttributes();
            commonAttr.setInterval(5);
            commonAttr.setTimeout(16);
            commonAttr.setParent_template("/Common/http");
            LocalLBMonitorIPPort dest= new LocalLBMonitorIPPort();
            CommonIPPortDefinition cIp  = new CommonIPPortDefinition();
            cIp.setAddress(ipAddress);
            cIp.setPort(80);
            dest.setIpport(cIp);
            dest.setAddress_type(LocalLBAddressType.ATYPE_STAR_ADDRESS_STAR_PORT);
            commonAttr.setDest_ipport(dest);
            commonAttr.setIs_directly_usable(true);
            commonAttr.setIs_read_only(false);
            LocalLBMonitorMonitorTemplate[] monitorDefs ={ monitorDef };
            LocalLBMonitorCommonAttributes[] commonAttrs ={ commonAttr };
            interfaces.getLocalLBMonitor().create_template(monitorDefs, commonAttrs);