Forum Discussion
Not able to fetch object status of virtual server
Hello , I am using below php script to fetch status of virtual servers but getting exception.
$location="https://$hostname/iControl/iControlPortal.cgi?"; $wsdl_VS="https://$hostname/iControl/iControlPortal.cgi?WSDL=LocalLB.VirtualServer"; $wsdl_V2="https://$hostname/iControl/iControlPortal.cgi?WSDL=LocalLB.VirtualAddressV2"; $client_VS = new SoapClient($wsdl_VS,array('location'=>$location,'login'=>$username,'password'=>$password)); $client_V2 = new SoapClient($wsdl_V2,array('location'=>$location,'login'=>$username,'password'=>$password));
$vs_list=$client_VS->get_list(); sort($vs_list);
$vsstatus=$client_V2->get_object_status($vs_list);
foreach ($vsstatus as $value) { print_r( $value); }
} catch (Exception $e) { echo "Error: " .$e->getMessage(); } ?>
I am getting below exception.I can print all virtual server list.
Error: Exception caught in LocalLB::urn:iControl:LocalLB/VirtualAddressV2::get_object_status() Exception: Common::OperationFailed primary_error_code : 16908342 (0x01020036) secondary_error_code : 0 error_string : 01020036:3: The requested virtual address (/Common/xxxxx) was not found.
Could you help me understand if I can do it differently? Thanks in advance.
br, rohan
7 Replies
- mimlo_61970
Cumulonimbus
Your not sending the right input to get_object_status.
LocalLB.VirtualServer.get_list() returns a list of virtual servers names.
LocalLB.VirtualAddressV2.get_object_status() wants a list of virtual addresses, not names like you are passing it.
if you change the first call to LocalLB.VirtualAddressV2.get_list(), and pass that to the second call, that will return the list you are after.
Of course if you need the names of the virtual servers for display purposes, you'll need to add in some additional calls to gather all that.
- rohans77
Nimbostratus
Hi Mimlo ,
Thanks for your help but still not able to fetch data.Actually my requirement is to gather all data from virtual server ( default pool ,members etc).
$vs_list=$client_VS->get_list(); sort($vs_list);
$pool_list=$client_VS->get_default_pool_name($vs_list); sort ($pool_list); foreach ($pool_list as $value) { echo $value; }
I am getting respective pools till here but after that I am passing that pool_list to fetch pool details and getting exceptions.
$membermonlist=$client_LocalLB.PoolMember->get_monitor_status($pool_list); $poolstatus=$client_LocalLB.Pool->get_object_status($pool_list); $memberlist=$client_LocalLB.PoolMember->get_object_status($pool_list); $membermonlist=$client_LocalLB.PoolMember->get_monitor_status($pool_list);
Error: Exception caught in LocalLB::urn:iControl:LocalLB/Pool::get_object_status() Exception: Common::OperationFailed primary_error_code : 16908342 (0x01020036) secondary_error_code : 0 error_string : 01020036:3: The requested pool () was not found.
Could you please help me on this ?
- mimlo_61970
Cumulonimbus
What version of LTM are you using? LocalLB.PoolMember was deprecated in v11, just want to make sure you are on 9 or 10 before I try and see what is wrong. - rohans77
Nimbostratus
I am using v11.4.0 - mimlo_61970
Cumulonimbus
Ok, just be aware the LocalLB.PoolMember is deprecated in 11. Everything was moved into LocalLB.Pool
- mimlo_61970
Cumulonimbus
Just tested this on mine, and it turns out I have some virtual servers that have no default pool(http to https redirect virtuals), so the get_object_status throws an exception on the entries in the list that are empty.
Check the contents of your get_default_pool_name and see if there are any empty entries in the list, and remove them before sending to get_object_status
- rohans77
Nimbostratus
Thanks a lot Mimlo. I got the point and tried with below script. $pool_list=$client_VS->get_default_pool_name($vs_list); foreach ($pool_list as $key=>$value) if(empty($value)) unset($pool_list[$key]); It is working fine.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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