Forum Discussion
dalexand_127251
Nimbostratus
Oct 29, 2003Threshold for minimum number of nodes in a pool
We would like to define a threshold for the minumum number of nodes in a pool when a pool is created. This threshold would be used by external monitoring to generate alerts when the number of active ...
Nov 05, 2003
Sorry I didn't get back to you sooner as I just got back from vacation.
You are very close. Actually, for a hint on passing arrays in the LocalLBNode sample the call to "set_state" passes in an array of IPPortDefinitions. When writing the first set of sample apps, I tried to get all combinations of parameters (ins and outs) illustrated.
I'm not a perl guru by any means so I can't explain what all the combinations of curly brackes, at signs, dollar signs, etc do in all combinations but I have found that when passing arrays you should surround the value with brackets to force it to an array. Here's a bit of code that should do the job for you (building from the LocalLBPool sample).
------------------------------------------------------------------------
Get Member List
------------------------------------------------------------------------
print "Members : {";
(@member_list) = getPoolMemberList($sPool);
foreach my $member (@member_list)
{
print $member->{"address"}, ":", $member->{"port"}, ", ";
}
print "\b\b}\n";
------------------------------------------------------------------------
Get member active states
------------------------------------------------------------------------
print "Member Active States :\n";
$soap_response =
$soap->get_member_active_states
(
SOAP::Data->name(pool_name => $sPool),
SOAP::Data->name(member_defs => [@member_list])
);
@member_states = @{$soap_response->result};
foreach my $member_state (@member_states)
{
$member_def = $member_state->{"member_def"};
$member_ip = $member_def->{"address"};
$member_port = $member_def->{"port"};
$active_state = $member_state->{"active_state"};
print " ", $member_ip, ":", $member_port, ": ", $active_state, "\n";
}
Personally I have a good understanding of the soap transport so I use the built-in trace facility in SOAP::Lite (uncommented at the top of each script) to help debug issues like this. If you know it needs to be an array and the trace isn't showing it that way, you can tweak the code until it works.
Let us know if this works for you.
-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