Forum Discussion

adam_tombleson_'s avatar
adam_tombleson_
Icon for Nimbostratus rankNimbostratus
Mar 05, 2007

get_statistics trouble

Hey there, im trying to get the stats from one virtual server. I seem to be having trouble though. Am i calling this wrong? My result set is always empty.

Any help would be great,

Cheers,

Adam

(Perl and Big-Ip 9.1.2).


my @vs_list; 
my $vs_def = {
name    => $name,
address => $address,
port    => $port
};
push @vs_list, [$vs_def];
my $soapResponse = $connection->get_statistics(
SOAP::Data->name( virtual_servers => [@vs_list] )
);
my @res = @{$soapResponse->result->{"statistics"}};

1 Reply

  • You are giving a bit too much to the get_statistics method...

     

     

    The signature for VirtualServer::get_statistics is:

     

     

    VirtualServerStatistics LocalLB::VirtualServer::get_statistics(
        in String [] virtual_servers
    );

     

     

    In your code you are passing in an array of structures containing the name, address, and port. All you need is an array of strings of the names.

     

     

    This should get you going:

     

     

    my $soapResponse = $connection->get_statistics(
    SOAP::Data->name( virtual_servers => [$name] )
    );
    my @res = @{$soapResponse->result->{"statistics"}};

     

     

    If you want to pass in multiple names, you'll have to do something like this:

     

     

    push $vs_list, $name1;
    push $vs_list, $name2;
    my $soapResponse = $connection->get_statistics(
    SOAP::Data->name( virtual_servers => [@vs_list] )
    );
    my @res = @{$soapResponse->result->{"statistics"}};

     

     

    Also, you can check out the LocalLBVSStats.pl sample in the SDK for further reference.

     

     

    -Joe