PHP and iControl REST
Problem this snippet solves: PHP and iControl REST interfaces
Here are a couple of ways to use PHP and iControlREST (iCR). iCR is lighter-weight than iControl SOAP but is only supported on >= v1...
Updated Jun 06, 2023
Version 2.0PeteWhite
Employee
Joined May 16, 2019
DevBabu
Mar 23, 2016Cirrus
Thanks Pete. This was highly helpful. But I get performance issues when I do multiple calls.
My code works like.
1. First Call - > get the pool names (/mgmt/tm/ltm/pool)
2. Second Call -> Based on the pool names(path), get it's status. (mgmt/tm/ltm/pool/~pool~name/stats)
3. Third Call -> Based on the pool names(path), get it's pool members. (/mgmt/tm/ltm/pool/~pool~names/members)
PHP CODE
===================
` "; $tildaPath = str_replace("/", "~", $pools['fullPath']); //GET THE pool stats $pool_stats = iCR($username, $password, "GET", $BASE_URL."/ltm/pool/".$tildaPath."/stats/?\$select=status.availabilityState", NULL); echo $pool_stats["entries"]["status.availabilityState"]["description"] . "
"; //GET THE pool members $pool_members = iCR($username, $password, "GET", $BASE_URL."/ltm/pool/".$tildaPath."/members/?\$select=name,address,state", NULL); foreach ($pool_members['items'] as $members) { echo $members['name']." ".$members['address']." ". $members['state']."
"; } } ?> ` ============================CODE================================================
So, when make first call, I get ~1200 pool. Second call, will degrade the performance. And third call even makes everything worse. I get execution time exceeded error. I increased it to 300s but still that's not enough. Do you have any thoughts on optimizing this code. I would appreciate any help. Thanks