Forum Discussion

Prasad_81758's avatar
Prasad_81758
Icon for Nimbostratus rankNimbostratus
Feb 10, 2011

How to Set Health Monitor on a Pool using iControl Java

I am able to create a pool using the iControl java api. However, I am not able to set any health monitors on the pool. Here is thecode:

 

 

LocalLBPoolMemberMemberMonitorAssociation[][] ma = poolMember.get_monitor_association(pn);

 

LocalLBPoolMemberMemberMonitorAssociation[][] newma = new LocalLBPoolMemberMemberMonitorAssociation[1][hostList.size()];

 

for (int j = 0; j < ma.length; j++)

 

{

 

for (int k = 0; k < ma[j].length; k++)

 

{

 

LocalLBMonitorIPPort ipp = new LocalLBMonitorIPPort();

 

ipp = (ma[j][k].getMember()); LocalLBMonitorRule mr = new LocalLBMonitorRule();

 

String[] mt = {"tcp"}; //Also tried iControl.LocalLBMonitorTemplateType.TTYPE_TCP.getValue()

 

mr.setMonitor_templates(mt);

 

mr.setType(LocalLBMonitorRuleType.MONITOR_RULE_TYPE_SINGLE);

 

newma[j][k] = new LocalLBPoolMemberMemberMonitorAssociation(); newma[j][k].setMember(ipp); newma[j][k].setMonitor_rule(mr);

 

}

 

}

 

poolMember.set_monitor_association(pn, newma);

 

 

Thanks for your help.
  • Hi Prasad, What was it that you were doing wrong please let me know even I have run into the same problem. Thanks