Forum Discussion

alexlindley_346's avatar
Icon for Nimbostratus rankNimbostratus
Oct 20, 2010

Viewing Pool Member details via API




Sorry if this has been answered before but I couldn't find a definitive answer...



I have three Pools of servers each with 9 servers in them. I'm running scripts to automate taking certain members of each pool out so new applications can be installed on the server and then bringing them back into service.



I'm trying to take them out and back in gracefully:


Enabled -> Disabled -> Forced Offline -> Disabled -> Enabled



I've read Joe's article on how this should be done so I'm running the following methods:



my $soapResponse = $PoolMember->set_session_enabled_state(


SOAP:: Data->name ( pool_names => [$pool] ),


SOAP:: Data->name ( session_states => [@nodes_to_change_state] )





to stop any new sessions being created to the servers and then:



my $soapResponse = $PoolMember->set_monitor_state(


SOAP:: Data->name ( pool_names => [$pool] ),


SOAP:: Data->name ( monitor_states => [@nodes_to_change_state] )





To stop connections to the servers all together.



There is a 25 minute gap between the two commands and during this time I want to query the servers through the API to see which servers are still active and which have been "disabled". Then after the 25 minute wait I want to be able to see the servers which have been "forced offline".



I thought I would be able to do this using the following methods:


my $soapResponse = $PoolMember->get_session_enabled_state(


SOAP:: Data->name ( pool_names => [@pool_list] )





my $soapResponse = $PoolMember->get_object_status(


SOAP:: Data->name ( pool_names => [@pool_list] )





However when I run these after the initial disable it shows the pool members session_enabled state as: "STATE_DISABLED", but it also shows the object status as "ENABLED_STATUS_DISABLED". It then shows exactly the same thing when I run the command to force down pool members.



What information can I obtain through the API that will show me when a pool member is either:


Enabled (All traffic allowed)


Disabled (Only persistent or active connections allowed)


Forced Offline (Only active connections allowed)



As we see in the Web GUI?



One final question, when a pool member is forced offline is it possible to set it back to "disabled" via the API methods?



Hopefully I've explained myself well enough, let me know if you need any more details.



Thanks for your help its much appreciated!







5 Replies

  • Hi Alex, I'll see if I can address each of your questions.



    First, I wanted to correct something in your logic for the shutdown. In my article "Graceful Server Shutdown" I first call set_session_enabled_state() to DISABLED, then sit in a loop monitoring the current connections from the get_statistics() method. Once the number of current connections drops to 0, then the set_monitor_state() method is called. You didn't mention the middle step and that's important to not break any users exisiting sessions.



    Now to the questions...



    Q: What information can I obtain through the API that will show me when a pool member is either...



    In this tech tip, I talked about the 3-way toggle in the GUI and how it maps to the iControl states (enabled and availability)





    Hopefully this tech tip helps clear up managing taking servers up and down.



    Q: when a pool member is forced offline is it possible to set it back to "disabled" via the API methods?



    From the above article, you'll see that the difference between "Forced Offline" and "Disabled" is that the Monitor State is flipped from STATE_DISABLED for "Forced Offline" to STATE_ENABLED for "Disabled" - I know, that doesn't sound right but it really is B-).



    Hopefully that answered your questions. If not, please reply here and I'll see what I can do to explain it in more depth.





  • Hi Joe,



    Thanks very much for your response, I've now got a much more user friendly view of the current pool member states using the toggle state method in the tech tip you mention above!



    I'm currently re-engineering some scripts to work with F5s rather than CSMs which we used before so its just getting used to the slight difference between setting a weight then taking the service out and back in to setting it to disable and then forced offline.



    Could you just cofirm that my thinking is correct here with the 4 possibilities when taking a service out and back in gracefully...


    Monitor state ENABLED + Session state ENABLED = Accepting all sessions old and new


    Monitor state ENABLED + Session state DISABLED = No longer accepting new connections


    Monitor state DISABLED + Session state DISABLED = No connections at all


    Monitor state DISABLED + Session state ENABLED = People can hit this URL but it's offline so bad news (is that correct?)



    If that last point is correct then I need to be sure to ENABLE the monitor state before the session state when bringing the services back online.




    The reason I don't wait for all the connections to drop to 0 is because we don't have a very long window to upgrade our app servers behind the URLS so I give everyone 25 minutes to log off and back on through a different URL still accepting sessions before I take it down anyway.



    Again, thanks for the help.



  • There is no setting that will block ALL connections, even disabled/disabled allows active connections to finish their job. Only if a monitor itself marks the service as down will the active connections be dropped.
  • Hey Joe,



    Thanks for the article and explanations here.





    It answered a few customer questions today.



  • Thanks Aaron, that darn three-way toggle in the GUI has spawned so many questions with regards to the API. The core deals with the two different states, but I think the GUI folks thought it was easier to understand as a three-way toggle instead of presenting two different check boxes. Oh well, gives me something to write about B-).