<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Hi Marc!</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">
Here's my request/answer using curl -v: </div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default"><font face="tahoma, sans-serif">$ curl -v -H "X-Auth-Token: my_token" <a href="https://rackspace_api.url/current">https://rackspace_api.url/current</a> | python -m json.tool</font></div>
<div class="gmail_default"><font face="tahoma, sans-serif">* Adding handle: conn: 0xe08fb0</font></div><div class="gmail_default"><font face="tahoma, sans-serif">* Adding handle: send: 0</font></div><div class="gmail_default">
<font face="tahoma, sans-serif">* Adding handle: recv: 0</font></div><div class="gmail_default"><font face="tahoma, sans-serif">* Curl_addHandleToPipeline: length: 1</font></div><div class="gmail_default"><font face="tahoma, sans-serif">* - Conn 0 (0xe08fb0) send_pipe: 1, recv_pipe: 0</font></div>
<div class="gmail_default"><font face="tahoma, sans-serif"> % Total % Received % Xferd Average Speed Time Time Time Current</font></div><div class="gmail_default"><font face="tahoma, sans-serif"> Dload Upload Total Spent Left Speed</font></div>
<div class="gmail_default"><font face="tahoma, sans-serif"> 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* About to connect() to rackspace_api.url port 443 (#0)</font></div><div class="gmail_default">
<font face="tahoma, sans-serif">* Trying 174.143.139.141...</font></div><div class="gmail_default"><font face="tahoma, sans-serif">* Connected to rackspace_api.url (ip) port 443 (#0)</font></div><div class="gmail_default">
<font face="tahoma, sans-serif">* Initializing NSS with certpath: sql:/etc/pki/nssdb</font></div><div class="gmail_default"><font face="tahoma, sans-serif">* CAfile: /etc/pki/tls/certs/ca-bundle.crt</font></div><div class="gmail_default">
<font face="tahoma, sans-serif"> CApath: none</font></div><div class="gmail_default"><font face="tahoma, sans-serif">* SSL connection using SSL_RSA_WITH_RC4_128_SHA</font></div><div class="gmail_default"><font face="tahoma, sans-serif">* Server certificate:</font></div>
<div class="gmail_default"><font face="tahoma, sans-serif">* subject: CN=rackspace_api.url,OU=Domain Validated,OU=Thawte SSL123 certificate,OU=Go to <a href="https://www.thawte.com/repository/index.html,O=rackspace_api.url">https://www.thawte.com/repository/index.html,O=rackspace_api.url</a></font></div>
<div class="gmail_default"><font face="tahoma, sans-serif">* start date: Nov 18 00:00:00 2010 GMT</font></div><div class="gmail_default"><font face="tahoma, sans-serif">* expire date: Nov 17 23:59:59 2015 GMT</font></div>
<div class="gmail_default"><font face="tahoma, sans-serif">* common name: </font><span style="font-family:tahoma,sans-serif">rackspace_api.url</span></div><div class="gmail_default"><font face="tahoma, sans-serif">* issuer: CN=Thawte DV SSL CA,OU=Domain Validated SSL,O="Thawte, Inc.",C=US</font></div>
<div class="gmail_default"><font face="tahoma, sans-serif">> GET /v1.0/account_id/loadbalancers/lb_id/usage/current HTTP/1.1</font></div><div class="gmail_default"><font face="tahoma, sans-serif">> User-Agent: curl/7.33.0</font></div>
<div class="gmail_default"><font face="tahoma, sans-serif">> Host: </font><span style="font-family:tahoma,sans-serif">rackspace_api.url</span></div><div class="gmail_default"><font face="tahoma, sans-serif">> Accept: */*</font></div>
<div class="gmail_default"><font face="tahoma, sans-serif">> X-Auth-Token: my_token</font></div><div class="gmail_default"><font face="tahoma, sans-serif">></font></div><div class="gmail_default"><font face="tahoma, sans-serif">< HTTP/1.1 200 OK</font></div>
<div class="gmail_default"><font face="tahoma, sans-serif">< Content-Type: application/json</font></div><div class="gmail_default"><font face="tahoma, sans-serif">< Via: 1.1 Rackspace Cloud Load Balancer API v1.19.28 (Repose/2.11.0)</font></div>
<div class="gmail_default"><font face="tahoma, sans-serif">< Content-Length: 7265</font></div><div class="gmail_default"><font face="tahoma, sans-serif">< Date: Mon, 10 Feb 2014 15:47:28 GMT</font></div><div class="gmail_default">
<font face="tahoma, sans-serif">* Server Jetty(8.0.y.z-SNAPSHOT) is not blacklisted</font></div><div class="gmail_default"><font face="tahoma, sans-serif">< Server: Jetty(8.0.y.z-SNAPSHOT)</font></div><div class="gmail_default">
<font face="tahoma, sans-serif"><</font></div><div class="gmail_default"><font face="tahoma, sans-serif">{ [data not shown]</font></div><div class="gmail_default"><font face="tahoma, sans-serif"> 53 7265 53 3884 0 0 7158 0 0:00:01 --:--:-- 0:00:01 7100 7265 100 7265 0 0 12349 0 --:--:-- --:--:-- --:--:-- 12376</font></div>
<div class="gmail_default"><font face="tahoma, sans-serif">* Connection #0 to host </font><span style="font-family:tahoma,sans-serif">rackspace_api.url</span><font face="tahoma, sans-serif"> left intact</font></div><div class="gmail_default">
<font face="tahoma, sans-serif">{</font></div><div class="gmail_default"><font face="tahoma, sans-serif"> "links": [],</font></div><div class="gmail_default"><font face="tahoma, sans-serif"> "loadBalancerUsageRecords": [</font></div>
<div class="gmail_default"><font face="tahoma, sans-serif"> {</font></div><div class="gmail_default"><font face="tahoma, sans-serif"> "averageNumConnections": 17.5,</font></div><div class="gmail_default">
<font face="tahoma, sans-serif"> "averageNumConnectionsSsl": 0.0,</font></div><div class="gmail_default"><font face="tahoma, sans-serif"> "endTime": "2014-02-09T17:00:00Z",</font></div>
<div class="gmail_default"><font face="tahoma, sans-serif"> "id": id;</font></div><div class="gmail_default"><font face="tahoma, sans-serif"> "incomingTransfer": 3816105,</font></div>
<div class="gmail_default"><font face="tahoma, sans-serif"> "incomingTransferSsl": 0,</font></div><div class="gmail_default"><font face="tahoma, sans-serif"> "numPolls": 12,</font></div>
<div class="gmail_default"><font face="tahoma, sans-serif"> "numVips": 1,</font></div><div class="gmail_default"><font face="tahoma, sans-serif"> "outgoingTransfer": 529684773,</font></div>
<div class="gmail_default"><font face="tahoma, sans-serif"> "outgoingTransferSsl": 0,</font></div><div class="gmail_default"><font face="tahoma, sans-serif"> "sslMode": "OFF",</font></div>
<div class="gmail_default"><font face="tahoma, sans-serif"> "startTime": "2014-02-09T16:00:00Z",</font></div><div class="gmail_default"><font face="tahoma, sans-serif"> "vipType": "PUBLIC"</font></div>
<div class="gmail_default"><font face="tahoma, sans-serif"> },</font><span style="font-family:tahoma,sans-serif"></span></div><div class="gmail_default"><span style="font-family:tahoma,sans-serif">..and so on..</span></div>
<div class="gmail_default"><span style="font-family:tahoma,sans-serif"><br></span></div><div class="gmail_default"><span style="font-family:tahoma,sans-serif">But, I got a doubt in the next item, now I've this set up in collectd.conf</span></div>
<div class="gmail_default"><span style="font-family:tahoma,sans-serif"><br></span></div><div class="gmail_default"><div class="gmail_default"><font face="tahoma, sans-serif"><Plugin curl_json></font></div><div class="gmail_default">
<font face="tahoma, sans-serif"> <URL "<a href="https://rackspace_api.url/usage/current">https://rackspace_api.url/usage/current</a>"></font></div><div class="gmail_default"><font face="tahoma, sans-serif"> Instance "Load_Balancer"</font></div>
<div class="gmail_default"><font face="tahoma, sans-serif"> Header "X-Auth-Token: my_token"</font></div><div class="gmail_default"><font face="tahoma, sans-serif"> <Key "LoadBalancerUsageRecords/*/averageNumConnections"></font></div>
<div class="gmail_default"><font face="tahoma, sans-serif"> Type "connections"</font></div><div class="gmail_default"><font face="tahoma, sans-serif"> </Key></font></div><div class="gmail_default"><font face="tahoma, sans-serif">..</font></div>
<div class="gmail_default"><font face="tahoma, sans-serif"><br></font></div><div class="gmail_default"><font face="tahoma, sans-serif">I've defined a Header with my token_id to make it work (it was the only way I found). So, you suggest I add another Header value? and I'm still not sure which would it be, I see a GET header but is it?</font></div>
<div class="gmail_default"><font face="tahoma, sans-serif"><br></font></div><div class="gmail_default"><font face="tahoma, sans-serif">Thanks again!</font></div></div><div class="gmail_default"><span style="font-family:tahoma,sans-serif"><br>
</span></div><div class="gmail_default"><span style="font-family:tahoma,sans-serif"><br></span></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 10 February 2014 10:22, Marc Fournier <span dir="ltr"><<a href="mailto:marc.fournier@camptocamp.com" target="_blank">marc.fournier@camptocamp.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Excerpts from Mariano González's message of 2014-02-06 13:32:56 +0100:<br>
<div class="">> Hi Marc.<br>
><br>
> The request I run manually is:<br>
><br>
> curl -H "X-Auth-Token: my_token"<br>
> <a href="https://API_url/1.0/account_id/loadbalancers/lb_id/usage/current" target="_blank">https://API_url/1.0/account_id/loadbalancers/lb_id/usage/current</a> | python<br>
> -m json.tool<br>
><br>
> And collectd uses the curl_json plugin, which I don't know what it requests<br>
> (I assume it uses curl, but I'm not sure how).<br>
><br>
> Could you guide me on how to tcdump this connections please?<br>
<br>
</div>Actually, ngrep is a similar tool which output is easier to read when<br>
you're only interested in the "application layer". Try:<br>
<br>
sudo ngrep -d any -W byline port 80<br>
<br>
I see you're using https though. If you can't switch to plain http, you can<br>
probably forget about dumping the network traffic.<br>
<br>
"curl -v" will show you what headers are sent in the HTTP(s) request. Then<br>
try to use collectd's "Header" option to the curl_json plugin and make it<br>
match the headers sent by the curl CLI tool.<br>
<br>
As the curl CLI tool works, I'm pretty sure what you are attempting is<br>
feasible. It's just a matter of finding the correct parameters.<br>
<span class="HOEnZb"><font color="#888888"><br>
Marc<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Mariano Gabriel González</div>
</div>