Forum Discussion
Linda_55714
Nimbostratus
Aug 12, 2011set_monitor_state() method is always acting on first pool member
I have two members A and B in a pool. Irrespective of the pool member (IPAddress+Port) I request for enabling/disabling through the set_monitor_state() method, it always acts on the first pool member....
Linda_55714
Nimbostratus
Aug 16, 2011Thank you for the quick response. Unfortunately my company security policies do not permit sharing code.
I have tried to explain the algorithm used in the code. Can you please help?
1. In a function called set_pool_status get the list of all pool members and their states
my @member_lists = @{$globals->{data}->{pool}->get_member(name('pool_names' => [@{$pools}]))->result};
my @pools_states = @{$globals->{data}->{poolmember}->get_session_enabled_state(name('pool_names' => [@{$pools}]))->result};
my @pools_monitor_states = @{$globals->{data}->{poolmember}->get_monitor_status(name('pool_names' => [@{$pools}]))->result};
2. Loop through the member lists and check for the IP+PORT that needs to disabled or enabled and
for my $member_def (@{@member_lists[$pool_num]}) {
my $address = $member_def->{address};
my $port = $member_def->{port};
my $curr_state = $pools_states[$pool_num][$member_num]->{monitor_status};
my $MemberMonitorState;
my $member = { address => $address, port => $port };
if (defined($globals->{hosts}->{$address})) {
if ($port eq $globals->{hosts}->{$address}->{port}) {
$MemberMonitorState = { member => $member, monitor_state => $set_state };
print "-> Setting host $address:$port monitor to $set_state\n";
} else {
$MemberMonitorState = { member => $member, monitor_state => $curr_state };
}
push (@MemberMonitorStateList, $MemberMonitorState);
$member_num++;
}
push (@MemberMonitorStateLists, [@MemberMonitorStateList]);
$pool_num++;
3. Invoke F5 to set the monitor state
my $response_monitor = $globals->{data}->{poolmember}->set_monitor_state(name('pool_names' => [@{$pools}]),
name('monitor_states' => [@MemberMonitorStateLists]))->result;
The function is called with arguments “STATE_ENABLED” or “STATE_DISABLED”
set_pool_status(\@pools, "STATE_ENABLED");
set_pool_status(\@pools, "STATE_DISABLED");
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