Computing > 8 - LoadBalancers Management > Get LoadBalancer Loads

8.08 Get LoadBalancer Loads

By the Aruba WsEndUser method GetLoadBalancerLoads you can retrieve the list of load balancer’s load statistics.

Parameters
loadBalancerID
Type: int
Load balancer identification number

startTime
Type: DateTime
Start time of statistics interval

endTime
Type: DateTime
End time of statistics interval


/// IWsEndUser.GetLoadBalancerLoads Method (c# .NET)
public static string GetLoadBalancerLoads(WsEndUserClient client,
        int loadBalancerID, DateTime startTime, DateTime endTime)
{
    //specify the account login details 
    client.ClientCredentials.UserName.UserName = "ARU-0000";
    client.ClientCredentials.UserName.Password = "0123456789";

    StringBuilder stringBuilder = new StringBuilder();

    try
    {
        // create the request object
        LoadBalancerLoadRequest request = new LoadBalancerLoadRequest();
        request.LoadBalancerID = loadBalancerID;
        request.StartTime = startTime;
        request.EndTime = endTime;

        // call method GetLoadBalancerLoads 
        // obtaining a WsResultOfArrayOfLoadBalancer item
        WsResultOfLoadBalancerLoads result = client.GetLoadBalancerLoads(request);

        //if the call is Success print values
        if (result.Success)
        {
            stringBuilder.Append(" Operation ends successfully.");

            LoadBalancerLoads item = result.Value;

            stringBuilder.Append("\n CompanyID: ");
            stringBuilder.Append(item.CompanyID);                        
            stringBuilder.Append("\n DataCenterID: ");
            stringBuilder.Append(item.DataCenterID);
            stringBuilder.Append("\n Name: ");
            stringBuilder.Append(item.Name);
            stringBuilder.Append("\n LoadBalancerID: ");
            stringBuilder.Append(item.LoadBalancerID);

            if (item.Loads != null)
            {
                foreach (Load entity in item.Loads)
                {
                    stringBuilder.Append("\nLoadID: ");
                    stringBuilder.Append(entity.LoadID);
                    stringBuilder.Append("\nEventTime: ");
                    stringBuilder.Append(entity.EventTime);
                }
            }
        }
        else
        {
            throw new ApplicationException(result.ResultMessage);
        }
    }
    catch (Exception ex)
    {
        // re-run the error
        throw new ApplicationException(ex.Message);
    }

    return stringBuilder.ToString();
}
 /// IWsEndUser.GetLoadBalancerLoads Method (JAVA)
public static String GetLoadBalancerLoads(IWsEndUser client,
     int loadBalancerID, XMLGregorianCalendar startTime,
     XMLGregorianCalendar endTime)
{
    //specify the account login details 
    ((BindingProvider) client).getRequestContext()
            .put(BindingProvider.USERNAME_PROPERTY, "ARU-0000");
    ((BindingProvider) client).getRequestContext()
            .put(BindingProvider.PASSWORD_PROPERTY, "0123456789");

    StringBuilder StringBuilder = new StringBuilder();

    try
    {
        // create the request object
        LoadBalancerLoadRequest request = new LoadBalancerLoadRequest();
        request.setLoadBalancerID(loadBalancerID);
        request.setStartTime(startTime);
        request.setEndTime(endTime);

        // call method GetLoadBalancerLoads 
        // obtaining a WsResultOfArrayOfLoadBalancer item
        WsResultOfLoadBalancerLoads result = 
            client.getLoadBalancerLoads(request);

        //if the call is Success print values
        if (result.isSuccess())
        {
            StringBuilder.append(" Operation ends successfully.");

            LoadBalancerLoads item = result.getValue();

            StringBuilder.append("\n CompanyID: ");
            StringBuilder.append(item.getCompanyID());                        
            StringBuilder.append("\n DataCenterID: ");
            StringBuilder.append(item.getDataCenterID());
            StringBuilder.append("\n Name: ");
            StringBuilder.append(item.getName());
            StringBuilder.append("\n LoadBalancerID: ");
            StringBuilder.append(item.getLoadBalancerID());
                
            ArrayOfLoad arrayOfLoad = item.getLoads();
            List<Load> loadList = arrayOfLoad.getLoad();
            for (Iterator<Load> it = loadList.iterator(); 
                it.hasNext();)
            {
                Load entity = it.next();
                StringBuilder.append("\nLoadID: ");
                StringBuilder.append(entity.getLoadID());
                StringBuilder.append("\nEventTime: ");
                StringBuilder.append(entity.getEventTime());
            }
            
        }
        else
        {
            throw new Exception(result.getResultMessage());
        }
    }
    catch (Exception ex)
    {
        //show error
        System.out.println(ex);
    }

    return StringBuilder.toString();
}
Version
API: v2.8 URL:https://api.dc1.computing.cloud.it/WsEndUser/v2.8/WsEndUser.svc?wsdl