Forum Discussion
Confusion on changing a pool member state
I can display states, nodes, and virtual servers just fine. Attached screenshot is my lazy attempt at diving into only the surface of the iControl api. For the most part I found the API documentation pretty good and useful for finding which methods to call.
The problem comes when trying to make changes to objects. For example I'd like to use the ltm["LocalLB.PoolMember"].set_monitor_state() method to force nodes offline or online. However it is not obvious what arguments set_monitor_state expects.
I have tried variations of the following.
member_state = {"member" => {"address" => "172.16.20.65", "port" => 0}, "monitor_state" => "STATE_DISABLED"}
member_state = {"member" => {"address" => "172.16.20.65", "port" => 0}, "monitor_state" => 0}
member_state = {:member => {:address => "172.16.20.65", :port => 0}, :monitor_state => 0}
Passing that into the set_monitor_state
@ltm["LocalLB.PoolMember"].set_monitor_state("tmp_test_pool", member_state)
I cannot figure out how it wants the data arranged. Can anyone give me any hints or pointers??
- crosson_16669NimbostratusHmm I couldn't add the screenshot. Here is an example of being able to make calls and pull data off the LTM.
I think you are munging two data types together in your member_state hash. Instead, try something like this:
- crosson_16669Nimbostratusthat's what the "[]" and "[] []" mean in the method definition.
I thought of that. The reason I didn't do this, and the reason I got confused, is because get_monitor_status also requires string [] but if you see my example above I did not have to pass it in as an array. I was able to simply use "poolname" and not ["poolname"]
member = {:address => "172.16.20.65", :port => 0}
monitor_state = "STATE_DISABLED"
This is a good point. I will try this.
also, if you are using v11.x you should be doing all this in the LocalLB::Pool with set_member_monitor_state
We standardize on 10.2.3 still. :)
Thanks for the help Andy. I'll update you with the status. It may be a few weeks, after the holidays, when I can look at this again.
- crosson_16669NimbostratusHad a long vacation but will be back in action in a few days. I'll try the monitor_state assignment as you mentioned above to see if it works.
- crosson_16669NimbostratusI have tried all the variations you gave above plus some alterations of it. I get the following.
XSD::ValueSpaceError: {urn:iControl}Common.EnabledState: cannot accept '' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/wsdl/xmlSchema/simpleType.rb:66:in `check_restriction' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/wsdl/xmlSchema/simpleType.rb:23:in `check_lexical_format' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:125:in `simpleobj2soap' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:118:in `obj2typesoap' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:44:in `obj2soap' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/mapping/mapping.rb:127:in `_obj2soap' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:210:in `elements2soap' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:206:in `each' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:206:in `elements2soap' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:167:in `struct2soap' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:134:in `complexobj2soap' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:120:in `obj2typesoap' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:44:in `obj2soap' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/mapping/mapping.rb:127:in `_obj2soap' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:179:in `array2soap' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:178:in `each' ... 14 levels... from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:206:in `elements2soap' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:167:in `struct2soap' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:134:in `complexobj2soap' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:120:in `obj2typesoap' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:44:in `obj2soap' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/mapping/mapping.rb:127:in `_obj2soap' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/mapping/mapping.rb:47:in `obj2soap' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/mapping/mapping.rb:360:in `protect_threadvars' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/mapping/mapping.rb:43:in `obj2soap' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/rpc/proxy.rb:394:in `request_rpc_enc' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/rpc/proxy.rb:376:in `request_rpc' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/rpc/proxy.rb:338:in `request_body' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/rpc/proxy.rb:123:in `call' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/rpc/driver.rb:178:in `call' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/soap/rpc/driver.rb:232:in `set_monitor_state' from (irb):135>>
member = {:port=>0, :address=>"172.16.20.65"} monitor_state = "STATE_DISABLE" @ltm["LocalLB.PoolMember"].set_monitor_state(@poolname, [member, monitor_state]) @ltm["LocalLB.PoolMember"].set_monitor_state([@poolname], [member, monitor_state]) @ltm["LocalLB.PoolMember"].set_monitor_state(@poolname, [[member], [monitor_state]])
Struct.new("Member", :address, :port) Struct.new("Member_status", :member, :status) m = Struct::Member.new("172.16.20.65", 0) ms = Struct::Member_status.new(m, 0) @ltm["LocalLB.PoolMember"].set_monitor_state(@poolname, ms)
- George_Watkins_Historic F5 Accountcrosson,
bigip = F5::IControl.new('test-ltm-01', 'admin', 'admin', ['LocalLB.PoolMember']).get_interfaces member = { 'address' => '10.84.3.50', 'port' => 80 } bigip['LocalLB.PoolMember'].set_monitor_state ['test-ubuntu-lucid'], [ [ { 'member' => member, 'monitor_state' => 'STATE_DISABLED' } ] ] bigip['LocalLB.PoolMember'].set_monitor_state ['test-ubuntu-lucid'], [ [ { 'member' => member, 'monitor_state' => 'STATE_ENABLED' } ] ]
- crosson_16669NimbostratusPycontrol looks quite a bit more matured than the ruby gem. For now I've gone ahead and made my own wrapper for pool member manipulation. Feel free to use.
- crosson_16669NimbostratusDoes anyone happen to know the equivalent python format for set_monitor_state?
Recent Discussions
Related Content
* 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