Forum Discussion
keegan_morrison
Nimbostratus
Jun 09, 2008Generating IPPortDefinition in php
Hi. I'm stuck on something that seems so simple, yet has befuddled me for quite some time. Im trying to use LocalLB.PoolMember.wsdl to get statistics (specifically current connections) of a specific node. As far as i know, this is the only way to get stats for a specific node and port, if not please let me know.
Anywho, I'm doing it like this (php5):
$wdsl = "LocalLB.PoolMember.wsdl";
$params['pool_names'][] = $pool;
$addrs = Array(
'address' => '10.93.66.167',
'port' => 80
);
$params['members'] = $addrs;
Here is what this array looks like:
Array
(
[pool_names] => Array
(
[0] => dsweb_tolphp5_pool
)
[members] => Array
(
[address] => 10.93.66.167
[port] => 80
)
)
And here is the output when i call get_statistics():
Array
(
[0] => stdClass Object
(
[statistics] =>
[time_stamp] => stdClass Object
(
[year] => 2008
[month] => 6
[day] => 9
[hour] => 21
[minute] => 3
[second] => 46
)
)
)
If i try to rearrange things, it complains about not being able to find parameter 'address'. I have the correct partition selected, a valid pool, and valid IP/port in that pool for this query.
So, why am i not getting back statistics? I'm guessing its because im not defining my members array correctly. If it does look correct to you, how can i go about troubleshooting further?
- Patrick_Chang_7Historic F5 Accountget_statistics requires an array of strings (the list of pool names - in your case, just one), and a 2 dimensional array of pool members (members per pool).
- keegan_morrison
Nimbostratus
Posted By pchang on 06/09/2008 7:03 PM
- keegan_morrison
Nimbostratus
just a friendly bump. - I specifically haven't answered this one because I have zero experience working with PHP and especially the SOAP interface so I didn't want to mislead you.
- Don_MacVittie_1Historic F5 AccountHere's what I think you're looking for Keegan:
- keegan_morrison
Nimbostratus
Posted By dmacvittie on 06/19/2008 2:25 PM
like I did in my original post, i do not get that error. It still does not work, however.$members = Array('address'=>'10.93.67.167', port=>'80');
$wdsl = "LocalLB.PoolMember.wsdl"; $soapoptions = array('namespace' => 'urn:iControl', 'trace' => 1); $params['pool_names'] = Array(0 => "dsweb_tolphp5_pool"); $params['members'] = Array( 'address' => '10.93.66.167', 'port' => 80); //here is where dmacvittie suggested making the members array an array of arrays, //however, that causes the error message above. print_r($params); //$this->proxy_parms just has my username & password, i know that works fine. $client = new SOAP_Client($this->wsdl_url . $wdsl, true, '', $this->proxy_parms); $client->setOpt('curl', CURLOPT_SSL_VERIFYPEER, 0); $client->setOpt('curl', CURLOPT_SSL_VERIFYHOST, 0); $response = $client->call('get_statistics', $params, $this->soapoptions); if (PEAR::isError($response)) { die( "an error occurred in the call " . $response->message ); } print_r($response); //output soap trace echo $client->__getLastRequest();
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns4="urn:iControl" xmlns:ns5="urn:iControl:LocalLB/PoolMember" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> dsweb_tolphp5_pool 10.93.66.167 80
- mpatel_63830
Nimbostratus
Not sure if you are still having the problem, or if you came up with another way to fix the problem, but I had a similar problem while trying to create pools using php. I had to wrap the entire sequence in an array to get it to work:$p['pool1'] = array(array(array('address'=>'192.168.1.1','port'=>80))); $p['pool2'] = array(array(array('address'=>'192.168.1.2','port'=>80))); foreach ($p as $k => $v) { try { $client->create(array($k),array(0),$v); } catch (Exception $e) { echo $e->getMessage(); } }
Array ( [0] => Array ( [0] => Array ( [address] => 192.168.1.1 [port] => 80 ) ) )
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects