Forum Discussion
F5 LTM SOAP API - Ruby f5-icontrol Gem - Could not find element by name: pool_names
Hi there,
Very much hoping there is someone that can help me with this problem. I am trying to gather some information about pool members from the F5 API (still on SOAP for a little while more).
I am using the f5-icontrol Gem described here: http://www.rubydoc.info/gems/f5-icontrol/0.1.5
Specifically, I am trying to call the LocalLB.Pool.get_all_member_statistics method passing in a string of the pool name and receive the following error:
/full/path/ruby-2.1.6/gems/savon-2.11.1/lib/savon/response.rb:85:in `raise_soap_and_http_errors!': (SOAP-ENV:Server) **Could not find element by name: pool_names** (Savon::SOAPFault)
I am able to run a number of other methods and get back data, for example I can run api.LocalLB.Pool.get_list & api.Management.UserManagement.get_my_permission() and data is returned immediately. Also, the string I am passing in to get_all_member_statistics is the exact string returned by api.LocalLB.Pool.get_list.
Note that I tried running as a normal user as well as an F5 admin.
Here is my exact code:
require 'f5-icontrol'
F5::Icontrol.configure do |f|
f.host = "big-ip-url.domain.com"
f.username = "user"
f.password = "pass"
end
api = F5::Icontrol::API.new
get_list runs perfectly and returns all of the pool names in the format of "/Common/full_pool_name" for example
response = api.LocalLB.Pool.get_list
This successfully returns the permissions for the current user
response = api.Management.UserManagement.get_my_permission()
This is NOT working and returns the error above
response = api.LocalLB.Pool.get_all_member_statistics("Common/full_pool_name_exactly_as_it_appears_in_the_UI")
puts response.inspect
- kwondra34_26054NimbostratusI tried to update my question in IE and Chrome but when I hit save it's not doing anything--not sure what's going on. In any case, please note that I forgot to include the beginning "/" in get_all_member_statistics above (but my code is correct). Note that I also tried specifying the pool name in a number of different ways (e.g. "/Common/name-of-pool", "name-of-pool", an array of pool names (even though F5 docs suggest string), URL-encoded name-of-pool, etc.).
The LocalLB.Pool.get_all_member_statistics looks like this
LocalLB.Pool.MemberStatistics [] get_all_member_statistics( in String [] pool_names );
It takes as a parameter, an array of pool names to query and returns an array of MemberStatistics structures for each pool passed in the pool_names parameter.
If you are getting an error that "pool_names" isn't found, odds are that your call isn't passing the value in as an array of size 1 with the first index being the pool you are querying. From the looks of how you coded it, it looks like it's just a string literal getting passed in that parameter.
We designed the APIs this way to make it easier to perform "bulk" operations.
-Joe
- klys2004_51616Nimbostratus
try this fomat response = api.LocalLB.VirtualServer.get_destination({"virtual_servers"=>{:item=>['/Common/vs-name']}})
First of all, sorry for the delay. Had a heck of a time getting this running on my mac. Also, I'm a noob with Ruby so I'm trying to figure it out myself.
Regarding the "couldn't find element by name" error, that means that the server didn't see the specific parameter in the request. In your code, you are just passing in a string literal and I think you need to specify the parameter name and encode the value as an array. I tried this out and it seemed to work:
response = api.LocalLB.Pool.get_all_member_statistics( pool_names: { item: [ "Common/full_pool_name_exactly_as_it_appears_in_the_UI" ] } );
You will likely have to do the same for structures when used as parameters.
Hope this gets you going - finally! Again, sorry for the delay and hope this helps.
-Joe
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