Forum Discussion
Linda_55714
Nimbostratus
Aug 11, 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. I use perl libraries and make SOAP calls. Please find the sample output below. Can someone please help with this issue?
POOL:e1-tst-svc-v1:POOL_MEMBER:148.173.73.61:36540:STATUS:ENABLED:AVAILABILITY:AVAILABILITY_STATUS_GREEN
POOL:e1-tst-svc-v1:POOL_MEMBER:148.173.73.61:46540:STATUS:ENABLED:AVAILABILITY:AVAILABILITY_STATUS_RED
-> Setting host 148.173.73.61:46540 to STATE_DISABLED ->
Setting host 148.173.73.61:46540 monitor to STATE_DISABLED
---[ EXECUTION RESULTS ]--- ->
Successfully set member 148.173.73.61 (port 46540) from STATE_ENABLED to STATE_DISABLED
---[ END OF RESULTS ]
--- -> Getting all pool members (0) ... done.
---------------------------------------
POOL: e1-tst-svc-v1
STATUS: ENABLED_STATUS_ENABLED
MONITOR: AVAILABILITY_STATUS_RED -
--------------------------------------
POOL:e1-tst-fulsvc-v1:POOL_MEMBER:148.173.73.61:36540:STATUS:ENABLED:AVAILABILITY:AVAILABILITY_STATUS_RED
POOL:e1-tst-fulsvc-v1:POOL_MEMBER:148.173.73.61:46540:STATUS:DISABLED:AVAILABILITY:AVAILABILITY_STATUS_RED
2 Replies
- Hi Linda, could you post the section of code you are using for set_monitor_state() (including the creation/packing of the parameters)?
That might shed some light into things...
Thanks!
-Joe - Linda_55714
Nimbostratus
Thank 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");
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