Forum Discussion

Jonathan_Scholi's avatar
Jonathan_Scholi
Icon for Cirrostratus rankCirrostratus
Aug 23, 2011

Add health monitor to pool using Java iControl

Are there any code examples of how to add a health monitor to a pool using a Java iControl?
  • John_Gruber_432's avatar
    John_Gruber_432
    Historic F5 Account
    Using the axis wsdl2java classes.. I use the jar file downloaded from labs section of dev central. This is a code snippet that creates a single monitor on a LocalLB::Pool.

     

     

    
    iControl.LocalLBPoolLocator
    node_locator = new iControl.LocalLBPoolLocator();
    iControl.LocalLBPoolBindingStub stub  = (iControl.LocalLBPoolBindingStub) node_locator.getLocalLBPoolPort([BIGIPURL]);
    String[] monitors = new String[1];
    monitors[0] = monitor_name;
    iControl.LocalLBMonitorRule rule = new iControl.LocalLBMonitorRule();
    rule.setQuorum(0L);
    rule.setType(iControl.LocalLBMonitorRuleType.MONITOR_RULE_TYPE_AND_LIST);
    rule.setMonitor_templates(monitors);
    iControl.LocalLBPoolMonitorAssociation[] monitor_associations = new iControl.LocalLBPoolMonitorAssociation[1];
    monitor_associations[0] = new
    iControl.LocalLBPoolMonitorAssociation();
    monitor_associations[0].setMonitor_rule(rule);
    monitor_associations[0].setPool_name(pool_name);
    stub.set_monitor_association(monitor_associations); 

     

     

    You will want to see what monitor rule types are possible so you get what you want.