Forum Discussion

Carl_69698's avatar
Carl_69698
Icon for Nimbostratus rankNimbostratus
Nov 16, 2009

iControl PoolMember Status (available or offline) via Java API

Hi,

 

 

I have a BIG-IP Local Traffic manager with a specific pool and 2 members. Each member has a heart beat mechanism and if the specified heartbeat returns something other than a value of "ACTIVE" then its status becomes Offline and vise versa. I am using the following code to query the BIG-IP local Traffic manager and it is not giving the proper status back. The BIG-IP console correctly shows if the status of on of the members is available or offline. I am trying to use the iControlAPI to query the status of one of the Pool members and get the correct status of available or offline. I am using the following code and it is not able to retrieve this status properly:

 

 

public class iControlStatus {

 

 

public static void main(String[] args) {

 

 

String[] chudPoolList = new String[1];

 

chudPoolList[0] = "drt00das.pjm.com";

 

 

try {

 

Interfaces myi = new Interfaces();

 

 

myi.initialize("ip_address",

 

"user_name",

 

"password");

 

 

LocalLBPoolPortType t =

 

myi.getLocalLBPool();

 

 

 

LocalLBPoolMemberPortType poolMember = myi.getLocalLBPoolMember();

 

 

LocalLBPoolMemberMemberSessionStatus[][] sessionStatus = poolMember.get_session_status(chudPoolList);

 

 

for (int h=0; h

 

for (int i=0; i

 

LocalLBPoolMemberMemberSessionStatus status = sessionStatus[h];

 

CommonIPPortDefinition member = status.getMember();

 

System.out.println("Member Address: " + member.getAddress());

 

LocalLBSessionStatus memberStatus = status.getSession_status();

 

System.out.println("Member Status: " + memberStatus.getValue());

 

}

 

}

 

}

 

catch (Exception e) {

 

System.out.println(" **** ERROR ****: " + e.getMessage());

 

e.printStackTrace();

 

}

 

}

 

}

 

 

This produces the following:

 

 

Member Address: ip_address_1

 

Member Status: SESSION_STATUS_ENABLED

 

Member Address: ip_address_2

 

Member Status: SESSION_STATUS_DISABLED

 

 

Looking at the console it is showing that ip_address_1 is offline and that ip_address_2 is available. I have not been able to find an API that will give me the proper status that will tell me if this member is currently available or offline.

 

 

Your help is greatly appreciated!

 

 

Many Thanks!

 

 

Carl
  • I was able to get this working. Here is the code:

     

     

    public static void main(String[] args) {

     

     

    String[] chudPoolList = new String[1];

     

    chudPoolList[0] = "host";

     

     

    try {

     

    Interfaces myi = new Interfaces();

     

     

    myi.initialize("host",

     

    "user_name",

     

    "password");

     

     

    LocalLBPoolPortType t =

     

    myi.getLocalLBPool();

     

     

    // retrieve the entire list of pools for this load balancer

     

    String[] poolList = t.get_list();

     

     

     

    // Retrieve a specific pool member

     

    LocalLBPoolMemberPortType poolMember = myi.getLocalLBPoolMember();

     

    LocalLBPoolMemberMemberObjectStatus[][] status = poolMember.get_object_status(chudPoolList);

     

     

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

     

    for (int k=0; k LocalLBPoolMemberMemberObjectStatus objectStatus = status[j][k];

     

    LocalLBObjectStatus statusObject = objectStatus.getObject_status();

     

    CommonIPPortDefinition port = objectStatus.getMember();

     

    LocalLBAvailabilityStatus avail = statusObject.getAvailability_status();

     

    LocalLBEnabledStatus enabledStatus = statusObject.getEnabled_status();

     

    System.out.println("\n\nAddress: " + port.getAddress());

     

    System.out.println("Avalialability Status: " + avail.getValue());

     

    System.out.println("Status Description: " + statusObject.getStatus_description());

     

    System.out.println("Actual status: " + enabledStatus.toString());

     

    }

     

    }

     

    }

     

    catch (Exception e) {

     

    System.out.println(" **** ERROR ****: " + e.getMessage());

     

    e.printStackTrace();

     

    }

     

    }