For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Tyler_04_143455's avatar
Tyler_04_143455
Icon for Nimbostratus rankNimbostratus
Mar 09, 2014

Ruby iControl, using GlobalLB.PoolMember

I have the code to give the pools, and virtual ips for a wideip, but I also want to include the server and enabled state for each vip, but have reached a stumbling block and can't seem to submit the right info.

 

The code block I have in my script is:

 

wip = dig(ARGV[0])
bigip = F5::IControl.new("{gtm}", ENV['BIP_USER'], ENV['BIP_PASS'], ["GlobalLB.WideIP","GlobalLB.Pool","GlobalLB.PoolMember"]).get_interfaces
wip_pools = bigip["GlobalLB.WideIP"].get_wideip_pool(wip)[0]
wip_pools = wip_pools.map do |wip_pool|
    wip_pool = wip_pool.pool_name
    wip_pool = wip_pool.to_a.push(bigip["GlobalLB.Pool"].get_enabled_state(wip_pool))
    vips = bigip["GlobalLB.Pool"].get_member(wip_pool[0])[0]
    vips = vips.map do |vip|
        vip = [vip.member.address,vip.member.port]
        puts "Debug {wip_pool[0]}"
        puts "Debug {vip[0]} : {vip[1]}"
        vip = vip.push(bigip["GlobalLB.PoolMember"].get_enabled_state(wip_pool[0],[vip]))
        puts "Debug {vip[0]} : {vip[1]} - {vip[2]}"
        vip = vip.push(bigip["GlobalLB.PoolMember"].get_dependency(wip_pool[0],[vip]))
        puts "Debug {vip[0]} : {vip[1]} - {vip[2]}  Server: {vip[3]}"
    end
end

but when I try running it I get:

 

-bash-4.1$ ./wideip.rb www.***.com
Debug www.***.com-default
Debug **.**.**.** : 80
: Cannot convert null value to unsigned long. (SOAP::FaultError)

I believe it is the IPPortDefinition that it wants that I am doing incorrectly. Any help would be appreciated.

 

2 Replies

  • I've never seen Ruby before but it seems that {vip[1]} is 80...what is {vip[2]} ?It's the only variable that hadn't been previously referenced.....

     

    • Tyler_04_143455's avatar
      Tyler_04_143455
      Icon for Nimbostratus rankNimbostratus
      bigip["GlobalLB.PoolMember"].get_enabled_state(wip_pool[0],[vip]) is being pushed into the vip array. So if get_enabled_state were successful (currently it is not) then that result would vip[2]