Forum Discussion

Kent_Perrier_50's avatar
Kent_Perrier_50
Icon for Nimbostratus rankNimbostratus
Nov 06, 2007

use iControl to set a pool member to Down status?

I am attempting to write perl based iControl script to change pool member status. I have found the the TogglePoolMember script in CodeShare that I am using as a starting point. Unfortunately, I have not been able to see if I can set a pool member's status to DOWN or UP via the iControl API. Can I do this with the API or must the up or down status change be done via ssh and a

b pool  members  up

or

b pool  members  down
command?
  • Don_MacVittie_1's avatar
    Don_MacVittie_1
    Historic F5 Account
    You can, it just takes an extra step or so.

     

     

    Call Pool::get_member() to get an instance of PoolMember.

     

    Then call PoolMember::set_session_enabled_state() to set it up or down.

     

     

    Relevant Wiki Links:

     

    - Pool::get_member() Click here

     

    - set_session_enabled_state() Click here

     

     

    Hope that helps point you in the right direciton!

     

    Don.
  • It does not. I am using the same code from the TogglePoolMember, but instead of passing a STATE_DISABLED I am passing DOWN and that is not working. Drilling through the API links I end up at http://devcentral.f5.com/wiki/default.aspx/iControl/Common__EnabledState.html and that leads me to believe that the only states you can set via the API is STATE_DISABLED or STATE_ENABLED.

     

     

    Thanks for the reply! If this iControl stuff is this hard/convoluted for a non programmer to use, then I may just use ssh to run the bigpipe commands remotely. I would love to learn it, but I see more tutorials for .NOT and java than perl.
  • Don_MacVittie_1's avatar
    Don_MacVittie_1
    Historic F5 Account
    Ahh... You tickled my brain. We had this conversation not long ago so I went and dug it up, sounds like exactly what you're experiencing...

     

    Click here

     

     

    And iControl is a bit of a struggle for first-timers who aren't coders - it's a programming interface after all - but it does have a logic to it, so once you've got the basic idea, it gets easier, promise!

     

     

    Don.
  • So I need to set the MemberMonitorState to DOWN to be the same thing as

     

     

    b pool members down ?

     

     

    If so, when I set the MemberMonitorState to UP does that also change the state to STATE_ENABLED?

     

     

     

    Edit:

     

     

    A little hard? It appears you provide many examples in .NET and Java but next to nothing in perl. What examples you have in CodeShare are not commented well. I have not idea WHY you are doing what is done the code, so I am trying to modify what you have already and hope it works. The example code supplied with the API download is of the same quality, no commenting, saying what is going on.

     

     

    For example the PoolToggle code at http://devcentral.f5.com/wiki/default.aspx/iControl/PoolToggle.html has this little gem in it

     

     

    
       Extract the 1st list for the single pool passed in.
      @member_list = @{@member_lists[0]};
            
       build parameters for set_session_enabled_state();
      foreach $member_def (@member_list)
      {
        $address = $member_def->{"address"};
        $port = $member_def->{"port"};
        $member = { address => $address, port => $port };
        $MemberSessionState =
        {
          member => $member,
          session_state => $state
        };
        push @MemberSessionStateList, $MemberSessionState;
      }

     

     

    There is no mention of the only the first member of the @member_lists array is referenced, nor is there anything else that says what else that array contains.

     

     

    I, personally, would love some tutorials that sets up a use case, presents the code to do it, and explains what us happening every step of the way. I am just a UNIX system admin stuck with maintaining a set of LTMs. I am not professional programmer, your API reference is of little help to me as I don't really understand what it is telling me.

     

     

    It was not my intention for this to come across as so hostile. I am just getting really frustrated with trying to get these scripts written so I can delegate some things out to others without compromising the integrity of the solution and I am tired of fighting the tools you have given me do the job.
  • Aaron,

     

     

    Our R&D here are currently testing this to see if it causes any issues with our applications and have found some bugs in it that affect our software so we have to wait for these to be resolved before we can roll it out, so the other otion i suppose is too use icontrol. But do you know if it possible to call an icontrol script from within an irule? That may be a way around it I suppose.

     

     

    Cheers

     

     

    Tim
  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    Hi Tim -

     

     

    It looks like you might have posted to the wrong thread, but to answer your question about calling an iControl script from within an iRule: No, that isn't possible.

     

     

    /deb