Forum Discussion

ltp_55848's avatar
ltp_55848
Icon for Nimbostratus rankNimbostratus
Sep 14, 2011

PoolMember::get_statistics parameters

Hi All,

I'm having some difficulty in correctly invoking LocalLB::PoolMember::get_statistics in a perl script. My understanding of the API reference is that the method accepts two parameters;

- pool_names: A list of strings that are the pool names for which the statistics should be retrieved which in perl I am passing as hash key/value pair with the value being a single pool name in list context. i.e.

      pool_names => [ $pool ]

- members: A list of lists of IPPortDefinition values which I am passing as a hash key/value pair with the value being a list of lists of a single member. i.e.

      members => [ [ 10.0.0.10:80 ] ]

The specific error message I am receiving is that either the pool_names or members element could not be found.

At first I thought that the problem may have been due to the method expecting an positional parameter list and me using a hash (no guaranteed order) as the error message was indicating that the pool_names parameter could not be found.

However after putting together an invocation not using a hash and ensuring that the parameter order was correct as per the API reference I am now receiving an error indicating that the members parameter can not be found.

My guess is that I am misunderstanding the parameter types in the API rereference so if anyone can point out what I may be doing wrong here it would be greatly appreciated.

Cheers,

EDIT: Also, mods; I received an error on submitting this post about a bad element so clicked back, removed any suspect characters and then resubmitted. This caused two duplicates of this post - if someone could delete the other two that would be great.

The element that generated the warning was a percent character.

  • Hi ltp, could you post the full code around the method call? It looks like what you are doing should work, but I can't tell unless you give me the whole snippet.

     

     

    When I get back into the office tomorrow, I'll see if I can dig up some code in perl using that function and post it here.

     

     

    -Joe

     

  • So with a fresh perspective on the problem this morning I had a "Duh!" moment and realised what I'd been doing wrong.

    Instead of passing a SOAP::Data objects for each parameter, I was passing a single object containing all parameters.

    So this;
    $query = $client->get_statistics(SOAP::Data->name(pool_names => [ 'my_pool' ], members => [{address => '10.1.1.10', port => '80'}] ));
    
    Should be;
    $query = $client->get_statistics(SOAP::Data->name(pool_names => [ 'my_pool' ]),SOAP::Data->name(members => (['10.1.1.10'],['80']) ));