Forum Discussion
alex_der_101956
Nimbostratus
Apr 21, 2006get_persistence_record
can someone show me an example of how to use LocalLB::Pool::get_persistence_record in perl?
Apr 24, 2006
That method takes two arrays in and returns a 2-dimensional array. What issue are you having? Formatting the input arrays, or parsing the output arrays?
Here's some code that might get you going. This example requests the persistence records only on a single pool. By requesting the PERSIST_MODE_NONE mode, you will receive all persistence records regardless of the mode.
$sPool is defined elsewhere...
$persistence_mode = "PERSIST_MODE_NONE";
$soapResponse = $Pool->get_persistence_record
(
SOAP::Data->name(pool_names => [$sPool]),
SOAP::Data->name(persistence_modes => [$persistence_mode])
);
&checkResponse($soapResponse);
@PersistenceRecordLists = @{$soapResponse->result};
for $i (0 .. $PersistenceRecordLists)
{
$PersistenceRecordList = $PersistenceRecordLists[$i];
foreach $PersistenceRecord ( @{$PersistenceRecordList} )
{
$pool_name = $PersistenceRecord->{"pool_name"};
$node_server = $PersistenceRecord->{"node_server"};
$node_ip = $node_server->{"address"};
$node_port = $node_server->{"port"};
$mode = $PersistenceRecord->{"mode"};
$persistence_value = $PersistenceRecord->{"persistence_value"};
$virtual_server = $PersistenceRecord->{"virtual_server"};
$vs_name = $virtual_server->{"name"};
$vs_address = $virtual_server->{"address"};
$vs_port = $virtual_server->{"port"};
$vs_protocol = $virtual_server->{"protocol"};
$create_time = $PersistenceRecord->{"create_time"};
$age = $PersistenceRecord->{"age"};
print "Pool ($pool_name); Node ($node_ip:$node_port); ";
print "Value: ($persistence_value); ";
print "Virtual ($vs_name - $vs_address:$vs_port - $vs_protocol); ";
print Create time: ($create_time); Age ($age)\n";
}
}
*Disclaimer - this hasn't been tested yet.
There are many ways to access 2-d arrays. Check out the perllol manpage for more examples:
http://www.perl.com/doc/manual/html/pod/perllol.html
Click here
-Joe
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
